On 3/23/06, ryanm <[EMAIL PROTECTED]> wrote:

>     Because global variables are contrary to the basis of OOP, which is
> all
> about abstraction and encapsulation. If you need to store variables
> somewhere so that they can be reached anywhere, use a singleton, or a
> static
> class, or an application object, and so on.


Uh, a singleton can be just a round-about method of the global namespace,
but is exactly the same thing (or at least the way I've seen it used with a
__resolve).

_global is a perfect place to store application meta data, the stuff you
might load from an XML file. Such as urls, configurations, etc. However, I
do agree that if you're building anything of significance (in size) you
should have a class (as you mentioned classes are global) that can act as a
singleton or a static; but the trick is it has each property it will hold
defined in it. This way every thing thrown the way of global vars is
documented, type checked, and follows some sort of API. This is easy to
track and debug. That is the hard thing about straight global, finding where
in the world the thing got set or changed when it's being messed up.

 Tyler
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to