SlideShare a Scribd company logo
1 of 38
Download to read offline
Preparing For Growth 16.04.2021 1
Spotify
Preparing for Growth
Architecting Giant Apps for Scalability and Build Speed


Bruno Rocha - iOS Engineer @ Spotify
2
Preparing For Growth 16.04.2021
Spotify
How does an iOS app
evolve overtime?
Preparing For Growth 16.04.2021 3
Spotify
"Level 1" app


A monolith
All Classes All Resources
Features


- Single module


- MVC


- Simple features


- No testing


- Direct navigation
MyAppModule
Preparing For Growth 16.04.2021 4
Spotify
"Level 2" app


A larger (but better) monolith
MyAppModule
Feature1 Feature2
Feature3 Feature4
Feature5 Feature6
Feature7 Feature8
The app is now larger, but not
large enough to be a big issue
New Features


- Usage of protocols and composition


- A more testable architecture


- Features are slightly more complex


- Presence of unit testing


- Navigation with injection
Preparing For Growth 16.04.2021 5
Spotify
Feature
Feature
Feature
Feature
Feature
Feature
Feature
Feature
Feature
Feature
Feature Feature
MyAppModule
⚠ Slow build times!
Module cache invalidated!
Preparing For Growth 16.04.2021 6
Spotify
Onboarding
"Level 3" app


A modularized app
Home
FeatureFlags NetworkSDK
New Features


- More modules means less cache
misses


- Compilation of modules individually


- Better structure/division of concerns
in general
Preparing For Growth 16.04.2021 7
Spotify
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
New... features?


- ⚠ Slow build times! (...again?)


- ⚠ Awful launch times


- ⚠ Small changes are impossible


- ⚠ Navigation changes are almost
impossible


- ⚠ Architectural changes are
impossible


- ⚠ Isolated development compiles half
the app
Preparing For Growth 16.04.2021 8
Spotify
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Level 1 problems:


Quantity of code
Level 2 problems:


Testability of code
Level 3 problems:


Structure/Isolation of code
Level 4 problems:


Module architecture
Preparing For Growth 16.04.2021 9
Spotify
Dynamic Frameworks


.dylibs loading in runtime might cause launch
performance issues


Each additional framework that your app loads adds to the launch time.
Although dyld caches a lot of this work in a launch closure when the user
installs the app, the size of the launch closure and the amount of work done
after loading it still depend on the number and sizes of the libraries loaded.
Linking Static Libraries instead can improve launch time
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Preparing For Growth 16.04.2021 10
Spotify
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Preparing For Growth 16.04.2021 11
Spotify
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Preparing For Growth 16.04.2021 12
Spotify
Direct Dependencies


Directly depending on concrete
implementation modules makes cache
invalidation more common and makes the
app inflexible (harder to add new screens in
the middle of the flow)
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
Preparing For Growth 16.04.2021 13
Spotify
Module Module Module Module
Module Module Module Module
Module Module Module Module
Module Module Module Module
👑
Minions, destroy this
app.
Preparing For Growth 16.04.2021 14
Spotify
Module Module Module Module
Now: Horizontal Dependencies
Module Module
Previous:Vertical Dependencies
Module Module
Preparing For Growth 16.04.2021 15
Spotify
Module Module Module Module
"Level 4" app


Modules don’t depend on each other, navigation is dynamic
Module Module Module Module
Module Module Module Module
UI
Preparing For Growth 16.04.2021 16
Spotify
Classes / Structs
Protocols
Feature
Feature
Classes / Structs
Protocols
Feature2
❔
Preparing For Growth 16.04.2021 17
Spotify
Protocols
FeatureAPI
Classes/Structs
Feature (Concrete)
Protocols
Feature2API
Classes/Structs
Feature2 (Concrete)
Concrete modules shouldn’t
depend on other concrete modules!
API/Impl Module Pair


Incremental build time issues may still exist when making
changes directly in the API modules, but they are now a
much rarer occurrence.
Preparing For Growth 16.04.2021 18
Spotify
Protocols
FeatureAPI
Classes/Structs
Feature (Concrete)
Protocols
Feature2API
Classes/Structs
Feature2 (Concrete)
How to navigate


