[UPHPU] Accessing a Parent Object's Other Variables

Richard K Miller richardkmiller at gmail.com
Tue Jun 23 13:51:34 MDT 2009


Here's an article on it, from one of the Gang of Four:

http://www.artima.com/lejava/articles/designprinciples4.html

Richard







On Jun 23, 2009, at 12:13 PM, Kirk Cerny wrote:

> I would still not write it this way, but good point Alvaro.
>
> Kirk Cerny
>
> On Tue, Jun 23, 2009 at 11:44 AM, Alvaro  
> Carrasco<alvaro at epliant.com> wrote:
>> I disagree. Having a child hold a reference to it's parent (in  
>> composition
>> of course) is a very common approach in object-oriented  
>> programming. I don't
>> think you have any problem with readability by doing that and I  
>> don't think
>> there's anything wrong with it at all.
>>
>> Alvaro
>>
>> Kirk Cerny wrote:
>>>
>>> But in this case it appears that A has B and B has A.
>>> I would be alright if it was just A has B.
>>> The circular part is where I think you get into trouble especially
>>> with readability, and understandable code.
>>>
>>> Kirk Cerny
>>>



More information about the UPHPU mailing list