Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing a parent's object
Message
De
28/08/2007 12:42:16
 
 
À
28/08/2007 06:57:38
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01250681
Message ID:
01250943
Vues:
15
>>AFAIK (and that may be even less than you), as long as oxServer is visible to oxHandler you should be able to reference any method or property.
>
>I mean no offense, but this is the crux of the misunderstanding. Objects are not supposed to know *anything* about the innards of each other.

It's not a misunderstanding. I realize it violates OOP standards. But I tend to look upon them more as guidelines than requirements.

I suppose this is an example of the maintenance programmer in me vs. the designer in you. I see the request as "how can I get this done now" and you see it as "how should it have been done in the first place."

If I were the original designer of Jay's system (unlikely since my design skills are not all that strong), each of the two objects would be properties of the same parent object and you could get the values from This.Parent (Question....in OOP design is an object supposed to know about its parent's methods and properties?).

But as a maintenance programmer, I am loathe to uproot the original design to accommodate new requirements. I do understand that this is the way spaghetti systems are built. We'll patch this, then that, then the other thing, etc. until the whole thing is a mess. But each individual decision makes sense in the context in which it was made. To completely re-design a system each time doesn't always make real-world sense, even if it makes the future re-design orders of magnitude harder.



>I'm always trying to find examples in the real world to demonstrate the problem ... if a sparkplug could access the inside of the gas tank, BOOM and you're dead!
>
Actually, there would be several blown up test cars and I would find another way of getting what I need.

Question for you........

If an object shouldn't know about anything other than itself, and if doing what I suggested is wrong then why does the language allow it? My first commandment of programming is "Thou shalt not tempt thy user to commit an abomination." If they shouldn't do something, they aren't allowed to do it. Why not simply restrict visibility within an object only to its own properties and methods?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform