Laying Out Routines

Routines are composed of individual statements, data, control structures, comments— all the things discussed in the other parts of the chapter. This section provides layout guidelines unique to routines.

Cross-Reference

For details on documenting routines, see "Commenting Routines" in Commenting Techniques. For details on the process of writing a routine, see Constructing Routines by Using the PPP. For a discussion of the differences between good and bad routines, see Chapter 7.

Use blank lines to separate parts of a routine. Use blank lines between the routine header, its data and named-constant declarations (if any), and its body.

Use standard indentation for routine arguments. The options with routine-header layout are about ...

Get Code Complete, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.