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 Slide

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

    View Slide

  3. MVC
    Model View Controller

    View Slide

  4. View Slide

  5. 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 Slide

  6. MVP
    Model View Presenter

    View Slide

  7. View Slide

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

    View Slide

  9. MVVM
    Model View ViewModel

    View Slide

  10. View Slide

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

    View Slide

  12. MVPC
    Model View Presenter Controller

    View Slide

  13. View Slide

  14. 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 Slide

  15. View Slide

  16. 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 Slide

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

    View Slide