The top-down approach to program design splits the initial
problem into several sub-problems which in turn can be further
sub-divided. Once a sub-problem is simple enough to solve then it can
be implemented as a function.
A function should be completely self-contained. That is it should
communicate with the calling program only via supplied input parameters
and output parameters. The user of a function should not have to know
any details of how the function is implemented.
Functions encourage the re-use of code and can encapsulate knowledge and
techniques of which the user has no knowledge.