New Is Glue
Easy About 15 min Katabench Pro
The port exists, the adapter implements it, and the core news the concrete anyway. One new in the wrong place welds the core to infrastructure; hand the wiring to the composition root.
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
- Dependency injection
- Ask for collaborators through constructors instead of newing them up or locating them.
- Dependency inversion
- Point dependencies at abstractions the core owns, never at outer mechanisms.
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. - The Layer Skip Medium Free A controller reaches past the application layer straight into infrastructure for the order total. Route the call back through the middle layer with a port the application owns; a thin pass-through that still touches infrastructure only moves the smell, it doesn't remove it.
- Fakes Don't Ship Easy Pro A test stub lives in the core and the checkout quietly falls back to it when nobody injects a gateway. Evict the stub to the testing namespace and make the dependency mandatory; a convenient default is a production code path.