Embedded software is easier to maintain when modules have clear ownership, narrow interfaces, and explicit failure behaviour. I use abstract data types and composition to bring useful object-oriented design ideas into C without hiding resource use or control flow.

Principles

  • Encapsulate mutable state behind a small public API
  • Represent recoverable failures with explicit error values
  • Keep hardware access behind replaceable adapters
  • Separate policy from mechanism
  • Make initialization and shutdown states unambiguous
  • Design for unit tests before hardware is available

Why it matters

In firmware, a vague interface often becomes a hardware debugging problem later. Strong module boundaries reduce coupling and make integration failures easier to localize.