Accidental complexity is complexity added by implementation choices, tools, abstractions, or code rather than by the problem domain itself. Tricky code and unjustified solutions increase it; good design keeps it low without eliminating useful abstractions. section 1.3
Control accidental complexity by weighing design choices against their costs:
- Prefer solutions that expose domain behavior instead of unrelated implementation details. section 1.3
- Avoid both under-abstraction, which increases coupling, and overdesign, which adds unnecessary machinery. section 1.3
- Use interfaces, modularity, low coupling, high cohesion, and suitable type systems to make design decisions more conscious. section 1.6
A safer domain model
A unit mismatch caused a program to return pound-seconds where newton-seconds were required. Domain-oriented abstractions and static types can reduce the implementation detail developers must reason about and make invalid operations harder to express. section 5.1
Figure 1.6 Accidental and essential complexity of two solutions
Compare two imagined solutions and see how their technologies contribute differently to essential and accidental complexity. section 1.3
