All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Why code flexibility should sometimes override domain model constraints in software design

By

zdw

8mo ago· 11 min readenOpinion

Summary

The article argues against the popular software design principle "make invalid states unrepresentable," which advocates tightly binding code to domain models. The author contends that code should be more flexible than the domain model, allowing for evolution and adaptation. The principle typically involves enforcing single sources of truth in database schemas and using type systems to prevent illegal states. The author presents a controversial counter-perspective that rigid domain binding can lead to brittle, hard-to-change systems, and advocates for looser coupling between code and domain representations.

Key quotes

· 3 pulled
One of the most controversial things I believe about good software design is that your code should be more flexible than your domain model.
This is in direct opposition to a lot of popular design advice, which is all about binding your code to your domain model as tightly as possible.
A popular principle for good software design is to make invalid states unrepresentable.
Snippet from the RSS feed
One of the most controversial things I believe about good software design is that your code should be more flexible than your domain model. This is in direct opposition to a lot of popular design advice, which is all about binding your code to your domain

You might also wanna read