to Feature2?
Dependency Engine
Preparing For Growth 16.04.2021 19
Spotify
Feature
FeatureAPI
Feature
FeatureAPI
Feature
FeatureAPI
Feature
FeatureAPI
Feature
FeatureAPI
Feature
FeatureAPI
AppDelegateModule (.app)
🗒 ClassList
🗒 APIRequest
ConcreteClass
Preparing For Growth 16.04.2021 20
Spotify
SPTServiceSystem


Manages a graph of SPTServices, working as a runtime
dependency injector that handles the lifecycle of every
Spotify feature.
Feature
FeatureAPI
Feature
FeatureAPI
Feature
FeatureAPI
Feature
FeatureAPI
Feature
FeatureAPI
Feature
FeatureAPI
MainModule (.app)
🗒 ClassList
Preparing For Growth 16.04.2021 21
Spotify
Networking (Concrete)
NetworkService: NetworkAPI
AppDelegateModule (.app)
(SPTServiceSystem)
Hey! I have a service that
implements "NetworkAPI".
👍
HomeModule
Hey! Can you provide me the impl of
"NetworkAPI"?
👍


(Inject "NetworkService")
Preparing For Growth 16.04.2021 22
Spotify
Service Scopes


A group of services, allowing fine-grained service access control.
1 2 3 4
LoggedInScope
5 6 7 8 9 10 11 12
13 14 15 16
17 18 19 20
LaunchScope
CarPlayScope
SiriScope
HomeScope
Preparing For Growth 16.04.2021 23
Spotify
final class SiriIntentsService: SPTService, SiriIntentsAPI {







}
func load() {


print(”SiriService loaded”)


}
func unload() {


print(”SiriService unloading”)


}
static let serviceIdentifier= SiriIntentsAPI.self
@Dependencyvar connectivity: ConnectivityAPI
@Dependencyvar keychain: KeychainAPI
import ConnectivityFeatureAPI
import KeychainFeatureAPI
Preparing For Growth 16.04.2021 24
Spotify
features/siriintents/services.yaml
- SiriIntentsService (SiriScope)


- MyService (MyScope)


- MyOtherService (MyScope)


- MySuperSecretFeatureSerice (MyScope)
Preparing For Growth 16.04.2021 25
Spotify
let serviceList = SPTServiceList()


let serviceOrchestrator = ServiceOrchestrator(services: serviceList)
1
2
3
4
5
6
7
8
Directed Acyclic Graph (DAG)
[8, 7, 6, 4, 2, 5, 3, 1]
Load/Notify Order
Unload Order
(Topologically Sorted)
Preparing For Growth 16.04.2021 26
Spotify
let serviceList = SPTServiceList()


let serviceOrchestrator = ServiceOrchestrator(services: serviceList)
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
Not in memory
Lazy reference injected
Loaded in memory
serviceOrchestrator.activate(scope: "LaunchScope")
serviceOrchestrator.load(NavigationService.self, fromScope: "LaunchScope")
serviceOrchestrator.load(CrashReporterService.self, fromScope: "LaunchScope")
Preparing For Growth 16.04.2021 27
Spotify
serviceOrchestrator.deactivate(scope: ”CarPlayScope”)
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
LaunchScope
LoggedInScope
CarPlayScope
1
2
3
4
5
6
7
8
28
Preparing For Growth 16.04.2021
Spotify
Isolated Development


(Mini apps)
Preparing For Growth 16.04.2021 29
Spotify
FeatureA
FeatureAAPI
FeatureBAPI
FeatureB
FeatureC
FeatureCAPI
FeatureD
FeatureDAPI
FakeFeatureB
MyApp
Preparing For Growth 16.04.2021 30
Spotify
FeatureA
FeatureAAPI
FeatureBAPI
FakeFeatureB
FeatureADemoApp
Preparing For Growth 16.04.2021 31
Spotify
Mini Apps


Horizontal dependencies allow the creation
of minified example apps. Huge productivity
boost!
FeatureA
FeatureAAPI
FeatureBAPI
FakeFeatureB
FeatureADemoApp
32
Preparing For Growth 16.04.2021
Spotify
Dynamic Navigation
Preparing For Growth 16.04.2021 33
Spotify
Module Module Module Module
Dynamic Navigation


