Clean Architecture

What is not architecture

  • Libraries

  • Frameworks

  • MVC

  • Tools . . .

Bad vs Clean

  • Complex

  • Incoherent

  • Rigid

  • Untestable

  • Unmaintainable

  • Simple

  • Understandable

  • Flexible

  • Testable

  • Maintainable

What is Clean Architecture

Clean architecture is a software design philosophy that separates the elements of a design into ring levels.

"Good architecture screams their intended usage."

"Architecture that is designed for the inhabitants of the architecture, not for the architect or the machine."

Focus on essential

Minimize cost

Maximize value

Essential

Detail

  • Space definition
  • Color
  • Domain / Entities
  • User cases
  • Presentation
  • Persistence

Layers

  • Levels of abstraction

  • Single-responsibility

  • Insolate roles and skills

  • Multiple Implementations

  • Varying rates of change

Pros vs Cons

  • Focus on Domain/Entities
  • Less coupling
  • Allows Domain Driven Design 
  • Business - user cases
  • Easy to understand
  • The change is difficult.
  • Require extra effort. 
  • Initial higher cost.

Exercise

User case

  • Customer
  • Items
  • Shipping
  • Membership

Customer

Membership Interface

Boom

Linio plus

Cart

Shipping

SOLID

Dependency inversion

More information

  • https://blog.cleancoder.com/

  • "Clean Architecture: Patterns, Practices, and Principles" by Matthew Renze on pluralsight

Made with Slides.com