Skip to content

MVVM with Clean Architecture demo project used truecaller blog api

Notifications You must be signed in to change notification settings

akhilesh0707/MVVM-Clean-Architecture

Repository files navigation

Akhilesh StackOverflow Akhilesh LinkedIn

MVVM Clearn Architecture

An Android Clean Architecture app written in Kotlin, using Rxjava, Android Architecture Components and used Dagger2 for Dependency Injection.

Architecture

Uses concepts of the notorious Uncle Bob's architecture called Clean Architecture.

  • Better separation of concerns. Each module has a clear API., Feature related classes life in different modules and can't be referenced without explicit module dependency.
  • Features can be developed in parallel eg. by different teams
  • Each feature can be developed in isolation, independently from other features
  • faster compile time

Modules:

  • truecaller-ui - It uses all the components and classes releated to Android Framework. It gets the data from presentation layer and shows on UI. (access all the modules)
  • data - The data layer implements the repository interface that the domain layer defines. This layer provide a single source of truth for data. (Kotlin module that can only access domain module)
  • remote - Handles data interacting with the network. (can only access data module)
  • domain - The domain layer contains the UseCases that encapsulate a single and very specific task that can be performed. This task is part of the business logic of the application. (Kotlin module that cannot access any other module)
  • presentation - MVVM with ViewModels exposing LiveData that the UI consume. The ViewModel does not know anything about it's consumers. (Android module that can only access domain module)

Tech Stack:

  • RX Java A library for composing asynchronous and event-based programs using observable sequences for the Java VM.
  • RX Kotlin RxJava bindings for Kotlin.
  • RX Android RxJava bindings for Android.
  • ViewModel - Stores UI-related data that isn't destroyed on UI changes.
  • LiveData for reactive style programming (from VM to UI).
  • Dagger2 for dependency injection.
  • Retrofit for REST api communication.
  • OkHttp HTTP client that's efficient by default: HTTP/2 support allows all requests to the same host to share a socket
  • Gson used to convert Java Objects into their JSON representation and vice versa.
  • Timber for logging.
  • Espresso for UI tests.
  • Mockito-Kotlin for mocking in tests.
  • MockWebServer for Instrumentation tests.
  • AndroidX Test Library for providing JUnit4 and functions as launchActivity in UI tests

Testing

Currently covered domain, data, presentation and remote module with moderate test coverage

TODO

  1. Instrumentation test cases.
  2. More unit test cases
  3. Improve UI
  4. Internet connectivity

Releases

No releases published

Packages

No packages published

Languages