Not having explicit dependencies mean we can go anywhere from anywhere
Module Module Module Module
Module Module Module Module
UI
Preparing For Growth 16.04.2021 34
Spotify
final class ProfilePage: SPTService, ProfilePageAPI {






}
func load() {


navigation.register(”page-profile”) { _ in


return ProfileViewController()


}


}
static let serviceIdentifier= ProfilePageAPI.self
@Dependencyvar navigation: NavigationAPI
import NavigationFeatureAPI
Preparing For Growth 16.04.2021 35
Spotify
func navigateToProfile() {


navigation.push(”page-profile”)


}
Preparing For Growth 16.04.2021 36
Spotify
Backend-Driven UI
page-playlist?id=f8sn03k page-playlist?id=v92kalp
page-charts
page-new
page-videos
page-podcasts
(HubsRenderer)
Preparing For Growth 16.04.2021 37
Spotify
iOS App Evolution


Amount of issues when evolving
Level 1 Level 2 Level 3 Level 4 Level 5
No issues!
Some
issues.
Some bigger
issues.
TONS of
issues.
????
Preparing For Growth 16.04.2021 38
Spotify
@rockbruno_

More Related Content

What's hot

Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker, Inc.
 
Building a Chatbot with Amazon Lex and AWS Lambda Workshop
Building a Chatbot with Amazon Lex and AWS Lambda WorkshopBuilding a Chatbot with Amazon Lex and AWS Lambda Workshop
Building a Chatbot with Amazon Lex and AWS Lambda WorkshopAmazon Web Services
 
Android와 Flutter 앱 개발의 큰 차이점 5가지
Android와 Flutter 앱 개발의 큰 차이점 5가지Android와 Flutter 앱 개발의 큰 차이점 5가지
Android와 Flutter 앱 개발의 큰 차이점 5가지Bansook Nam
 
Flutter vs React Native | Edureka
Flutter vs React Native | EdurekaFlutter vs React Native | Edureka
Flutter vs React Native | EdurekaEdureka!
 
Advanced API Debugging
Advanced API DebuggingAdvanced API Debugging
Advanced API DebuggingPostman
 
Best Practices for API Management
Best Practices for API Management Best Practices for API Management
Best Practices for API Management WSO2
 
Ranorex presentation
Ranorex presentationRanorex presentation
Ranorex presentationISsoft
 
Automation With Appium
Automation With AppiumAutomation With Appium
Automation With AppiumKnoldus Inc.
 
Automation framework with clean architecture, accessibility & self healing - ...
Automation framework with clean architecture, accessibility & self healing - ...Automation framework with clean architecture, accessibility & self healing - ...
Automation framework with clean architecture, accessibility & self healing - ...Globant
 
Appium basics
Appium basicsAppium basics
Appium basicsSyam Sasi
 
Automation Testing With Appium
Automation Testing With AppiumAutomation Testing With Appium
Automation Testing With AppiumKnoldus Inc.
 
Cross-Browser-Testing with Protractor & Browserstack
Cross-Browser-Testing with Protractor & BrowserstackCross-Browser-Testing with Protractor & Browserstack
Cross-Browser-Testing with Protractor & BrowserstackLeo Lindhorst
 

What's hot (20)

Appium ppt
Appium pptAppium ppt
Appium ppt
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 
Squish slidedeck
Squish slidedeckSquish slidedeck
Squish slidedeck
 
Building a Chatbot with Amazon Lex and AWS Lambda Workshop
Building a Chatbot with Amazon Lex and AWS Lambda WorkshopBuilding a Chatbot with Amazon Lex and AWS Lambda Workshop
Building a Chatbot with Amazon Lex and AWS Lambda Workshop
 
Jenkins presentation
Jenkins presentationJenkins presentation
Jenkins presentation
 
Android와 Flutter 앱 개발의 큰 차이점 5가지
Android와 Flutter 앱 개발의 큰 차이점 5가지Android와 Flutter 앱 개발의 큰 차이점 5가지
Android와 Flutter 앱 개발의 큰 차이점 5가지
 
Flutter vs React Native | Edureka
Flutter vs React Native | EdurekaFlutter vs React Native | Edureka
Flutter vs React Native | Edureka
 
API for Beginners
API for BeginnersAPI for Beginners
API for Beginners
 
Advanced API Debugging
Advanced API DebuggingAdvanced API Debugging
Advanced API Debugging
 
Best Practices for API Management
Best Practices for API Management Best Practices for API Management
Best Practices for API Management
 
