Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How disappointed I am .
Message
De
08/02/2002 08:50:50
 
 
À
08/02/2002 04:08:07
Max Chen
Yx Software
Shunde, Chine
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00615259
Message ID:
00617252
Vues:
31
>Do you consider that is breaking the principal of OOP ?

Yes, absolutely! The two fundamental benefits of OOP over procedural programming are Re-Usability and Maintainability.

If you add methods to objects (as opposed to classes) you cannot re-use the methods, or the code. In your example you cannot re-use your "added_method" anywhere else. So if the next form you create also needs it, you have to duplicate the code. Now, if you happen to want to change the code, you have TWO places that have the same code in them.

You also break the maintainability because you can no longer replace the object with another without breaking your code unless you first adding all the 'extra' methods back. Suppose you have a button on a form, to which you have added an extra method and then you need to replace the button with one based on a different sub-class. YOu now have to re-create the custom method.

What you are doing is NOT OOP it is simply procedural programming using VFP Base Classes directly. Instead of simply asking for changes in the tool, maybe you should consider whether the way in which you are trying to use it is actually correct?
----
Regards
Andy Kramek
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform