def programming

#functions

Sometimes, the elegant implementation is just a function. Not a method. Not a class. Not a framework. Just a function.

In order to understand recursion, one must first understand recursion.

The ideal numbers of arguments for a function is zero (niladic). Next comes one (monadic), followed closely by two (dyadic). Three arguments (triadic) should be avoided where possible. More than three (polyadic) requires very special justification ‐ and then shouldn't be used anyway.

Functions should do one thing. They should do it well. They should do it only.

It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.

To iterate is human, to recurse divine.

The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that.

Built with using

Source code available @ githubpull requests are more than welcome ;-)