Clean Architecture

About me

  • Lucas
  • From Brazil
  • 31 years old
  • Software Engineer
  • Uncle Bob Fan

A very sad story

  • Most of the business rules inside the database
  • Total of zero unit tests (or integration tests)
  • Every "layer" deeply coupled
  • Front end attached to angular js

Resulting

Two kinds of value

Behavioural x Structure

"The goal of software architecture is to minimize the human resources required to build and maintain the required system"

SOLID

  • SRP
  • OCP
  • LSP
  • ISP
  • DIP

SRP

Single Responsibility Principle 

"A class should have only one reason to change."

DIP

Dependency Inversion Principle

VS

Clean Architecture

Entities

  • The most important part of the software
  • Business rules that  would exist even without the application
  • The things that remains true no matter what is happening
  • The highest level rules

Use Cases

  • Orchestrate the flow of data
  • An action performed by a client
  • Rules for the application being executed

Port / Adapters

  • Everything note directly related to business rules
  • Frameworks and Drivers
    • Data base
    • User interface
    • Http Client
    • Controllers 

Some benefits

  • Testability
  • Easier to reason about
  • Decoupling
  • Protecting the most important thing (business rules)

Last thoughts

  • Keep options open
  • Technology changes real fast
  • Make things as simple as possible
  • Code for other people

Thanks!

Clean Architecture

By Lucas Rodrigues

Clean Architecture

  • 279