DEV Community

Cover image for Every Layer Must Earn Its Place
LkSvn
LkSvn

Posted on

Every Layer Must Earn Its Place

While starting a practical transition into C# and ASP.NET Core, I found that a
simple endpoint was becoming harder to understand as each concept introduced a
new structural element: endpoint, service, repository, interface, DTO, and
result type.

Each tool can solve a real problem. The problem is adopting the complete stack
before those problems exist.

My working rule is now incremental:

  1. Start with the smallest endpoint that expresses the behavior.
  2. Extract application behavior when HTTP and business rules begin changing for different reasons.
  3. Add a persistence boundary when it protects the application from meaningful storage concerns or supports valuable test isolation.
  4. Add interfaces when multiple implementations or a genuine boundary exists.

This is not anti-architecture. It is architecture proportional to the system.
A modular monolith with clear responsibilities can be safer than a deeply
layered or distributed design whose abstractions mostly forward calls.

Top comments (0)