Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to put code for calculated properties?
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Where to put code for calculated properties?
Miscellaneous
Thread ID:
00470214
Message ID:
00470214
Views:
63
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.
Next
Reply
Map
View

Click here to load this message in the networking platform