An Android app designed using Clean Architecture and MVP.
This is an Android app designed for learning Clean Architecture and MVP patterns.
The code is divided in 3 layers, Data, Domain and Presentation. The Domain is structured following the main premises of Clean Architecture. The app follows the dependency inversion principle using the protocol oriented approach that Java has on its foundations. The app has unit test for each layer.
On this layer belongs all the classes which main concern is handling the business logic of the app. Here you will see all the interactors (user cases) implementations as well.
On this group you will find the enterprise business rules to be consumed by the app. Encapsulates the most general and high-level rules. They are the least likely to change when something external changes.
This is a set of adapters that convert data from the format most convenient for the use cases and entities, to the format most convenient for some external agency. Presenters and Controllers belong here.
The code in this layer contains application specific business rules. Each use case is represented by a protocol, the internal implementation is separated from the interface. Having a protocol per Use Case enforces the Single Responsibility Principle, facilitates unit testing and improves traceability. The objects on this group relies on the entities and the services via interfaces (to preserve dependency inversion principle) and returns the data using DTOs to avoid exposing the entity layer and to model the data in a convenient way to be consumed by the App.
The objects in this layer have the responsibilities described in the MVP architectural pattern. The Presenter relies on the UseCases to get the data and model in a convenient way to be shown in the UI.
This layer retrieves all data that is needed in the app through a UserRepository implementation. With this implementation the data origin is transparent for the client.
©2017 Globant.