in reply to OO, Class::MethodMaker, and get_set

If C isn't settable, and is derived from A and B, it isn't an attribute, it's a result or returned value.

If the parameters are many, and the calculation is expensive, then re-calculating the results each time an attribute is set, rather than waiting until the result is requested will mean that many expensive calculations will be done, only to be discarded if more than one attribute can change between results being needed.

Better to allow Class::MethodMaker to define your setter and getters on the attributes and only perform the calculation when the result is requested via your hand-coded method for this purpose.

If you need to cache the results for efficiency, retain an internal copy of the attributes used along with the calculated result and only recalculate if they have changed.


Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.
  • Comment on Re: OO, Class::MethodMaker, and get_set