Flexible Software Design Trumps Rigid Domain Models

2025-09-08

This article challenges the popular software design principle of tightly binding code to the domain model. The author argues that over-emphasizing the avoidance of invalid states, such as through strict database schemas and type constraints, limits software flexibility and makes it difficult to handle inevitable real-world exceptions. Using state machines and foreign key constraints as examples, the author demonstrates how to allow arbitrary state transitions while keeping the core design simple, thus improving software adaptability and maintainability. Ultimately, the author advocates for allowing the representation of some invalid states in user-facing software to cope with evolving requirements and unforeseen circumstances.

Development domain model