Monday, December 10, 2018

Write To Read Top-Down

Image showing a bird's eye view of city.

People generally read a program from top to bottom. Write your programs to help others understand them. Among the implications of this principle are:
  1. Include a detailed external specification up front to clearly define the program purpose and use.
  2. Specify externally accessed routines, variables, and algorithms up front.
  3. Use the "structured" programming constructs, which are inherently easier to follow.

Reference:
Kernigham, B., and Plauger, P., The Elements of Programming Style, New York: McGraw-Hill, 1978.