What is Clean Architecture?

What is Clean Architecture?

Clean Architecture is a software design philosophy introduced by Robert C. Martin (Uncle Bob) to create maintainable, flexible, and scalable systems. It focuses on organizing code in a way that separates concerns and ensures high cohesion and low coupling between components. Here’s a summary of its key principles:

Layered Structure: Clean Architecture divides the system into layers with different responsibilities. The core idea is to isolate business logic from external concerns (UI, databases, frameworks, etc.), ensuring that the core of the application remains independent.

Independence of Frameworks: The architecture should not be tightly coupled to any specific framework. Frameworks should act as tools, not the foundation of the system.

Testability: By isolating business logic from external components, the system becomes easier to test. Each layer can be tested independently, ensuring greater coverage and reliability.

Separation of Concerns: Clean Architecture enforces the separation of different system concerns, such as user interface, business rules, and data access, making the system more maintainable and adaptable to changes.

Entities at the Core: The innermost layer contains the business entities, which are independent of the rest of the system. They represent core business rules and do not depend on outside technologies.

Use Cases: Surrounding the entities are the use cases or application layer, which define specific actions the system performs. These dictate how the system interacts with the outside world but are still independent of UI or database concerns.

Interface Adapters: This layer serves as a bridge between the core logic and the external world (like databases, APIs, or UI), converting data formats as necessary.

External Dependencies: The outermost layer includes frameworks, tools, and databases. These should depend on the inner layers, but the inner layers should not depend on them.

Clean Architecture revolves around the principle of dependency inversion, meaning that higher-level modules (business logic) should not depend on lower-level modules (UI, databases, etc.), but both should depend on abstractions (interfaces).

This structure makes the system flexible, allowing it to easily adapt to changes, swap out components (like databases or UIs), and keep the core business rules intact.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다