Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android VIPER Architecture implementation

Jiri Helmich
November 24, 2016

Android VIPER Architecture implementation

How to implement VIPER aka Clean Architecture on Android

Jiri Helmich

November 24, 2016
Tweet

Other Decks in Education

Transcript

  1. VIEW Should take care of following: • UI rendering •

    UI components • Data displaying • Should wrap main View objects and provide them to lower levels • Android API specific stuff which does require Activity Context
  2. PRESENTER This layer should behave like a bridge between UI

    and it’s data. It should: • Handle UI events • Update UI based on events • Communicate with ViewModel to update / gather data • Should use Data Binding framework
  3. VIEWMODEL This layer should hold View state and data. It

    should take care of: • View state operations • Persist over UI configuration changes • View related data operations • Should use Observer pattern to notify changes
  4. INTERACTOR This layer should operate with all the business logic

    data necessary for the ViewModel and should push them there. Should take care of: • Data operation to / from various data sources • ViewModel-ready data preparation
  5. ROUTER Basically an utilized class to handle screen related navigation.

    Therefore any Fragment or Activity starting / showing / hiding operations. Similar to Navigator pattern.
  6. MOTIVATION Why should I choose VIPER architecture for my project?

    • Good modularization • Concern separation • SOLID principles • Clean to read and understand • High testing ability (good for TDD)
  7. “It is not enough for code to work.“ ROBERT C.

    MARTIN, Clean Code: A Handbook of Agile Software Craftsmanship
  8. Differences against MVVM • More abstraction • Best for more

    complex projects • Overkill for simple applications • More layers thus better concern separation • Better testability
  9. TIME COMPLEXITY - It is really complex to implement it.

    - You should be patient and careful when building the base. - If you are going for a huge project. => Don’t reinvent the wheel. http://www.memes.com/img/635087