A Repository Out of Place
Easy About 10 min Katabench Pro
A concrete *Repository has settled into the core, right next to the port it implements. Move the role to the layer where it belongs; renaming it to dodge the placement rule trips the naming rule instead.
The full brief is part of Katabench Pro
Pro opens this kata's brief, its starter code and its grader. To see how the track works first, try Config Is Infrastructure, which is free.
How it is graded
You work across multiple files, and architecture rules turn the design boundaries into executable feedback.
What it practices
- Infrastructure as adapters
- Keep the ORM, clocks, caches, configuration and startup work out of the core as replaceable adapters.
- Ports and adapters
- Driving and driven adapters meet the application only through its ports.
Related katas
- Config Is Infrastructure Medium Free The shipping core reads a framework configuration type directly, welding the domain to infrastructure. Invert it behind a core-owned options port, and don't just rename the framework wrapper into the core, which trips a second rule.
- Move the Port Home Medium Free A
*Portabstraction is declared beside its adapter, so the core reaches outward to see its own port. Move the single port into the core; duplicating it leaves a stray copy that fails the role-placement rule. - Two Sides of the Hexagon Medium Free A driving (web) adapter reaches the driven (persistence) adapter directly for a quick existence check. Inject the repository "via its interface" and you'll find the seam is still on the wrong side of the hexagon.
- Keep HTTP at the Edge Easy Pro The returns application accepts a web request type directly, so transport points inward and the controller has no real use-case boundary. Map HTTP at the edge and drive an application-owned port.