Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Philosophical question
Message
De
30/04/1998 10:13:16
Tim Hockin
Illinois State U - Residential Computing
Normal, Illinois, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00095802
Message ID:
00095976
Vues:
21
This was my first thought. My feelings about OO encapsulation are this: No class definition should reference an object NOT in teh class.

In other words, I'll use a real example. I commonly use OK, Cancel, Apply buttons. They ALWAYS do the same thing, so why code them? They generally line up the same way on every form, too. I made each button a class that does what it needs, then a container class with all three buttons. I now add my Buttonarray class to forms, and i'm done.

I think correct encapsulation should ensure that any object (with some exceptions, that we handle specifically as abstract classes) should be able to be instantiated by itself, and not rely on other objects it does not contain.

Just my thoughts after much ponderance on OO.

>One way of doing this if you've got a group of controls that need to function together is to put them in a container. They can talk to each other using this.parent.AnotherControl. The container becomes the place to put common methods so the controls can just call a this.parent.Method() to get stuff done. So this whole thing becomes a functional component that can just be dropped onto something else a form, page or other container.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform