Constructing Routines by Using the PPP

This section describes the activities involved in constructing a routine, namely these:

  • Design the routine.

  • Code the routine.

  • Check the code.

  • Clean up loose ends.

  • Repeat as needed.

Design the Routine

Once you've identified a class's routines, the first step in constructing any of the class's more complicated routines is to design it. Suppose that you want to write a routine to output an error message depending on an error code, and suppose that you call the routine ReportErrorMessage(). Here's an informal spec for ReportErrorMessage():


For details on other aspects of design, see Chapter 5 through Chapter 8.

ReportErrorMessage() takes an error code as an input argument and outputs an error message corresponding ...

Get Code Complete, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.