Basically, our project is using single activity and multiple fragments.
The clean architecture known to everyone, the purpose is dividing each layer and make them independent. I will say the clean architecture is separating modules horizontally.
Dynamic Feature were published by few yeas ago. Briefly, as the word says, it makes each feature to a module. I will say the dynamic feature is separating modules vertically.
We decided to get both advantages with an easier way and mix them together to our project. To mix them, the dynamic feature will be the main architecture and clean architecture will be inside each feature module.
There are so many strict rules in the origin clean architecture, e.g. an object on the presentation layer won't access a class from the data layer, or each layer has their own data classes, the mapper classes, ...etc.
If keeping the rules here, this project will be a hugh project and only one maintainer is me 😢. This project is still keeping the basic rules, but we need to have a compromise with those features.
- Activity/Fragment:
- ViewModel: It handles the view state and data, and the view logic. Also, it helps a view to connect a usecase. Three types of them, ViewModel, AndroidViewModel, SavedStateViewModel will be used.
The business logic will be here mostly.
- OneShot UseCase: This is one time fetching, just send a request and get a response, eg. normal restful api request.
- Observable UseCase: For the local database, once the data we are observing is changed, the observable usecases will keep receiving the changing until the observing finishes.
- Repository:
- 3 Layer Cache: We would like to have a cache system. One path is for fetching data from the remote server; another path is for the local database.
- Data Model:
MIT License
Copyright (c) 2021 Jieyi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.