Skip to content

A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.

License

Notifications You must be signed in to change notification settings

elirex/android-architecture

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TODO-DataBinding-RxJava

This sample is based on the todo-mvp and combined other two samples, one is the todo-datatbinding and onther is todo-mvp-rxjava. Using the Data Binding library to display data and bind UI elements to actions and through the RxJava to communicate between the data model and presenter layer.

This sample doesn't follow a strict Model-View-ViewModel or a Model-View-Presenter pattern, as it uses both View Models and Presenters.

Feature components

UI

The responsibility of each component in this sample is:

  • Activity: Object creation.
  • Fragment: Interaction with framework components.
  • Presenter: Receives user actions and retrieves the data from the repository.
  • ViewModel: Exposes data for a view.

Data

Using RxJava streams as a way of retrieving task. The RxJava provides the easy way to convert between threads.

Additional dependencies

Features

Complexity

Developers need to be familiar with RxJava and Data binding.

Testability

Unit testing

Very high. Unit tests are easy to implement, because the Observable of RxJava is highly unit testable.

UI testing

Similar with TODO-MVP.

Code metrics

Compared to TODO-MVP, each page add ViewModel class but less UI code per Activity and Fragment, and add some classes to encapsulate the Schedulers of RxJava.

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Java                            54           1459           1554           3734 (3450 in MVP)
XML                             35            126            337            734
-------------------------------------------------------------------------------
SUM:                            89           1585           1891           4468
-------------------------------------------------------------------------------

Maintainability

Ease of amending or adding a feature

Easier than MVP for small changes. A new feature might require some experience with RxJava and Data Binding library.

Learning cost

The Data Binding library takes care of the communication between some components, so developers need to understand what it does and doesn't before making changes to the code.

The RxJava uses new concepts, so developers need to understand how it work.

About

A collection of samples to discuss and showcase different architectural tools and patterns for Android apps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.8%
  • Prolog 0.2%