Ranorex presentation
Ranorex presentationRanorex presentation
Ranorex presentation
 
Appium.pptx
Appium.pptxAppium.pptx
Appium.pptx
 
Jenkins.pdf
Jenkins.pdfJenkins.pdf
Jenkins.pdf
 
Automation With Appium
Automation With AppiumAutomation With Appium
Automation With Appium
 
Jenkins
JenkinsJenkins
Jenkins
 
Automation framework with clean architecture, accessibility & self healing - ...
Automation framework with clean architecture, accessibility & self healing - ...Automation framework with clean architecture, accessibility & self healing - ...
Automation framework with clean architecture, accessibility & self healing - ...
 
Appium basics
Appium basicsAppium basics
Appium basics
 
Flutter vs React Native 2019
Flutter vs React Native 2019Flutter vs React Native 2019
Flutter vs React Native 2019
 
Automation Testing With Appium
Automation Testing With AppiumAutomation Testing With Appium
Automation Testing With Appium
 
Cross-Browser-Testing with Protractor & Browserstack
Cross-Browser-Testing with Protractor & BrowserstackCross-Browser-Testing with Protractor & Browserstack
Cross-Browser-Testing with Protractor & Browserstack
 

Similar to Preparing For Growth: Architecting Giant Apps for Scalability and Build Speed

Christopher Allen’s Presentation at eComm 2009
Christopher Allen’s Presentation at eComm 2009Christopher Allen’s Presentation at eComm 2009
Christopher Allen’s Presentation at eComm 2009eCommConf
 
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay ScreensLiferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay ScreensDenis Signoretto
 
Spring Boot with Kotlin, Kofu and Coroutines
 Spring Boot with Kotlin, Kofu and Coroutines Spring Boot with Kotlin, Kofu and Coroutines
Spring Boot with Kotlin, Kofu and CoroutinesVMware Tanzu
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019UA Mobile
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Eugene Kurko
 
Z sap boe-2016-techws-04_vs_fiori-app-with-eclipseluna-accessing-zsap-system
Z sap boe-2016-techws-04_vs_fiori-app-with-eclipseluna-accessing-zsap-systemZ sap boe-2016-techws-04_vs_fiori-app-with-eclipseluna-accessing-zsap-system
Z sap boe-2016-techws-04_vs_fiori-app-with-eclipseluna-accessing-zsap-systemNagendra Babu
 
Christopher Allen's Presentation at eComm 2009
Christopher Allen's Presentation at eComm 2009Christopher Allen's Presentation at eComm 2009
Christopher Allen's Presentation at eComm 2009eCommConf
 
.NET Application Modernization with PAS and Azure DevOps
.NET Application Modernization with PAS and Azure DevOps.NET Application Modernization with PAS and Azure DevOps
.NET Application Modernization with PAS and Azure DevOpsVMware Tanzu
 
Microsoft silverlight : top 10 features
Microsoft silverlight : top 10 features Microsoft silverlight : top 10 features
Microsoft silverlight : top 10 features Diya Singh
 
MOCA iBeacons SDK for iOS 7
MOCA iBeacons SDK for iOS 7MOCA iBeacons SDK for iOS 7
MOCA iBeacons SDK for iOS 7MOCA Platform
 
Top Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle ThemTop Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle ThemIonic Framework
 
Mobilefirst - Build Enterprise Class Apps for Mobile First
Mobilefirst - Build Enterprise Class Apps for Mobile First Mobilefirst - Build Enterprise Class Apps for Mobile First
Mobilefirst - Build Enterprise Class Apps for Mobile First Sanjeev Kumar
 
Claromentis Tech RoadMap 2015
Claromentis Tech RoadMap 2015Claromentis Tech RoadMap 2015
Claromentis Tech RoadMap 2015claromentis
 
Eclipse Demo Camp 2010 - Eclipse e4 – The Status and the Future
Eclipse Demo Camp 2010 - Eclipse e4 – The Status and the FutureEclipse Demo Camp 2010 - Eclipse e4 – The Status and the Future
Eclipse Demo Camp 2010 - Eclipse e4 – The Status and the FutureTonny Madsen
 
Build PWA with Ionic Toolkit
Build PWA with Ionic ToolkitBuild PWA with Ionic Toolkit
Build PWA with Ionic ToolkitPavel Kurnosov
 

