Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Layered Architecture with DI vs onion architecture?

Could anyone please explain the difference between onion architecture and Layered architecture using dependency inversion? They look exaclty the same to me. Any input is greatly appreciated :)

like image 404
mike john Avatar asked Oct 02 '22 06:10

mike john


1 Answers

I've always thought of it exactly that way: N-tier architecture meets DI--with a couple of constraints.

The most important thing is that code in inner layers is not coupled to code in outer layers (controlled direction of coupling). I also constrain myself layers can only communicate with the layer immediately beneath them (controlled depth of coupling). To my knowledge, no one else is advocating that particular constraint, and Palermo specifically rejects it.

like image 109
Chris McKenzie Avatar answered Oct 07 '22 17:10

Chris McKenzie