On Jan 17, 2006, at 1:24 PM, Don Taylor wrote:

Ok, but could you require that all Names be unique to a form so that you could use a Name for a RegID and then you cold drop the separate concept of both a Name and a RegId. More Pythonic? Do you lose anything by doing this?

Yes, you lose the ability to add composite classes without having to jump through a million hoops. Consider that every single dLabel control will now have to have a unique name among every other dLabel on the form, even if they are on different pages of different pageframes.

Names are automatically handled, and every object has a Name. You can largely ignore the Name property of an object, and let the framework deal with it. Names are unique across fully-qualified paths, such as: myForm.mainPageFrame.pgAddress.pnlTop.txtStreet. There can be another object with the name 'txtStreet' on a form, but it will be located somewhere else.

I always have a hard time coming up with names for things that are pretty much the same thing from my perspective. So far I have cut and pasted the Name into the RegID property because I can't think of anything better.

Are you setting RegID for every control? The vast majority of controls will never need or use a RegID; it will remain blank. Only those controls which need to be referenced from somewhere else ever need a RegID. The philosophy is that if objects need to communicate with each other, there needs to be an absolute, unambiguous and reliable method for such communication. Let's say that the control with the fully-qualified pathname above has the RegID of 'street'; any object can now interact with it by using 'self.Form.street'. Sure, it could also use 'self.Form.mainPageFrame.pgAddress.pnlTop.txtStreet', but that requires an awful lot more tight coupling between the controls and the form. If another programmer were to later rename 'mainPageFrame', say, to something else, the long path name is now broken, whereas the RegID reference is still intact.

In object-oriented design, you program to an interface, not an implementation. RegID defines an object's interface to other objects, whereas the full Name path is an implementation detail.

I hope that this sheds a little more light on the differences between the two. Me, personally: I rarely do anything with the Name of an object; I simply don't find them all that useful.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to