Graduate Program KB

Clean Architecture

Chapter 4 - Structured programming

Proof

  • Discovered uses of goto statements prevented modules from decomposing into smaller units
  • However, structures such as if-else and loops could be recursively divided into provable units
  • Proven that all programs can be constructed by three structures:
    • Sequence, proved through simple enumeration
    • Selection, proved through enumerating each path
    • Iteration, proved through induction

A harmful proclamation

  • Dijkstra pushed structural programming to the world, similar to how developers should assert the importance of good code
  • As a result, most modern langauges don't implement a goto statement, removing the option of undisciplined direct transfer of control

Functional decomposition

  • Structured programming allows modules to be recursively decomposed into units
  • Can create high-level and low-level modules, which means large systems can be broken down into small components

Tests

  • Dijkstra says "Testing shows the presence, not the absence, of bugs"
    • A program can be proven incorrect by a test, but not proven correct
    • Tests allow us to deem a program to be correct enough for our purposes