Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 2 KB

README.MD

File metadata and controls

41 lines (30 loc) · 2 KB

Clean Architecture example

GitHub Workflow Status

An example web app structured with a Clean Architecture, implemented using Spring Boot and Kotlin.

Robert C Martin - Clean Architecture Robert C Martin - Clean Architecture Typical implementation

Following the control flow, we have an HTTP Request that reaches the Controller. The controller will then:

  • Dismantle the Request;
  • Create a Request Model with the relevant data;
  • Execute a method in the Interactor (which was injected into the Controller using the Interactor’s interface, the Boundary), passing it the Request Model;
  • The Interactor:
    • Uses the Entity Gateway Implementation (which was injected into the Interactor using the Entity Gateway Interface) to find the relevant Entities;
    • Orchestrates interactions between Entities;
    • Creates a Response Model with the data result of the Operation;
    • Populates the Presenter (which was injected into the Interactor) giving it the Response Model;
    • Returns the Presenter to the Controller;
  • Uses the Presenter to generate a ViewModel;
  • Binds the ViewModel to the View;
  • Returns the View to the client.

Clean Architecture Control Flow

Clean Architecture push us to separate stable business rules (higher-level abstractions) from volatile technical details (lower-level details), defining clear boundaries.

The main building block is the Dependency Rule : source code dependencies must point only inward, toward higher-level policies.

It should have the following characteristics:

  • Testable
  • Independent of frameworks
  • Independent of the UI
  • Independent of the database
  • Independent of any external agency