I suppose it's the use of variables in _global. That's what I avoid.
Else, 5 years later, when you've got extensive classes, and something
ddoesn't work, it might be because some variables overwrite one
another in _global. That'd take almost forever to debug.
On 3/24/06, David Stiller [EMAIL
yeah its yuck, though i use it myself here and there for the cheap hack that
it can be. i think generally most programming languages (or the prgrammers
using those languages) look down upon global vars. i think the idea is that
it pretty much destroys encapsulation and object-oriented principles.
mailing list
Subject: Re: [Flashcoders] Wherefore the evils of _global?
yeah its yuck, though i use it myself here and there for the
cheap hack that
it can be. i think generally most programming languages (or
the prgrammers
using those languages) look down upon global vars. i think
What I don't understand -- and I hasten to say I have no opinion on
the matter, yet -- is why _global is so shunned. After all, _global is
exactly where AS2 classes are located. Is this a religious issue? Is it
because of how _global gets shared (or not?) among dynamically
loaded SWFs?
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
Responding to two, here ...
ryanm 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
Okay, I'm with you. That jibes with my understanding of OOP in
a universal sense. In ActionScript, however, classes *are* properties
of the _global object, which is what prompted my question. Programmers
in general may agree to avoid global variables in principle, and what
I'm hearing is that
7 matches
Mail list logo