Clean and Hexagonal Architecture-SHARE
Clean and Hexagonal Architecture-SHARE
Use Dependency Inversion and Polymorphism to create a dependency rule to make the
domain layer most independent and stable layer
Source code dependencies can only point inward, towards to domain layer
Same high level principle with hexagonal and onion architectures: Isolate the domain
Hexagonal Architecture
Divides the software as insides and outsides, and start with inside, domain layer
The principle of the hexagonal architecture is to isolate the domain from any
dependency, such as UI, Data layer or even a framework like Spring
Layered Architecture
Especially useful for long-lasting applications that need to keep up with changing Presentation
requirements Layer
Improvement to traditional Layered Architecture. The dependencies are now Business Layer
plugins to the business logic. All dependency arrows point to business logic
making the domain independent. Reverses the relation using ports and adapters. Data Layer
Delay the implementation details of dependencies
Easier to test the business logic by mocking the dependencies even before
Clean Architecture
deciding the implementation details
Easier to maintain as changing a part of software will not affect other parts
“By separating the software into layers and conforming to the Dependency Rule,
you will create a system that is intrinsically testable, with all the benefits that implies.
When any of the external parts of the system become obsolete, such as the database,
or the web framework, you can replace those obsolete elements with a minimum of fuss”
“A shopping cart application with a good architecture will look like a shopping cart application.
The use cases of that system will be plainly visible within the structure of that system.
Developers will not have to hunt for behaviors, because those behaviors will be
first-class elements visible at the top level of the system”
“High-level modules should not depend on low-level modules. Both should depend on abstractions”
“The way you keep software soft is to leave as many options open as possible,
for as long as possible. What are the options that we need to leave open?
They are the details that don’t matter.
The details are those things that are necessary to enable humans, other systems, and programmers to communicate with the policy,
but that do not impact the behaviour of the policy at all. They include IO devices, databases, web systems, servers, frameworks,
communication protocols, and so forth”