Re: Re: [PHP] OOP: class variables question
| From: | Chris Carbaugh | Date: | Sat, 11 Nov 2000 19:15:42 +0000 |
| Subject: | Re: Re: [PHP] OOP: class variables question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24801@lists.php.net to get a copy of this message | ||
On Sat, 11 Nov 2000, Teodor Cimpoesu wrote:
<snip>
> Now, what I remember about an old 'private vars' thread on php-dev
> was that somebody (Mathew Kooiman? don't remember, or somebody from
> France
> I think) implemented a patch to allow private members, then Zeev
> said
> he will implemented it in a later version (again, iirc).
>
> The issue was the added overhead, and my suggestion at that time was
> to use
> python way of rewriting variable names, which in your examples it
> would look
> like
>
> when one writes:
> class A { var $__data = "foo" ; }
> class B extends A { var $__data = "foo" ; }
>
> the actual translation of the code would be into:
> class A { var $_A__data = "foo" ; }
> class B extends A { var $_B__data = "foo" ; }
>
> so until this is implemented (or something else) you can write it by
> hand :)
>
> -- teodor
If I'm understanding this right,
when the classes are interpreted, all variable are simply prefixed with
the classes name?
While this seems like a solution to me (when it gets implemented) it
doesn't help know.
Consider the following,
I take over a project that's been in progress for years. 10s of
housands of lines of code, hundreds of classes, many developers.
I couldn't even begin to imagine the problems there. On my current
project, with about 5 thousand lines of code, 20 couple classes, and me
as the only developer I've already ran into this problem.
Add the Zend encoder in there, and you can't (in theory, anyway) go
back and look at the class vars. And no bugger to speak of, your out
of luck. (anybody using the ?nexidion? debugger yet?)
Now the solution you describe sounds great, and can be implemented with
just good programming practice (which is where I missed the boat).
I use alot of open source code, and release some of mine. Everybody
doesn't adhere to good programming practice. Especially those like me,
who have no real coding experience prior to PHP.
I quess what i'm getting at is if there is a standard I (we all) should
follow when using OOP? Any of the PHP books cover this? (I've never
read any of them) Any other 'general programming practice' books out
there relevant to this subject?
Thanks,
Chris