Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where to put code for calculated properties?
Message
De
30/01/2001 20:16:21
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00470214
Message ID:
00470456
Vues:
28
>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.

I use methods like CalculateTax() for this.

.02
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform