Skip to main content

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

  1. Entities
  • business models and rules that depend on nothing. Example: Order, Payment, User with methods validate(), calculateTotal().
  1. Use Cases / Interactors
  • implement application business logic, defining what to do with entities. Example: CreateOrder, ProcessPayment.
  1. Interface Adapters
  • the layer that adapts data between internal use cases and the outside world (UI, API, DB). Example: controllers, presenters, repositories.
  1. 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

javascript
[ 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 ready
Premium

A concise answer to help you respond confidently on this topic during an interview.