What does Clean Architecture represent?
Clean Architecture is an approach to designing software systems, proposed by Robert Martin (Uncle Bob), where the code is built in concentric layers separated by responsibility. The main idea is to isolate business logic from infrastructure so the system is easy to test, change, and independent of frameworks.
Core principle
Dependencies point inward - meaning outer code knows about inner code, but not the other way around. Business rules know nothing about the database, UI, or network details.
Layers of Clean Architecture
- Entities
- business models and rules that depend on nothing.
Example:
Order,Payment,Userwith methodsvalidate(),calculateTotal().
- Use Cases / Interactors
- implement application business logic, defining what to do with entities.
Example:
CreateOrder,ProcessPayment.
- Interface Adapters
- the layer that adapts data between internal use cases and the outside world (UI, API, DB). Example: controllers, presenters, repositories.
- Frameworks & Drivers (outer ring)
- specific technologies: frameworks, databases, web servers, UI. Example: Django, Spring, PostgreSQL, REST API.
Advantages
- Independence from frameworks and databases.
- Easy infrastructure replacement (e.g., SQL → NoSQL).
- Easy testing of business logic without external dependencies.
- High modularity and control over dependencies.
Diagram
[ Frameworks/UI ]
↓
[ Interface Adapters ]
↓
[ Use Cases ]
↓
[ Entities ]Summary:
Clean Architecture splits code into independent layers with dependencies pointing toward business logic. This makes the system resilient to technology changes and lets it evolve for decades without rewriting the core.
Short Answer
Interview readyA concise answer to help you respond confidently on this topic during an interview.