Similar to Preparing For Growth: Architecting Giant Apps for Scalability and Build Speed (20)

Christopher Allen’s Presentation at eComm 2009
Christopher Allen’s Presentation at eComm 2009Christopher Allen’s Presentation at eComm 2009
Christopher Allen’s Presentation at eComm 2009
 
Codename one
Codename oneCodename one
Codename one
 
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay ScreensLiferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens
Liferay Italy Symposium 2015 Liferay Mobile SDK and Liferay Screens
 
Spring Boot with Kotlin, Kofu and Coroutines
 Spring Boot with Kotlin, Kofu and Coroutines Spring Boot with Kotlin, Kofu and Coroutines
Spring Boot with Kotlin, Kofu and Coroutines
 
Ionic2 First Lesson of Four
Ionic2 First Lesson of FourIonic2 First Lesson of Four
Ionic2 First Lesson of Four
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
 
Z sap boe-2016-techws-04_vs_fiori-app-with-eclipseluna-accessing-zsap-system
Z sap boe-2016-techws-04_vs_fiori-app-with-eclipseluna-accessing-zsap-systemZ sap boe-2016-techws-04_vs_fiori-app-with-eclipseluna-accessing-zsap-system
Z sap boe-2016-techws-04_vs_fiori-app-with-eclipseluna-accessing-zsap-system
 
Christopher Allen's Presentation at eComm 2009
Christopher Allen's Presentation at eComm 2009Christopher Allen's Presentation at eComm 2009
Christopher Allen's Presentation at eComm 2009
 
.NET Application Modernization with PAS and Azure DevOps
.NET Application Modernization with PAS and Azure DevOps.NET Application Modernization with PAS and Azure DevOps
.NET Application Modernization with PAS and Azure DevOps
 
Microsoft silverlight : top 10 features
Microsoft silverlight : top 10 features Microsoft silverlight : top 10 features
Microsoft silverlight : top 10 features
 
Sap mobility training
Sap mobility trainingSap mobility training
Sap mobility training
 
Sap mobility training
Sap mobility trainingSap mobility training
Sap mobility training
 
MOCA iBeacons SDK for iOS 7
MOCA iBeacons SDK for iOS 7MOCA iBeacons SDK for iOS 7
MOCA iBeacons SDK for iOS 7
 
Testing soap UI
Testing soap UITesting soap UI
Testing soap UI
 
Top Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle ThemTop Cordova Challenges and How to Tackle Them
Top Cordova Challenges and How to Tackle Them
 
Mobilefirst - Build Enterprise Class Apps for Mobile First
Mobilefirst - Build Enterprise Class Apps for Mobile First Mobilefirst - Build Enterprise Class Apps for Mobile First
Mobilefirst - Build Enterprise Class Apps for Mobile First
 
Claromentis Tech RoadMap 2015
Claromentis Tech RoadMap 2015Claromentis Tech RoadMap 2015
Claromentis Tech RoadMap 2015
 
Eclipse Demo Camp 2010 - Eclipse e4 – The Status and the Future
Eclipse Demo Camp 2010 - Eclipse e4 – The Status and the FutureEclipse Demo Camp 2010 - Eclipse e4 – The Status and the Future
Eclipse Demo Camp 2010 - Eclipse e4 – The Status and the Future
 
Build PWA with Ionic Toolkit
Build PWA with Ionic ToolkitBuild PWA with Ionic Toolkit
Build PWA with Ionic Toolkit
 

Recently uploaded

Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniquesugginaramesh
 

Recently uploaded (20)

Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniques
 

