DEV Community

Cover image for Clean Architecture Evolution
Caio Cesar
Caio Cesar

Posted on

Clean Architecture Evolution

Introduction

Architecture evolution is the mechanism of adjusting current software architecture to match new requirements. To help you understand how you might improve a solution that applies clean architecture, lets review some basic principles.

1.Dependency Inversion Principle

Flexible systems should have source code dependencies on abstractions and not concretions, see:

Dependency inversion principle

2.Component Principles

Components are the minimal units the can be deployed in a system.
Independently deployable components are usually well designed and could be independently developed.

Image description

3.Component Cohesion

Defining the classes that goes into components is a crucial decision see:
Image description

To tackle this issue we will consider three principles of components cohesion:

  1. The Reuse/Release Equivalence Principle - Those who want to reuse software components will choose not to, unless those components are tracked through a release process and are given release numbers. Developers should be aware of new releases, and what changes these new releases will bring.
  2. The Common Closure Principle - A component should not have multiple reasons to change.
  3. The Common Reuse Principle - Classes that are not tightly bound to each other should not be in the same component.

Clean Architecture

Clean architecture keeps the business logic and application model at the center of the application. To achieve this the infrastructure concerns depend on the domain of the application, see:

Image description

The main advantages of implementing clean architecture is that it allows applications to be loosely coupled. That gives developers the power to update infrastructure like frameworks and databases. It also allows for highly testable application.

Applied Principles to Clean Architecture

To implement and evolve a project that applies clean architecture, it is wise to understand the SOLID Principles, Component Principles and other knowledge available in uncle bobs clean architecture book. Lets go over a two of these principles:

Dependency inversion principle

when one applies the dependency inversion principle it enables infrastructure to be injected through at compile time and database can be included with more ease, see:

Image description

Reuse/Release Equivalence Principle

Applying the Reuse/Release Equivalence Principle in your infrastructure layer may allow developers to evolve each component independently from each other, see:

Image description

Conclusion

Implementing an architecture project requires knowledge to understand a specific pattern and applied it. Developers might face gaps when deciding when and why it would be necessary to create new components.

To successfully maintain and evolve the software projects, learning software design principles are a good starting point that developers should take into account.

For a more complete explanation of this post, with more details and diagrams checkout this youtube presentation.

References

  1. Martin, Robert C. Clean Architecture: A Craftsman's Guide to Software Structure and Design
  2. Steve Smith Architecting Modern Web Applications with ASP.NET Core and Microsoft Azure
  3. Clean Architecture | Theory and Concepts.

Top comments (0)