Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Hexagonal Architecture (Ports & Adapters): Isolating the Application from the Outside World
Hexagonal Architecture (Cockburn, 2005) keeps the application equally distant from UI, tests, batch scripts and the database: the outside world talks through purpose-based ports, and each technology plugs in through an adapter. In Bookstore we drive the IPlaceOrder driving port from a Minimal API, a console CSV import and an xUnit test, and back the IOrderStore driven port with EF Core and in-memory adapters; plus ASP.NET Core's IServer and common misreadings of the hexagon.
Inverting Dependencies: Where Layered Architecture Gets Stuck
In a layered architecture compile-time dependencies flow downward, so business rules get locked to EF Core, SQLite and external APIs; the fix is to keep the runtime call direction but move the interfaces into the domain project that uses them, turning the reference arrow inward. Shown with Bookstore's "test without a database" and "switch carriers" scenarios, the "I added an interface, done" fallacy, and the idea shared by Hexagonal, Onion and Clean.