Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between the clean and the n-tier architectures?

What is the difference between the clean and the n-tier architectures?

like image 351
inf3rno Avatar asked Mar 03 '14 03:03

inf3rno


People also ask

What is difference between Tier and N-tier architecture?

The second tier is responsible for providing the availability, scalability, and performance characteristics for the organization's web environment. In an n -tier architecture, application objects are distributed across multiple logical tiers, typically three or four.

What is the difference between N-tier architecture and MVC architecture?

MVC abstracts away the details of how the architecture of an app is implemented. N-tier just refers to the physical structure of an implementation. These two are sometimes confused because an MVC design is often implemented using an N-tier architecture.

What is an N-Tier architectural style?

An N-tier architecture divides an application into logical layers and physical tiers. Layers are a way to separate responsibilities and manage dependencies. Each layer has a specific responsibility. A higher layer can use services in a lower layer, but not the other way around.

What is the difference between onion architecture and clean architecture?

Clean ArchitectureIt builds on the concepts of Onion Architecture but with somewhat different details of the layers. Instead of “Domain Model”, it refers to the core as “Entities”, but still representing enterprise-wide business rules.


1 Answers

Both architecture styles apply layers to separate concerns, however they do that in a different way.

  • The n-tier architecture is about communicating with the database through layers of business logic and representation. It is tightly coupled to the externals (3rd party frameworks/drivers) you want to use, for example to an HTTP Server, an ORM or an SQL driver...

  • The clean architecture is about implementing use cases and build layers of adapters and externals (3rd party frameworks/drivers) around them. It is loosely coupled to the externals you want to use because of the layer of the adapters. Be aware that by the clean architecture the representation and the database layers would be both included by the externals. So the clean architecture is more about creating an application and separate it from the externals it uses to communicate with its environment. In this scenario it is much easier to test, develop and maintain the code of the application. You don't have to write integration tests or mock out the ORM to test the business logic. You don't have to concern about the externals by implementing the business logic, you can focus on the application itself. You don't have to modify the business logic to replace any external framework/driver, it's enough to write a new adapter to accomplish that.

So I think the clean architecture is a better choice.

like image 189
inf3rno Avatar answered Sep 21 '22 00:09

inf3rno