Clean Architecture

Terminology

Principles

The Dependency Rule

  • Dependencies can only point inwards. Nothing in an inner circle can know about, or mention the name of, something in an outer circle.
  • As you move inwards, the software becomes more abstract.

Entities

  • Entities encapsulate enterprise-wide business rules.
  • They are the least likely to change when something external changes.

Use Cases

  • Represent application-specific business rules.
  • Orchestrate the flow of data and direct the entities to use enterprise-wide business rules to achieve the goals of the use case.

Interface Adapters

  • Convert data from external formats to internal formats used by use cases and entities
  • MVC, etc: Controllers, presenters and views are in this layer. Controllers convert data to models for use cases, and presenters and views receive models from use cases to then be presented in whatever way they see fit.

Frameworks and Drivers

  • database
  • web framework (html)
  • not much code here, other than glue