Android-CleanArchitecture
前言
Blog:
We know that writing quality software is hard and complex: It is not only about satisfying requirements, also should be robust, maintainable, testable, and flexible enough to adapt to growth and change
Clean architecture
- Independent of Frameworks.
- Testable.
- Independent of UI.
- Independent of Database.
- Independent of any external agency.
Dependency Rule: source code dependencies can only point inwards and nothing in an inner circle can know anything at all about something in an outer circle.
- Entities: These are the business objects of the application. ==> Model
- Use Cases: These use cases orchestrate the flow of data to and from the entities. Are also called Interactors. ==> data=>model
- Interface Adapters: This set of adapters convert data from the format most convenient for the use cases and entities. Presenters and Controllers belong here. ==> use Case => data
- Frameworks and Drivers: This is where all the details go: UI, tools, frameworks, etc. ==>UI
Architectural approach
Domain Layer (Regular Java Objects)
Business rules here: all the logic happens in this layer. Regarding the android project, you will see all the interactors (use cases) implementations here as well.
This layer is a pure java module without any android dependencies. All the external components use interfaces when connecting to the business objects.