Home Segments Index Top Previous Next

258: Mainline

The keep-it-simple principle: In general, programs with complex program elements are difficult to write, to debug, to improve, and to maintain. Accordingly, when a class definition starts to be too complex to understand easily—certainly when it covers more than 20 lines or so—you should think about moving out the member-function definitions using the double-colon device for linking them into the class. Similarly, when a function definition of any kind becomes too complex to understand easily, you should think about breaking it up into smaller functions that you can debug and maintain independently.