Introducing Android Architecture
If you would like to view the related sample codes, you can refer to link below:
https://github.com/ZahraHeydari/ArtGallery
2. What is
Clean
Architecture
?
Clean Architecture combines a
group of practices that produces
systems with the following
characteristics:
❏ Testable
❏ UI-Independent
❏ Independent of databases,
frameworks, libraries
3. Why should I use Clean Architecture?
Architectures allow
decoupling different units of
your code in an organized
manner. That way the code
gets easier to understand,
modify and test.
Clean Architecture may be
complicated - but it`s worth it!
4. The main and most complicated topic in
Clean Architecture:
➔ The Dependency Inversion (SOLID)
- High-level modules should not depend on low-level modules.
Both should depend on abstractions.
- Abstractions should not depend on details. Details should
depend on abstractions.
5.
6. UI
UI calls method from
Presenter/Controller.
Presenters
Presenters execute
Use case.
Use Cases
Use case combines
data from Repositories.
Repository
Each repository
returns data from a
data source (Cache or
Remote.
Entities
These describe the
basic data structures
we work it!
8. The layers
Presentation
This module includes
ViewModels and the UI
(Activities & Fragments)
All dependencies from DI
can be connectable in this
module.
Presentation Layer
depends on Domain Layer.
Domain
The most INNER part of
the layers (no
dependencies with other
layers) and it contains
Entities, Use cases &
Repository Interfaces.
Data
This layer contains
Repository
Implementations and 1 or
multiple Data Sources.
Repositories are
responsible to coordinate
data from the different
Data Sources. Data Layer
depends on Domain Layer.
9. Conclusion
The features of Clean
Architecture:
● Dependency Rule
● Abstraction
● Communication between
layers
Notice!
Deep understanding of the
dependency inversion principle
and how it works then link the
layers properly.
10. Thank you!
Hope you`ll use these
presentation to find out
about Clean Architecture
and use it to implement
the structure of your
projects!
By Zahra Heydari