Tags: functional programming naming
In a functional programming language, and in general good program design, functions or methods should perform some behaviour on their arguments and return a value. There should be no SideEffects.
A no argument function / method should be substitutable for a value.
You should not have to know whether your value is stored or calculated.
Example: 'price() * fxRate()' could just as easily be 'price * fxRate' [In most languages you need the () if it's a method, so not exactly equivalent, but pretty close]
Last published: Tuesday 13th April 2010
<<Previous Next>>