-
Notifications
You must be signed in to change notification settings - Fork 1
Home
I'm going to use Clean Architecture for the whole project as I really like the way you build and APP around it. Fernando Cejas has a lot of content speaking about it. I have picked some ideas from this post Architecting Android...Reloaded as I find it quite interesting.
As a brief explanation, I will use a couple of patterns to supply needs in each layer. I will use MVP (model-view-presenter) in the Presentation layer to avoid dependencies between views and domain objects (as we want to have a clear boundary between both layers).
For the Domain layer, I'm going to use Interactors (use cases) to connect Presentation layer with the Domain layer, those classes will use a functional approach to receive responses from Data layer.
And for the Data layer, I have picked the Repository pattern because in this example I'm going to need information from "network" (knowing that those calls are going to be faked) and DB (I will use SharedPreferences to store session-token) so I will be able to make this process transparent and also to connect this layer with the Domain one by making use of UseCases (using functional programming to manage data responses and avoid error management in this layer, as I will encapsulate responses in functional objects).
Clean architecture image example (showing boundaries between layers):
For the structure of the project, I have decided to have everything behind app package, as moving everything to separate packages (simulating each layer) is an unnecessary complication for the current state of the project. About each module, I will put logic per feature so everything related to the login will be in the login package, everything related to authentication in the authentication package etc
The base package will contain essentials for the Architecture of the project (like dependency injection, mvp interfaces etc)
Example of the final project struture:

