7 ms·
This particular article seems to advocate "adapt all the things!!!" using dependency injection to configure your adapters. I'd not come across onion architectu
by projektfu 2y ago
This particular article seems to advocate "adapt all the things!!!" using dependency injection to configure your adapters.
I'd not come across onion architecture before but I'm a big fan of hexagonal architecture. The essential difference is that onion architecture wants dependency injection, adapters and a pure core, where pure just means no dependencies of any kind. Hexagonal architecture has the concept of internal and external, and advocates treating everything that is not part of the application as a consumer. In hexagonal architecture, a database may be an internal implementation detail, or it may be something external things expect to use and have a defined schema, etc. In the first case, it doesn't need special abstraction, in the second, it needs to be treated as something to adapt to. Onion architecture would say that it is a dependency and should be externalized from the start.