Scalable Modular iOS Architecture @ Just Eat

Scalable Modular iOS Architecture @ Just Eat

Slides of the talk given at Swift Heroes 2020 (http://swiftheroes.com/).

D906ed8942d09821cbead00b19c6dabe?s=128

Alberto De Bortoli

October 01, 2020
Tweet

Transcript

  1. Scalable Modular iOS Architecture @ Just Eat Alberto De Bortoli

  2. A modular architecture is a software design technique that emphasises

    separating the functionality of a program into independent, interchangeable modules, such that each one contains everything necessary to execute only one aspect of the desired functionality. MODULAR ARCHITECTURE
  3. AGENDA ▸ A bit of Just Eat history ▸ Challenges

    ▸ Learnings & advice
  4. JUST EAT TAKEAWAY A LEADING GLOBAL ONLINE FOOD DELIVERY MARKETPLACE

    ▸ Global reach 24 coutries ▸ Offering choice 205,000 Restaurant Partners serving over 100 different cuisine types ▸ Diversified customer base 54m active customer ▸ A fantastic team Over 8,000 employees globally
  5. TIMELINE The Big Fork Single global platform work starts Modularization

    is completed Early 2014 June 2016 October 2019 Single Global codebase June 2020
  6. “Integrate people first, technology later” Adam Gilmore Head of Core

    Engineering @ Just Eat
  7. The iOS Team (a.k.a. the best team ever)

  8. Your friends: the (product|delivery) managers

  9. 2014 2016 2018 2019

  10. 0HQXORJ$SSV Ռצ -XVW(DW 8.$SS ֊ -XVW(DW ,QWHUQDWLRQDO$SSV ֫րշע֣ֈ (DWFK$SS է

    +RPH /RFDWLRQ 6(53 5HVWDXUDQW 0HQX %DVNHW &KHFNRXW $SSOH3D\ 2UGHUV 6HWWLQJV $FFRXQW 1RWLƪFDWLRQV -XVW+HOS %RW /LYH&KDW 7RGD\([WHQVLRQ &KDLQV EUDQGHGUHVWDXUDQWV *LIW&DUGV 2ƨHUV $GGUHVVHV 6KDUHGPRGXOHV :DWFK -XVW8, -XVW$QDO\WLFV µ RSHQVRXUFH -XVW3HUVLVW µ -XVW7ZHDN µ 1DYLJDWLRQ(QJLQH µ -XVW7UDFN µ -XVW/RJ µ $XWRPDWLRQ7RROV µ $VVHW3URYLGHU 'RPDLQPRGXOHV &RUHPRGXOHV ([SHULPHQWV $3,&OLHQW  6KRFN µ 'DWH)RUPDWWLQJ (UURU8WLOLWLHV µ 6FUROOLQJ6WDFN 9LHZ&RQWUROOHU µ  
  11. CocoaPods-based

  12. 6HWWLQJV $FFRXQW 1RWLƪFDWLRQV -XVW+HOS %RW /LYH&KDW 7RGD\([WHQVLRQ 2ƨHUV 6KDUHGPRGXOHV -XVW8,

    -XVW$QDO\WLFV µ -XVW7ZHDN µ -XVW7UDFN µ -XVW/RJ µ 6KRFN µ 'DWH)RUPDWWLQJ (UURU8WLOLWLHV µ 6FUROOLQJ6WDFN 9LHZ&RQWUROOHU µ  
  13. AVOID DEPENDENCY HELL ▸ The dependency issue arises around shared

    libraries on which other libraries have dependencies but where they depend on different and incompatible versions ▸ Sometimes duplication is better ▸ Low-level code shouldn’t change frequently, and our code changes frequently by definition
  14. ▸ A flat dependency graph allows Xcode to parallelize the

    build process. source: https://patrickbalestra.com/ FLATTENED OUT DEPENDENCY GRAPH
  15. ▸ Not an easy task! FLATTENED OUT DEPENDENCY GRAPH

  16. THINK OPEN-SOURCE ▸ README ▸ Easy to integrate ▸ Tests

    ▸ Reasonably shaped code “I don't wanna use this library because it's not in MVVM.” - said nobody ever
  17. DON'T BE FUSSY ABOUT (A SPECIFIC) ARCHITECTURE ▸ It's simply

    inevitable that different developers prefer different kinds of architecture ▸ Best to evangelise SOLID, Dependency Injection, Inversion of Control. MVVM VIPER MVC MVP MVVM-C ELM
  18. GO FACADE ▸ Forces you to think simple and remove

    clutter ▸ Tiny surface integration point ▸ Swift/Objective-C interoperability ▸ “A component interface should increase slower than its surface are” Swift Obj-C
  19. ▸ Only run the code you are working on ▸

    Fast compilation times ▸ Jump straight to the desired features ▸ Get the template for free with $ pod lib create DEMO APPS
  20. ▸ Align with the company structure ▸ Start small ▸

    Enable ownership ▸ Plan module refactoring/creation accordingly TEAMS STRUCTURE
  21. ▸ From n to 1 repositories ▸ Modules are versioned

    with the app (no tedious process for hotfixes) ▸ 1 single Pull Request: lower cognitive load, work is not interrupted NOTES ON THE MONOREPO Separate repos Monorepo CI CI CI Integration publish version Implementation Implementation time Integration
  22. ▸ “We were able to fix this by writing custom

    Jenkins scripts that look at the changed files and then intelligently trigger only the platforms affected by such a change.” - Peter Steinberger ▸ Modules still isolated ▸ Exception made for 2nd-level dependencies NOTES ON THE MONOREPO
  23. REFERENCES ▸ Personal Blog albertodebortoli.com ▸ Personal Twitter @albertodebo ▸

    Just Eat Blog tech.just-eat.com ▸ Just Eat Twitter @justeat_tech