Programmers generally have in mind a main flow of control for their programs. Processing starts here, ends there. There may be decisions and exceptions along the way, but the computation has a path to follow. Use your programming language to clearly express that flow.
Some programs, particularly those that are designed to work reliably in hostile circumstances, don’t really have a visible main flow. These programs are in the minority, however. Using the expressive power of your programming language to clearly express little-executed, seldom-changed facts about your program obscures the more highly leveraged part of your program: the part that will be read, understood, and changed frequently. It’s not that exceptional conditions are unimportant, just that focusing on expressing the main flow of the computation clearly is more valuable.
Therefore, clearly express the main flow of your program. Use exceptions and guard clauses to express unusual or error conditions.
|This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License|