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

Android Clean Architecture (Lightning Talk)

Chuck Greb
September 30, 2015

Android Clean Architecture (Lightning Talk)

Lately there has been a lot of talk about clean architecture in the Android space including MVC, MVP, MVVM, and more. Let's break down some of these design patterns and talk about how one might implement them on Android.

Chuck Greb

September 30, 2015
Tweet

More Decks by Chuck Greb

Other Decks in Technology

Transcript

  1. Android Clean Architecture
    Chuck Greb
    @ecgreb
    30 Sept 2015
    Android Alliance Philly
    GDG Philadelphia

    View full-size slide

  2. Why clean architecture?
    ● All powerful Activities and Fragments
    ● Separate business logic from Android framework
    ● Improved testability

    View full-size slide

  3. MVC
    Model View Controller

    View full-size slide

  4. MVC
    Supervising Controller
    ● The View relays user input to the Controller
    ● The Controller processes input and updates the Model
    ● Changes in Model state are used to update the View

    View full-size slide

  5. MVP
    Model View Presenter

    View full-size slide

  6. MVP
    Passive View
    ● View forwards user inputs and lifecycle events to the Presenter
    ● Presenter interacts with Model to format data for display

    View full-size slide

  7. MVVM
    Model View ViewModel

    View full-size slide

  8. MVVM
    Presentation Model
    ● ViewModel contains data field for every component in the View
    ● Data binding and synchronization

    View full-size slide

  9. MVPC
    Model View Presenter Controller

    View full-size slide

  10. MVPC
    WTF
    ● Modified version of MVP to accommodate Android framework
    ● Cleanly separates business logic from UI and Activity lifecycle
    ● Enables unit testing of non-Android components
    ○ Presenter
    ○ Model

    View full-size slide

  11. References
    Development of Further Patterns of Enterprise Application Architecture
    (DFPEAA)
    Martin Fowler
    Fragmented (Episode #11) - The Fowler Road to a Clean Architecture
    Donn Felker & Kaushik Gopal
    Android Architecture - A simple guide for MVC, MVP and MVVM on Android
    projects
    Thanos Karpouzis

    View full-size slide

  12. Thanks!
    Chuck Greb
    @ecgreb
    30 Sept 2015
    Android Alliance Philly
    GDG Philadelphia

    View full-size slide