pablodeafsapps / mobility-finder

A sample application using some of the latest state-of-the-art features, including DI with Dagger 2 in a multi-module project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mobility Finder

Mobility Finder is a sample app which uses some of the latest state-of-the-art features in the Android ecosystem

Installation

Clone this repository and import into Android Studio

Clone with SSH
> git clone git@github.com:pablodeafsapps/mobility-finder.git
Clone with HTTPS
> git clone https://github.com/pablodeafsapps/mobility-finder.git

Architecture and project organization

To address this sample app development, a class hierarchy based on the Clean Architecture paradigm is used (credits to Robert C. Martin - Uncle Bob).

alt text

Class hierarchy

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.

alt text

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.

Inversion of Control

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.

Coroutines

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.

Maintainers

This project is mantained by:

Issues

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.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push your branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

A sample application using some of the latest state-of-the-art features, including DI with Dagger 2 in a multi-module project


Languages

Language:Kotlin 100.0%