Slide 1

Slide 1 text

Scalable Modular iOS Architecture @ Just Eat Alberto De Bortoli

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

AGENDA ▸ A bit of Just Eat history ▸ Challenges ▸ Learnings & advice

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

TIMELINE The Big Fork Single global platform work starts Modularization is completed Early 2014 June 2016 October 2019 Single Global codebase June 2020

Slide 6

Slide 6 text

“Integrate people first, technology later” Adam Gilmore Head of Core Engineering @ Just Eat

Slide 7

Slide 7 text

The iOS Team (a.k.a. the best team ever)

Slide 8

Slide 8 text

Your friends: the (product|delivery) managers

Slide 9

Slide 9 text

2014 2016 2018 2019

Slide 10

Slide 10 text

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 µ  

Slide 11

Slide 11 text

CocoaPods-based

Slide 12

Slide 12 text

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 µ  

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

▸ A flat dependency graph allows Xcode to parallelize the build process. source: https://patrickbalestra.com/ FLATTENED OUT DEPENDENCY GRAPH

Slide 15

Slide 15 text

▸ Not an easy task! FLATTENED OUT DEPENDENCY GRAPH

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

▸ 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

Slide 20

Slide 20 text

▸ Align with the company structure ▸ Start small ▸ Enable ownership ▸ Plan module refactoring/creation accordingly TEAMS STRUCTURE

Slide 21

Slide 21 text

▸ 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

Slide 22

Slide 22 text

▸ “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

Slide 23

Slide 23 text

REFERENCES ▸ Personal Blog albertodebortoli.com ▸ Personal Twitter @albertodebo ▸ Just Eat Blog tech.just-eat.com ▸ Just Eat Twitter @justeat_tech