One Domain, Three Dialects
A teaching repo that implements one airline-charter domain three ways on purpose - CRUD, CRUD-plus-rich, and Clean Architecture - and persists it three ways to match. Part 1 of a source-reading series.
In reading order.
A teaching repo that implements one airline-charter domain three ways on purpose - CRUD, CRUD-plus-rich, and Clean Architecture - and persists it three ways to match. Part 1 of a source-reading series.
Testing a README's three-tier architecture claim against the source, and finding that the module nobody mentions holds the only real aggregate in the estate.
An offer draft and a published offer are not one entity with a status flag - they are two classes, and the transition is a method that returns the second one. What that buys, and what it silently drops.
Postsale's aggregate has ten private fields and exactly one public member. Reservation, in the same estate, has eighteen. Following that difference all the way down to the database.
Two test files, one estate, one deliberate contrast - and the answer to the question a fully encapsulated aggregate forces on you. Six test methods in 14,559 lines, by design.
Sales stores four aggregate roots and twenty-five value objects in three tables, by serialising whole aggregates into jsonb - and the reflection resolver that makes reconstitution work bypasses every invariant on the way in.
What the document strategy really costs - a promoted column, a side table, an in-memory dictionary with a TODO on it, and six update methods that look the row up without its id.
Mapping a fully encapsulated aggregate to relational tables with Property of T of a string - eight tables for one aggregate, eighteen columns, seventeen of them named after private C# fields.
Because the write model exposes nothing, the read side could not go through the aggregate - so a second POCO maps the same physical table through a second DbContext. CQRS as an outcome rather than a choice.
The third persistence strategy is the plainest one, and the only one a background poller can interrogate - plus what that poller costs when it has no watermark, no paging and no index.
A textbook Specification base class whose one clever feature has zero usages, whose combinators have none either, and whose only used method recompiles an expression tree on every call - inside loops.
What an in-process event dispatcher actually guarantees when there is no outbox, no dead letter, no correlation id and no drain on shutdown - and the one static field the whole thing depends on.
One estate showing the safe ordering five times and the unsafe one once, with the phantom-event failure traceable end to end through a webhook that never retries.
The tick that makes eventual consistency watchable in a console, the four-hop chain that takes twenty seconds because of it, and the DI-scope trap the estate is one refactor away from firing.
A decision record mandates UTC everywhere and an IClock abstraction, and thirty files honour it - then one process-global AppContext switch in shared plumbing makes every timestamp column forget it was UTC.
A four-field record that makes it impossible to register a route without stating who may call it - the best idea in the mini-framework - and the one line it did not write, which costs every 404 in the estate.
When Postsale was carved out of Sales, sixteen types came with it - and every place the twins differ marks a decision the extraction forced, including one base class that stopped draining and a repository that silently depends on it.
The retrospective - nine declared omissions that are all defensible, a set of undeclared ones that all turned out to be live bugs, and the rule that falls out of the difference.