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

Architecting an Android application

Architecting an Android application

A practical example on how we can apply MVP and Hexagonal architectural patterns to move our Android code towards a Cleaner code.

Cristian Tanas

February 25, 2017
Tweet

Other Decks in Programming

Transcript

  1. Agenda ✔ MoG (Mother Of God) ✔ MVP (Model View

    Presenter) ✔ Hexagonal (Ports & Adapters)
  2. MoG - Discussion https://goo.gl/UW9fck ✗ No architecture ✗ Business logic

    mixed with framework ✗ Very difficult to test ✗ Moves towards caos (technical debt) ✗ Difficult to add new functionalities ✔ Fast & easy to implement
  3. MVP - Discussion https://goo.gl/x7PWvm ✔ View decoupled from the business

    logic ✔ Cleaner code and reusable ✔ Easier to test ✗ Implementation driven by experience and knowledge ✗ Not suitable for simple and small solutions
  4. Hexagonal In practice... Bussines logic MainView Adapter LocalDbAdapter Activity Sugar

    ORM CreateView Adapter https://goo.gl/veULJu TodoItem DataModel ViewModel Activity
  5. Hexagonal - Discussion https://goo.gl/veULJu ✔ Business logic is pure Java

    and independent from framework ✔ Simplifies testing ✔ Highly re-usable ✔ Highly maintanable: easy to swap plugins ✗ Higher complexity: implementation ✗ Requires mapping for each boundary or adapter • What goes into the hexagon? • How many ports?