I claim that using functions effectively is tricky, and will try to convince you of this claim with the following examples.
Most of the time you want to create functions that do only one task. No multi-purpose functions—most of the time. I once wrote a graphics program to read in an image file and print it in color (one function) or print it in gray-scale (another function). Much of the code in two functions was the same, or almost the same. Using a Boolean parameter (colorFlag), both the gray and color functions could be combined into one function. Thus, I had one less ...