Preparing For Growth: Architecting Giant Apps for Scalability and Build Speed

  • 1. Preparing For Growth 16.04.2021 1 Spotify Preparing for Growth Architecting Giant Apps for Scalability and Build Speed Bruno Rocha - iOS Engineer @ Spotify
  • 2. 2 Preparing For Growth 16.04.2021 Spotify How does an iOS app evolve overtime?
  • 3. Preparing For Growth 16.04.2021 3 Spotify "Level 1" app A monolith All Classes All Resources Features - Single module - MVC - Simple features - No testing - Direct navigation MyAppModule
  • 4. Preparing For Growth 16.04.2021 4 Spotify "Level 2" app A larger (but better) monolith MyAppModule Feature1 Feature2 Feature3 Feature4 Feature5 Feature6 Feature7 Feature8 The app is now larger, but not large enough to be a big issue New Features - Usage of protocols and composition - A more testable architecture - Features are slightly more complex - Presence of unit testing - Navigation with injection
  • 5. Preparing For Growth 16.04.2021 5 Spotify Feature Feature Feature Feature Feature Feature Feature Feature Feature Feature Feature Feature MyAppModule ⚠ Slow build times! Module cache invalidated!
  • 6. Preparing For Growth 16.04.2021 6 Spotify Onboarding "Level 3" app A modularized app Home FeatureFlags NetworkSDK New Features - More modules means less cache misses - Compilation of modules individually - Better structure/division of concerns in general
  • 7. Preparing For Growth 16.04.2021 7 Spotify Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module New... features? - ⚠ Slow build times! (...again?) - ⚠ Awful launch times - ⚠ Small changes are impossible - ⚠ Navigation changes are almost impossible - ⚠ Architectural changes are impossible - ⚠ Isolated development compiles half the app
  • 8. Preparing For Growth 16.04.2021 8 Spotify Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Level 1 problems: Quantity of code Level 2 problems: Testability of code Level 3 problems: Structure/Isolation of code Level 4 problems: Module architecture
  • 9. Preparing For Growth 16.04.2021 9 Spotify Dynamic Frameworks .dylibs loading in runtime might cause launch performance issues Each additional framework that your app loads adds to the launch time. Although dyld caches a lot of this work in a launch closure when the user installs the app, the size of the launch closure and the amount of work done after loading it still depend on the number and sizes of the libraries loaded. Linking Static Libraries instead can improve launch time Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module
  • 10. Preparing For Growth 16.04.2021 10 Spotify Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module
  • 11. Preparing For Growth 16.04.2021 11 Spotify Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module
  • 12. Preparing For Growth 16.04.2021 12 Spotify Direct Dependencies Directly depending on concrete implementation modules makes cache invalidation more common and makes the app inflexible (harder to add new screens in the middle of the flow) Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module
  • 13. Preparing For Growth 16.04.2021 13 Spotify Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module Module 👑 Minions, destroy this app.
  • 14. Preparing For Growth 16.04.2021 14 Spotify Module Module Module Module Now: Horizontal Dependencies Module Module Previous:Vertical Dependencies Module Module
  • 15. Preparing For Growth 16.04.2021 15 Spotify Module Module Module Module "Level 4" app Modules don’t depend on each other, navigation is dynamic Module Module Module Module Module Module Module Module UI
  • 16. Preparing For Growth 16.04.2021 16 Spotify Classes / Structs Protocols Feature Feature Classes / Structs Protocols Feature2 ❔
  • 17. Preparing For Growth 16.04.2021 17 Spotify Protocols FeatureAPI Classes/Structs Feature (Concrete) Protocols Feature2API Classes/Structs Feature2 (Concrete) Concrete modules shouldn’t depend on other concrete modules! API/Impl Module Pair Incremental build time issues may still exist when making changes directly in the API modules, but they are now a much rarer occurrence.
  • 18. Preparing For Growth 16.04.2021 18 Spotify Protocols FeatureAPI Classes/Structs Feature (Concrete) Protocols Feature2API Classes/Structs Feature2 (Concrete) How to navigate to Feature2? Dependency Engine
  • 19. Preparing For Growth 16.04.2021 19 Spotify Feature FeatureAPI Feature FeatureAPI Feature FeatureAPI Feature FeatureAPI Feature FeatureAPI Feature FeatureAPI AppDelegateModule (.app) 🗒 ClassList 🗒 APIRequest ConcreteClass
  • 20. Preparing For Growth 16.04.2021 20 Spotify SPTServiceSystem Manages a graph of SPTServices, working as a runtime dependency injector that handles the lifecycle of every Spotify feature. Feature FeatureAPI Feature FeatureAPI Feature FeatureAPI Feature FeatureAPI Feature FeatureAPI Feature FeatureAPI MainModule (.app) 🗒 ClassList
  • 21. Preparing For Growth 16.04.2021 21 Spotify Networking (Concrete) NetworkService: NetworkAPI AppDelegateModule (.app) (SPTServiceSystem) Hey! I have a service that implements "NetworkAPI". 👍 HomeModule Hey! Can you provide me the impl of "NetworkAPI"? 👍 
 (Inject "NetworkService")
  • 22. Preparing For Growth 16.04.2021 22 Spotify Service Scopes A group of services, allowing fine-grained service access control. 1 2 3 4 LoggedInScope 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 LaunchScope CarPlayScope SiriScope HomeScope
  • 23. Preparing For Growth 16.04.2021 23 Spotify final class SiriIntentsService: SPTService, SiriIntentsAPI { 
 



 } func load() { print(”SiriService loaded”) } func unload() { 
 print(”SiriService unloading”) } static let serviceIdentifier= SiriIntentsAPI.self @Dependencyvar connectivity: ConnectivityAPI @Dependencyvar keychain: KeychainAPI import ConnectivityFeatureAPI import KeychainFeatureAPI
  • 24. Preparing For Growth 16.04.2021 24 Spotify features/siriintents/services.yaml - SiriIntentsService (SiriScope) - MyService (MyScope) - MyOtherService (MyScope) - MySuperSecretFeatureSerice (MyScope)
  • 25. Preparing For Growth 16.04.2021 25 Spotify let serviceList = SPTServiceList() 
 let serviceOrchestrator = ServiceOrchestrator(services: serviceList) 1 2 3 4 5 6 7 8 Directed Acyclic Graph (DAG) [8, 7, 6, 4, 2, 5, 3, 1] Load/Notify Order Unload Order (Topologically Sorted)
  • 26. Preparing For Growth 16.04.2021 26 Spotify let serviceList = SPTServiceList() 
 let serviceOrchestrator = ServiceOrchestrator(services: serviceList) 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 Not in memory Lazy reference injected Loaded in memory serviceOrchestrator.activate(scope: "LaunchScope") serviceOrchestrator.load(NavigationService.self, fromScope: "LaunchScope") serviceOrchestrator.load(CrashReporterService.self, fromScope: "LaunchScope")
  • 27. Preparing For Growth 16.04.2021 27 Spotify serviceOrchestrator.deactivate(scope: ”CarPlayScope”) 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 LaunchScope LoggedInScope CarPlayScope 1 2 3 4 5 6 7 8
  • 28. 28 Preparing For Growth 16.04.2021 Spotify Isolated Development 
 (Mini apps)
  • 29. Preparing For Growth 16.04.2021 29 Spotify FeatureA FeatureAAPI FeatureBAPI FeatureB FeatureC FeatureCAPI FeatureD FeatureDAPI FakeFeatureB MyApp
  • 30. Preparing For Growth 16.04.2021 30 Spotify FeatureA FeatureAAPI FeatureBAPI FakeFeatureB FeatureADemoApp
  • 31. Preparing For Growth 16.04.2021 31 Spotify Mini Apps Horizontal dependencies allow the creation of minified example apps. Huge productivity boost! FeatureA FeatureAAPI FeatureBAPI FakeFeatureB FeatureADemoApp
  • 32. 32 Preparing For Growth 16.04.2021 Spotify Dynamic Navigation
  • 33. Preparing For Growth 16.04.2021 33 Spotify Module Module Module Module Dynamic Navigation Not having explicit dependencies mean we can go anywhere from anywhere Module Module Module Module Module Module Module Module UI
  • 34. Preparing For Growth 16.04.2021 34 Spotify final class ProfilePage: SPTService, ProfilePageAPI { 
 


 } func load() { navigation.register(”page-profile”) { _ in 
 return ProfileViewController() 
 } } static let serviceIdentifier= ProfilePageAPI.self @Dependencyvar navigation: NavigationAPI import NavigationFeatureAPI
  • 35. Preparing For Growth 16.04.2021 35 Spotify func navigateToProfile() { navigation.push(”page-profile”) }
  • 36. Preparing For Growth 16.04.2021 36 Spotify Backend-Driven UI page-playlist?id=f8sn03k page-playlist?id=v92kalp page-charts page-new page-videos page-podcasts (HubsRenderer)
  • 37. Preparing For Growth 16.04.2021 37 Spotify iOS App Evolution Amount of issues when evolving Level 1 Level 2 Level 3 Level 4 Level 5 No issues! Some issues. Some bigger issues. TONS of issues. ????
  • 38. Preparing For Growth 16.04.2021 38 Spotify @rockbruno_