Key Points

  • Data initialization is prone to errors, so use the initialization techniques described in this chapter to avoid the problems caused by unexpected initial values.

  • Minimize the scope of each variable. Keep references to a variable close together. Keep it local to a routine or class. Avoid global data.

  • Keep statements that work with the same variables as close together as possible.

  • Early binding tends to limit flexibility but minimize complexity. Late binding tends to increase flexibility but at the price of increased complexity.

  • Use each variable for one and only one purpose.

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.