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

Remix workshop

Remix workshop

Dan introduces the Remix architecture, aimed at maximising reuse of components for apps that spin variations on a theme.

Many apps support multiple skins, but some need the ability to be remixed with entirely customised flows or combinations of features for different customers. It's difficult to do this well with a typical View Controller-centric architecture, but a combination of Coordinators and Clean architecture make this not just possible but pleasant and easy to test too.

94fc7b58c03a0650fe1e8d78140bd451?s=128

Dan Cutting

August 08, 2017
Tweet

Transcript

  1. DAN CUTTING CUTTING.IO @DCUTTING

  2. MARKETS, EXPERIMENTS, IPAD, TESTS ➜ ARCHITECTURE! MOTIVATION

  3. DEMO

  4. KISS YAGNI MVC

  5. MVC PickGameView PickNumberView PlayGameView

  6. CODE

  7. None
  8. MVC ▸ Flow logic everywhere ▸ Low cohesion MVC PickGameView

    PickNumberView PlayGameView
  9. IDEATE THIS COORDINATORS

  10. Coordinators GameCoordinator PickGameView PickNumberView PlayGameView

  11. CODE

  12. COORDINATORS ▸ Flow logic in one place (high cohesion) ▸

    Flows have names ▸ (More) reusable views Coordinators GameCoordinator PickGameView PickNumberView PlayGameView
  13. KIDS LIKE IPADS? CLEAN

  14. SPELLD OUT PRIME 7 7 is prime

  15. @daniel.cutting Robert C. Martin https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html

  16. Clean GameCoordinator PickGameView PickNumberView PlayGameView GameInteractor PlayGameFormatter

  17. CODE

  18. Tim-bezhashvyly https://commons.wikimedia.org/wiki/File:Robert_Cecil_Martin.png

  19. Clean GameCoordinator GameInteractor PickGameView PickNumberView PlayGameFormatter PlayGameView

  20. CODE

  21. SPELLD OUT PRIME 7 7 is prime

  22. DEMO

  23. CLEAN Clean GameCoordinator GameInteractor PickGameView PickNumberView PlayGameFormatter PlayGameView ▸ Reusable

    business logic ▸ Reusable presentation logic ▸ Coordinators just
 keep flow logic ▸ New flow ➜
 new coordinator
  24. None
  25. UGH, REALLY? AUTOMATED TESTS

  26. DEMO

  27. AUTOMATED TESTS ▸ Decouple UIKit ▸ Test everything except thin

    UIKit layer ▸ Blazing fast ▸ Unit, flow & acceptance tests
 without a simulator!
  28. JUST RE-MOTE IT FEATURES

  29. Clean GameCoordinator GameInteractor PickGameView PickNumberView PlayGameFormatter PlayGameView

  30. Feature Coordinator Interactors... Formatters... Views...

  31. Feature Coordinator Features... Interactors... Formatters... Views...

  32. App Feature Feature Feature Feature Feature Feature Feature

  33. Features GameCoordinator PickFeature PickCoordinator PickInteractor PickGameView PickNumberView LocalPlayInteractor PlayGameFormatter PlayGameView

  34. Features RemoteGameCoordinator PickFeature RemotePlayInteractor RemoteGameFormatter RemoteGameView

  35. FEATURES Features GameCoordinator PickFeature PickCoordinator PickInteractor PickGameView PickNumberView LocalPlayInteractor PlayGameFormatter

    PlayGameView ▸ Reusable flows ▸ Coordinators have delegates just like views
  36. REMIX OUR EXPERIENCES ▸ Separate flow, business, presentation logic
 ➜

    loose coupling, high cohesion
 ➜ readable, maintainable, composable ▸ Easy, fast tests ▸ But: dependency injection! ▸ And: the more you share, the more you (have to) care
  37. ARCHITECTURE CAN.. BE.. GRADUAL. BE OK WITH INCONSIST3NCY “

  38. DAN CUTTING CUTTING.IO @DCUTTING GITHUB.COM/DCUTTING/REMIX LOGO BY STRANGEMANSTANDING