Your Ports Are Lying About Your Business
Your hexagonal architecture ports might still be speaking HTTP instead of business. In hexagonal architecture, ports exist to isolate your business logic from how it's delivered. In practice, most of them are still named after HTTP operations like createUser or updateUser — a habit inherited from years of REST-first development. That mismatch isn't cosmetic. It turns your tests into database…
Hexagonal architecture ports might still be misrepresenting the actual business processes they are meant to encapsulate. In this architectural style, ports are designed to separate the core business logic from the delivery mechanisms. However, in practice, many of these ports are still named after HTTP operations such as 'createUser' or 'updateUser'. This naming convention, inherited from REST-first development practices, can be misleading.
The discrepancy between the port names and the actual business logic has significant implications. It transforms tests into checks against the database rather than real business specifications. Moreover, this convention can be inadvertently adopted by AI coding agents, leading to the repetition of the same patterns across the codebase, as long as the repository remains active.
I have previously discussed the reasons behind this issue and provided guidance on how to name these ports in a way that a domain expert can easily understand their purpose.
One of the most contentious aspects of this discussion is the case of single adapters. If there is only one adapter in the future, is it still necessary to keep the port interface? This question invites readers to ponder the value of maintaining such interfaces in simpler scenarios.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.