Tino APCS

Structured Programming

In the early days of programming (1960's), the approach to writing software was relatively primitive and ineffective. Much of the code was written with goto statements that transferred program control to another line in the code. Tracing this type of code was an exercise in jumping from one spot to another, leaving behind a trail of lines similar to spaghetti. The term "spaghetti code" comes from trying to trace code linked together with goto statements. The complexity this added to code led to the development of structured programming.

The research of Bohm and Jacopini has led to the rules of structured programming. Here are five tenets of structured programming.

  1. No goto statements are to be used in writing code.
  2. All programs can be written in terms of three control structures: sequence, selection, and iteration.
  3. Each control structure has one entrance point and one exit point. We will sometimes allow for multiple exit points from a control structure using the break statement.
  4. Control structures may be stacked (sequenced) one after the other.
  5. Control structures may be nested inside other control structures.

The control structures of Java encourage structured programming. Staying within the guidelines of structured programming has led to great productivity gains in the field of software engineering.

Last modified: December 12, 2022

Dark Mode

Outline