clean architecture in 3 minutes.mp4
Clean Architecture Notes
Chapter 1: Application Models
Clean architecture involves breaking applications into logical pieces.
Models are the primary components that interact across the entire application.
Models represent database entries, requests, or responses.
Flow of Requests:
Requests come in via API, socket listener, or user interface.
The application processes the request, which contains all business logic.
Business logic is organized into features or use cases.
Chapter 2: A Larger Action
Actions correspond to user interactions (e.g., register, sign in, add to cart).
Each action contains specific business logic that resides in the application layer.
Larger actions may invoke smaller actions, forming a hierarchy of functionality.
The application layer is unaware of database interactions or external services:
This decoupling is facilitated through defined interfaces.
An interface specifies required methods (e.g., 'send message' for email services).
Interfaces allow for swapping services without altering business logic, enhancing flexibility.
Chapter 3: It Doesn’t Need
Business logic should not reside in the repository or web API logic.
Layers of the architecture are functionally separated:
Repositories only handle data retrieval and storage.
Business logic processes requests and responses along a defined path.
Clean architecture advocates for separation of concerns for improved maintainability.