Reply to Re: Using a Resource as a Class Property

Your name:

Reply:


Posted by Jerry Stuckle on 07/23/07 16:09

Sanders Kaufman wrote:
> Jerry Stuckle wrote:
>> Sanders Kaufman wrote:
>
>>> I seriously considered writing the classes in a way to where the
>>> parent would *presume* all kinds of stuff about the child, but it
>>> didn't jibe with my obsession with atomicity - so I didn't do it.
>>
>> The child class defines the derivation, and therefore knows it has a
>> parent class (and some things about that parent). However, the parent
>> doesn't know if (or when) it is being used as a base class, so it
>> should never assume things which may or may not be there (or set).
>
> So - it's okay in the purist of OOP to have a child that presumes things
> about the parent, but not t'other way 'round?
>

Not just a purist. Its the way things HAVE to be.

The child always has a parent (and what that parent is). But the parent
may or may not have children, and never knows one way or the other. And
if it does have children, it doesn't know what those children might be.

> That makes a little better sense. I was kinda beginning to wonder what
> use there was to having a child that couldn't (or shouldn't) talk to its
> parent.
>
> All of my classes talk with their parents, and I was thinking I might be
> doing something non-OOP there.
>

Nope, that's part of what makes OO so powerful.

> Parent. Parents. Hmmm. That takes me to a new question - I understand
> that a PHP class be an extension of more than one parent class.
> (e.g. "class myClass extends oMommy, oDaddy") Are there any common
> pitfalls y'all wanna warn me about before I start adding that way to my
> mind's toolbox?
>
> I haven't started doing it that way yet because I've only just started
> doing OOP in PHP... but it stands to reason that I likely will, and soon.
>
>

There's a lot PHP doesn't have yet. But it's getting closer. PHP 5 is
a step in the right direction, and PHP 6 will be even more so.




--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация