Skip to content

Commit

Permalink
add note about the law of implicit interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
zakirullin committed Sep 28, 2024
1 parent 8487d61 commit 2722eed
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ This architecture was something that made intuitive sense at first, but every ti

> Do not add layers of abstractions for the sake of an architecture. Add them whenever you need an extension point that is justified for practical reasons. **[Layers of abstraction aren't free of charge](https://blog.jooq.org/why-you-should-not-implement-layered-architecture), they are to be held in our working memory**.
If you think that such architectures allow you to quickly swap out different databases or whatever other dependencies you have, you haven't touched the reality. Even upgrading the same database management system to a few major versions causes lots of issues, and believe us, having the right abstractions for the data access layer is the least of your worries. At best, abstractions can save somewhat 10% of your time (if any), the real pain is in [implicit interfaces](https://www.hyrumslaw.com/). So, why pay the price of high cognitive load for such abstractions, if it doesn't pay off in the future? Plus, in most cases that future of replacing some core component never happens.

Even though these layered architectures have accelerated an important shift from traditional database-centric applications to a somewhat infrastructure-independent approach, where the core business logic is independent of anything external, the idea is by no means novel.

These architectures are not fundamental, they are just subjective, biased consequences of more fundamental principles. Why rely on those subjective interpretations? Follow the fundamental rules instead: dependency inversion principle, cognitive load and information hiding.
Expand Down

0 comments on commit 2722eed

Please sign in to comment.