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 C++ Programming Language by Bjarne Stroustrup
ISBN: 0201700735 This book is available from
In order to understand recursion, one must first understand recursion.
Sometimes, the elegant implementation is just a function. Not a method. Not a class. Not a framework. Just a function.
The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that.
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.