Intermediate Topic 32 of 50 Software Engineering
Clean Architecture
Dependency rules keeping business logic independent of frameworks.
How it works
Clean architecture, popularized by Robert Martin, arranges code in concentric circles with entities and business rules at the center, surrounded by use cases, interface adapters and frameworks and drivers at the outside. The dependency rule says source dependencies point only inward, so the core knows nothing about databases, web frameworks or user interfaces. Related ideas include hexagonal architecture and ports and adapters.
Step-by-step walkthrough
- Entities hold enterprise rules at the center.
- Use cases orchestrate application logic.
- Adapters convert data for the outside.
- Frameworks and databases sit on the outside.
- Dependencies point inward only, so business logic is independent of tools.
Where it is used
Long-lived business applications where frameworks, databases and delivery mechanisms may change use clean architecture, as it keeps domain logic testable without external infrastructure.
Common pitfall
It introduces many interfaces, mappers and layers, which can be overkill for small or CRUD-style applications. Teams may mimic the folder structure without respecting the dependency rule. Data mapping between layers costs effort. Apply it where domain complexity justifies it, and keep the boundary interfaces defined by the core, not the outside.
Where it fits in the course
Clean Architecture is topic 32 of 50 in Software Engineering, rated Intermediate. It follows Layered Architecture. The next topic is Domain-Driven Design.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Software Engineering quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Software Engineering quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Clean Architecture?
Where do people use Clean Architecture?
What is the most common mistake with Clean Architecture?
What should I learn before this topic?
How can I practice it?
Is Clean Architecture hard to learn?
How long does it take to learn Clean Architecture?
Which topics are related to Clean Architecture?
What should I study after Clean Architecture?
Related topics
- Layered Architecture (Software Engineering)
- Domain-Driven Design (Software Engineering)
- Code Smells (Software Engineering)
- Microservices (Software Engineering)
- Von Neumann Architecture (Computer Architecture & Logic)
- Instruction Set Architecture (Computer Architecture & Logic)
- IoT Architecture (Mobile, Embedded & IoT)