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

Scalable Modular iOS Architecture @ Just Eat

Scalable Modular iOS Architecture @ Just Eat

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

Alberto De Bortoli

October 01, 2020
Tweet

More Decks by Alberto De Bortoli

Other Decks in Programming

Transcript

  1. 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
  2. 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
  3. TIMELINE The Big Fork Single global platform work starts Modularization

    is completed Early 2014 June 2016 October 2019 Single Global codebase June 2020
  4. 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 µ  
  5. 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 µ  
  6. 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
  7. ▸ A flat dependency graph allows Xcode to parallelize the

    build process. source: https://patrickbalestra.com/ FLATTENED OUT DEPENDENCY GRAPH
  8. 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
  9. 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
  10. 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
  11. ▸ 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
  12. ▸ Align with the company structure ▸ Start small ▸

    Enable ownership ▸ Plan module refactoring/creation accordingly TEAMS STRUCTURE
  13. ▸ 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
  14. ▸ “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
  15. REFERENCES ▸ Personal Blog albertodebortoli.com ▸ Personal Twitter @albertodebo ▸

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