Topic 10 · Notes

Principles of programming

These notes are part of a subscription

6 sections covering the whole specification for this topic, with worked examples.

Preview

Why principles matter

A program that works isn't necessarily a good program. Real programs are read, fixed and changed for years, often by people who didn't write them.

The spec lists four principles of good programming:

PrincipleThe question it asks
ReadabilityCan someone else understand the code quickly?
ExtensibilityCan new features be added easily?
MaintainabilityCan the code be fixed, updated and tested easily?
ModularityIs the program split into self-contained parts (subroutines)?

They support each other: modular code is easier to read; readable code is easier to maintain; well-structured code is easier to extend.

Also in these notes

  • Readability
  • Maintainability
  • Extensibility
  • Modularity
  • Improving code