Using $this->owner - wrong or right?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

I would say:

1. When building a structure of linked objects, like a tree, where the parent link is essential

2. When you (really) cannot solve the given problem using normally separated concerns
(#10850)
wei
Forum Contributor
Posts: 140
Joined: Wed Jul 12, 2006 12:18 am

Post by wei »

i think you are building a control hierachcy (e.g, a tree), so use the standard naming, parent/child. You may want to create also a container/containee relationship for logical containments (such as, requirement of TInput to be within a TForm).

looks slightly like http://trac.pradosoft.com/prado/browser ... ebControls, even down to the naming...
wei
Forum Contributor
Posts: 140
Joined: Wed Jul 12, 2006 12:18 am

Post by wei »

for event propagation, there are 3 types that may be considered. 1) bubble the event from root to destinated node. 2) bubble from node to root. 3) trigger event on the node only. all 3 have their uses: 1) the node can reactive to changes in the parents/containers, 2) the events can be handled in containing/parent nodes. 3) usually also used in combination with 1 and/or 2.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

Hm ... any comments regarding this: http://www.w3.org/TR/DOM-Level-2-HTML/h ... ID-6043025. We have $this->owner structure in W3C standards.
form of type HTMLFormElement, readonly
Returns the FORM element containing this control. Returns null if this control is not within the context of a form.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply