jargon

Comparison

IndirectionvsLayered architecture

Indirection

you followed the call through four interfaces to find the one line that actually does the work.

Putting something in between two parts so they refer to each other by name rather than directly. It is the standard move for buying flexibility — you can swap either side — and it is the standard move for making a codebase unreadable, because every hop is a thing the reader has to hold. The judgement is whether the flexibility is one you will use: indirection added for a second implementation that never arrives is pure cost.

Full entry →

Layered architecture

the controller called the database directly and three people commented on the pull request.

Arranging code so that each layer may only call the one beneath it — typically interface, application, domain, infrastructure. It gives you a rule that can be checked rather than an aesthetic, which is why layering violations are one of the few design arguments a linter can settle. Layers stop paying when they become pass-through: four layers that each rename a field are ceremony, not structure.

Full entry →

Related comparisons