Split the Code into Sections with Goals

The first step to understanding the code is to split it into sections and identify the goals of each section.

A section is a snippet of code that accomplishes a specific task. No specific number of lines constitute a section; it depends entirely on the code. A section can be one statement or function call, or it can be a loop with 30 lines of code in it. We can loosely define a section to be any sequence of program statements that accomplishes enough that you should take the time to define goals for it.

The “goal” of a section of code is the set of changes that the code is intended to make to the data structures used by the program. If a section is an entire function, the name of the function usually provides ...

Get Find the Bug A Book of Incorrect Programs 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.