Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to put code for calculated properties?
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Where to put code for calculated properties?
Divers
Thread ID:
00470214
Message ID:
00470214
Vues:
62
Is there a "best practice" for where to put the code for calculated values stored in the properties of an object? Access methods are nice, but the calculations get executed a lot more often than necessary. In the interests of polymorphism, I thought about using a Calculate() method which is passed a code string (ie. oMyObject.Calculate("TAX")) to determine which calculation to perform. Although this provides a standard interface, I don't really think it meets the goals of polymorphism, since you have to know the code of each calculation you want to perform. Perhaps a custom method for each calculation is the best way to go (ie. oMyObject.CalcTax()). It does tell you exactly what the method does.

What do you think? Your opinion is appreciated.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform