Re: Re: Scope woe
| From: | Shawn McKenzie | Date: | Tue, 30 Jun 2009 21:45:11 +0000 |
| Subject: | Re: Re: Scope woe | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294766@lists.php.net to get a copy of this message | ||
Eddie Drapkin wrote:
> On Tue, Jun 30, 2009 at 10:44 AM, Luke<luke@blog-thing.com> wrote:
>
> What I meant, and I probably sounded a bit rougher than I absolutely
> had to, was that it's pretty universally lazy and/or bad design to use
> global variables inside a class, because classes have member
> properties. From a purely philosophical standpoint, classes are
> supposed to be entirely self-contained and any data that a method
> needs to process is supposed to be passed as a parameter, or exist
> inside the class as a property. It helps to think of classes like
> cars on a highway; if you want it to go faster, you give it some gas
> (pass a method a parameter), but if you want to turn on some music
> while driving, the CDs should already exist in the car (accessing a
> member property) even though they might have been added earlier (via a
> different method with other parameters). That's probably not the
> greatest metaphor, but I hope you see what I'm saying.
>
You are correct as there was no metaphor in here at all! This, "It
helps to think of classes like cars on a highway", is almost a simile,
but on the whole I would probably say that you were using an analogy :-)
--
Thanks!
-Shawn
http://www.spidean.com