Mobility Finder is a sample app which uses some of the latest state-of-the-art features in the Android ecosystem
Clone this repository and import into Android Studio
> git clone git@github.com:pablodeafsapps/mobility-finder.git
> git clone https://github.com/pablodeafsapps/mobility-finder.git
To address this sample app development, a class hierarchy based on the Clean Architecture paradigm is used (credits to Robert C. Martin - Uncle Bob).
Among the different implementations for Android applications of the aforementioned paradigm, there are remarkable contributions such as the ones from Antonio Leiva and Fernando Cejas. Precisely, this latter work has served as the main inspiration for this application architecture.
Therefore, the prior idea in this project is concern-layers separation. Each of this entities is in charge of certain responsibilities, which are handled in isolation. These layers get interconnected thanks to interfaces, which allow to achieve the necessary abstraction between them.
-
Presentation This layer's duties consist of managing the events caused by the user interactions, and rendering the information coming from the domain layer. In this particular case, a Model-View-ViewModel (MVVM) architecture pattern has been selected. This entity "sees" the domain layer.
-
Domain This layer is in charge of the application business logic. It is built upon use-cases and repositories repository pattern). The domain layer obtains data from the data module and use them to perform all the required operations. It also is in charge of formatting the outcomes to later deliver them to the presentation layer. This entity only contains Kotlin code, and thus testing should only consist of Unit Tests. This layer represents the most inner entity, and thus it does not "see" anyone but itself.
-
Data This layer simply contains libraries and frameworks which provide data to the application (data sources). Among them, stands out service-query frameworks (Retrofit), local databases (Room), events tracking (Omniture), etc. This layer "sees" the domain layer.
The usage of this class hierarchy and package organization pursues grasping SOLID principles, enhancing versatility and easing code testing.
In order to facilitate the interaction between the above described layers, Mobility Finder uses a dependency injection scheme. Dagger is a framework which allows to abstract type injection in a neat and clear manner.
This is a multi-module Android project, and thus Dagger makes use of Subcomponents.
Since multithreading has historically been a challenge in Android Development, coroutines have been included. This is one of the most interesting and appealing features recently introduced in Kotlin.
Using coroutines facilitates and enhances multithreading management. Coroutines allow to turn asynchronous operations into synchronous code, without affecting the application overall performance.
From the execution-flow perspective, every task is undertaken in the main thread (UI thread), until a use-case is invoked. From that moment onwards, operations are handled in worker threads, to later retrieve the computed results in the main thread again.
This project is mantained by:
If you happen to find any issue or suggestion, feel free to start a new thread on the Issues section of the repository. I will try to address it as soon as possible.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -m 'Add some feature')
- Push your branch (git push origin my-new-feature)
- Create a new Pull Request