quote:Original post by SabreMan
A log file''s a reasonable candidate for being globally accessible, but I have to wonder about your global dumping ground for data. Why?
Well since one year or so I''ve played with DirectX tut, then Nehe tutorial, and I always ended up with an Application class storing some data that I decided "it has to be global !". Thus tuning this class I was obliged to implement a new field (btw it was *public* fields -yes you can shoot me, but at that time, good practices was not the point of my previous training, and I am sooo lazy...-)
On the other hand at work I''m a developping web sites and intranet applications and in environnement like theese (broadvision, jsp, ...), there is an Application object that can store the data that are globally accessible. There are also Session object that do the same for a user-session scope.
So I transposed this model to my API to have the same facilities.
(class Application and class Session)
quote:Original post by SabreMan
I mean, from your example, what are "width" and "height" - the screen size, right? Why does the screen size have to be globally accessible? When you play a sound do you need to know the screen size?
I thought the same after posting, the exemple was not relevant as such values can be stored and retrieved using the hypothetically class Screen.... But the exemple was to show what the class could do.
*Maybe* I would store the Screen instance instead.
Another possible use I''ve just thought about is to store localised messages.
quote:Original post by SabreMan
It appears that you are carrying out the semantic equivalent of this:
class Application{public: // everything};
That''s it. The point is that depending on the application, the "everything" is different. With my implementation I can go without rewrite a new dedicated Application class. This is my tribute to my Legendary Old Lazzyness (aka LOL
).
----
David Sporn AKA Sporniket