SlideShare a Scribd company logo
iOS Development
at Scale
Gal Orlanczyk
Share our journey
How we Overcome
our Challenges
Some code
🤓
What will you gain?
> Concepts and tools for handling scale
> Ways to write higher standard code
5
Who is this for?
> Teams starting to expand.
> Individuals looking to write better code.
> Large teams looking to improve their workflows.
> Teams looking to iterate fast while still writing high
quality code.
So basically almost everyone 😎
6
About Me
iOS Developer for 5 years, and a big Apple fan boy 🤓
Works at:Married and Father to: A Passionate:
Playing Destiny 2 these days
Soon borderlands 3 😎
1500+
Employees
80+
Employees
in Israel
2.5M
Paying
Subscribers
1 of 4
Students
Uses Chegg
4B$
Public
Company
Chegg
Our mission is to help students
study smarter!
Our main services:
Study Math Prep
Today
Study Books PrepMath
Multiple teams working in verticals
In the Beginning…
We started out as one team.
AndroidiOS
We Worked
with Modules
Modules?
• Dynamic/Static Framework or library
• Each module has its own dependencies
• Some dependencies are shared across modules
Modules!
Each App uses several modules, directly and indirectly (via
other module dependencies)
We Worked
with Modules
Networking
Authentication
More…
(Analytics, UI, etc.)
It Doesn’t Scale!
With 3-4 people it might work…
3-4 independent teams, not so much…
The Scaling Pains
• Tightly coupled code
• Changes affects multiple apps
What we Needed
The Pains:
• Tightly coupled code
• Changes affects multiple apps
• Loosely coupled architecture
• New features with legacy code
• High standard shared components
• Shared components safety
• Ownership and knowledge sharing
What we Needed
The Pains:
• Tightly coupled code
• Loosely coupled architecture
• New features with legacy code
• High standard shared components
Loosely Coupled Architecture
Abstractions For the Rescue
We have this protocol on our foundation.
One of our apps uses `isLoggedIn` and `userUUID` only
protocol UserContextProviderProtocol {
var isLoggedIn: Bool { get }
var hasValidCredentials: Bool { get }
var userUUID: String { get }
var sessionId: String { get }
var authType: AuthenticationType { get }
// more info on user...
}
Abstractions For the Rescue
Why bring all foundation when we can just use:
How to continue?
protocol SignInContextProtocol {
var isLoggedIn: Bool { get }
var userUUID: String { get }
}
Abstractions For the Rescue
Implement on the original protocol.
protocol UserContextProviderProtocol: SignInContextProtocol
{}
Abstractions For the Rescue
Small wrappers class UserContextProviderWrapper: SignInContextProtocol {
let userContextProvider: UserContextProviderProtocol
init(userContextProvider: UserContextProviderProtocol) {
self.userContextProvider = userContextProvider
}
var isLoggedIn: Bool {
return self.userContextProvider.isLoggedIn
}
var userUUID: String {
return self.userContextProvider.userUUID
}
}
Abstractions For testing?
Abstractions For testing!
protocol SignInContextProtocol {
var isLoggedIn: Bool { get }
var userUUID: String { get }
}
class ViewModel {
init(signInContext: SignInContextProtocol, manyMoreDependencies: …) {…}
}
Abstractions For testing!
class SignInContextMock: SignInContextProtocol {
var isLoggedIn: Bool { … }
var userUUID: String { … }
}
Abstractions For testing!
class ViewModelTests: XCTestCase {
let viewModel = ViewModel(signInContext: SignInContextMock(),
manyMoreDependencies: …)
func testFlow() {
viewModel.doSomething()
XCTAssert(viewModel.something == 🔥)
}
}
What we Needed
The Pains:
• Tightly coupled code
• Loosely coupled architecture
• New features with legacy code
• High standard shared components
New Features with
Legacy Code
Example Architecture
Example Architecture
Example Architecture
Example Architecture
What we Needed
The Pains:
• Tightly coupled code
• Loosely coupled architecture
• New features with legacy code
• High standard shared components
High Standard
Shared Components
A Possible Approach
“MicroServices are a software development technique that
structures an application as a collection of loosely coupled
services.” (Wikipedia)
MicroServices Benefits
• Improves modularity
• Makes it easier to:
• Develop
• Test
• Resilient to changes
• Helps parallelize development between teams
Self Contained Frameworks 💪
• Loosely coupled code (less dependencies)
• Tests
• Isolated build process
• Example app
• Great documentation
Free Benefits
• Think twice before adding code
• Better encapsulation
• Smaller scope for our unit tests
Planning the Next Steps
• What is a good candidate for this approach?
• What will give us the best impact?
Planning the Next Steps
We received a requirement from design:
Keep our UI according to the company style guide on all apps.
Sounds like a job for…
Self contained
framework!
🤓🤓♂️
UIComponents
One design language across ALL teams
Style Guide as Code
let label = Styleguide.Label(type: .h1)
label.textColor = Styleguide.Colors.coral
myView.addSubview(label)
API Examples - Code
let label = Styleguide.Label(type: .title1)
let button = Styleguide.Button(kind: .link, dimension: .large)
Label.textColor = Styleguide.Colors.teal
let specialView = SpecialView()
specialView.titleFont = Styleguide.font(forType: .title2)
API Examples - Interface Builder
@IBOutlet private weak var label: Styleguide.Label!
class Label {
…
@IBInspectable var typography: String
}
API Guidelines
There is no specific solution for creating your components.
make sure the API is clear and extensible.
Should always be as easy as:
let label = Label(type: .h1)
label.textColor = Styleguide.Colors.coral
UIComponents Decoupling
Should be decoupled from our code base entirely!
Decoupled UI
components
• Easy support for multiple apps
• Less bugs - Components are
‘dumb’
Decoupling Guidelines
protocol SuperButtonDelegate: class {
func didSuperTouch(_ superButton: SuperButton)
}
class SuperButton {…}
Decoupling
Guidelines
class OrderButtonInteractor: SuperButtonDelegate {
// some properties definitions…
func didSuperTouch(_ superButton: SuperButton) {
self.makeOrder()
}
func makeOrder() {
self.orderApiClient.sendOrder { (succeeded) in
if succeeded {
orderDb.saveOrder(orderName:
self.orderName)
self.delegate?.orderDidFinish()
}
}
}
Example App
Every good shared
component should have
an example app
especially UI ones.
Documentation
Helps other people to
get quickly into the
action 😎
UIComponents Recap
• One source of truth for developers.
• Super easy for new hires to use.
• Reduces iterations/bugs with UI/UX.
Worthy Mentions
• Utilities
• Persistence
• Networking
• Authentication
• More…
What we Needed
The Pains:
• Tightly coupled code
• Loosely coupled architecture
• New features with legacy code
• High standard shared components
💪 💪 💪 💪 💪
Still with me 🤓?
❤️
What we Needed
The Pains:
• Changes affects multiple apps
• Shared components safety
• Ownership and knowledge sharing
Shared Components Safety
Shared Components Safety
We were looking for a mechanism to help us make sure code
changes are safe.
Any Ideas How?
Yes, Tests!
Fortunately, we’re heavily invested in our
tests coverage
Each feature is written with a fare
amount of:
• Unit tests
• Integration tests
• UI tests
UI Tests
Integration Tests
Unit Tests
Shared Components Safety
Compile Code
Master
Build Pass?
No
🚫
Yes
Prevents pushing breaking changes
Prevent Pushing Breaking Changes
Unit / Integration / UI - Tests
(Automations)
❤️
Prevent Pushing Breaking Changes
What we Needed
The Pains:
• Changes affects multiple apps
• Shared components safety
• Ownership and knowledge sharing
Ownership and
knowledge sharing
Tech Design
Tech Design
• Explains how I plan to
develop the feature
• Tech design per feature
• Allows syncing on
changes
• Allows getting ideas from
others
Round Table
Round Table
• Allows to sync between
teams
• Opportunity to talk about
issues we have
• Get help from others
Cross Team
Communication
Ground rules:
• Decide as a team
• Share, share share
What we Needed
The Pains:
• Changes affects multiple apps
• Shared components safety
• Ownership and knowledge sharing
💪 💪 💪 💪 💪 💪 💪 💪 💪 💪
The Challenges
• Short vs. long term time investment
• CI/CD – scripts/tools sharing between self-contained
frameworks
• Dependency Injection, may introduce challenges.
Recap
Spaghetti is a delicious dinner but, less optimal for code
dependencies – Use abstractions
(with balance in mind)
Recap
Build smaller independent
components, it will allow you to work
in parallel and achieve greater
heights!
Recap
Grow as a team and not individuals!
Questions?
Thank You!
Extras 🤓
UIComponents Tips
• If you want to include custom font, use `CTFontManager` to
load fonts at runtime.
• If you are going to use @IBInspectable, make sure not to
use a pre-build version of the framework.
On-Boarding
Document
The first days are always
hard for new devs.
Why not make it easier?
Technical Documentation
UIComponents cool docs were generated using “jazzy” by this
small script:
Useful Links
Jazzy
Scaling with easeCreating private pods
GitHub Status
Checks

More Related Content

PPTX
Java Tutorial: Part 2. IntelliJ IDEA
Svetlin Nakov
 
ODP
FluentSelenium Presentation Code Camp09
Pyxis Technologies
 
PPTX
API workshop: Introduction to APIs (TC Camp)
Tom Johnson
 
PDF
iOS development best practices
Michal Juhas
 
PPTX
API workshop: Deep dive into Java
Tom Johnson
 
PDF
Writing Testable Code
jameshalsall
 
PDF
Understanding, measuring and improving code quality in JavaScript
Mark Daggett
 
Java Tutorial: Part 2. IntelliJ IDEA
Svetlin Nakov
 
FluentSelenium Presentation Code Camp09
Pyxis Technologies
 
API workshop: Introduction to APIs (TC Camp)
Tom Johnson
 
iOS development best practices
Michal Juhas
 
API workshop: Deep dive into Java
Tom Johnson
 
Writing Testable Code
jameshalsall
 
Understanding, measuring and improving code quality in JavaScript
Mark Daggett
 

What's hot (19)

PPT
Test Driven Development - Overview and Adoption
Pyxis Technologies
 
PPTX
Three Developer Behaviors to Eliminate 85 Percent of Accessibility Defects
Sean Kelly
 
PDF
Spring Tools 4 - Eclipse and Beyond
VMware Tanzu
 
PDF
Python/Django Training
University of Technology
 
PPTX
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
PDF
Hack in the Box GSEC 2016 - Reverse Engineering Swift Applications
eightbit
 
PPTX
API Workshop: Deep dive into code samples
Tom Johnson
 
PPTX
How To Learn Programming For Beginners | How To Start Coding | Learn Programm...
Simplilearn
 
PPTX
Code quality
Provectus
 
PPTX
core java
Roushan Sinha
 
PPTX
DSL in test automation
test test
 
PDF
Speculative analysis for comment quality assessment
Pooja Rani
 
ODP
Documenting Code - Patterns and Anti-patterns - NLPW 2016
Søren Lund
 
PPT
C#/.NET Little Wonders
BlackRabbitCoder
 
PPTX
API Documentation -- Presentation to East Bay STC Chapter
Tom Johnson
 
PDF
Current Testing Challenges Ireland
David O'Dowd
 
PPTX
PHP Frameworks, or how I learnt to stop worrying and love the code
Michal Juhas
 
ODP
Documenting code yapceu2016
Søren Lund
 
PPTX
Debugging C# Applications
Jaliya Udagedara
 
Test Driven Development - Overview and Adoption
Pyxis Technologies
 
Three Developer Behaviors to Eliminate 85 Percent of Accessibility Defects
Sean Kelly
 
Spring Tools 4 - Eclipse and Beyond
VMware Tanzu
 
Python/Django Training
University of Technology
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Tom Johnson
 
Hack in the Box GSEC 2016 - Reverse Engineering Swift Applications
eightbit
 
API Workshop: Deep dive into code samples
Tom Johnson
 
How To Learn Programming For Beginners | How To Start Coding | Learn Programm...
Simplilearn
 
Code quality
Provectus
 
core java
Roushan Sinha
 
DSL in test automation
test test
 
Speculative analysis for comment quality assessment
Pooja Rani
 
Documenting Code - Patterns and Anti-patterns - NLPW 2016
Søren Lund
 
C#/.NET Little Wonders
BlackRabbitCoder
 
API Documentation -- Presentation to East Bay STC Chapter
Tom Johnson
 
Current Testing Challenges Ireland
David O'Dowd
 
PHP Frameworks, or how I learnt to stop worrying and love the code
Michal Juhas
 
Documenting code yapceu2016
Søren Lund
 
Debugging C# Applications
Jaliya Udagedara
 
Ad

Similar to iOS Development at Scale @Chegg (20)

PPTX
Test Driven Development (TDD) Preso 360|Flex 2010
guest5639fa9
 
PPTX
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
Elad Elrom
 
PPT
Introduction to Behavior Driven Development
Robin O'Brien
 
PPTX
Slides for Automation Testing or End to End testing
SwapnilNarayan
 
PPTX
Buildmanagment tools mavenandgradle.pptx
praveena210336
 
PPT
Interactive Development Environments
Philip Johnson
 
PDF
Raising the Bar
Alexandru Bolboaca
 
PPT
Introduction to Software Development
Zeeshan MIrza
 
PDF
Software Development Standard Operating Procedure
rupeshchanchal
 
PPTX
Webinar on How to use MyAppConverter
Jaoued Ahmed
 
PDF
Usable Software Design
Alexandru Bolboaca
 
PDF
DevOps - A Purpose for an Institution.pdf
Vishwas N
 
PPTX
Computer software specialists wikki verma
Livingston Technology Solution
 
PDF
Dominik Veselý - Vše co jste kdy chtěli vědět o CI a báli jste se zeptat
mdevtalk
 
PPTX
DevOps at Lean Apps
Lean Apps
 
PPTX
Unit tests & TDD
Dror Helper
 
PPTX
Tdd is not about testing (OOP)
Gianluca Padovani
 
PDF
A Comprehensive Guide to Efficiently Writing and Implementing iOS Unit Tests.pdf
flufftailshop
 
PDF
Best 5 Swift IDEs and Code Editors for Your Next iOS Project.pdf
Expert App Devs
 
PDF
Tdd is not about testing
Gianluca Padovani
 
Test Driven Development (TDD) Preso 360|Flex 2010
guest5639fa9
 
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
Elad Elrom
 
Introduction to Behavior Driven Development
Robin O'Brien
 
Slides for Automation Testing or End to End testing
SwapnilNarayan
 
Buildmanagment tools mavenandgradle.pptx
praveena210336
 
Interactive Development Environments
Philip Johnson
 
Raising the Bar
Alexandru Bolboaca
 
Introduction to Software Development
Zeeshan MIrza
 
Software Development Standard Operating Procedure
rupeshchanchal
 
Webinar on How to use MyAppConverter
Jaoued Ahmed
 
Usable Software Design
Alexandru Bolboaca
 
DevOps - A Purpose for an Institution.pdf
Vishwas N
 
Computer software specialists wikki verma
Livingston Technology Solution
 
Dominik Veselý - Vše co jste kdy chtěli vědět o CI a báli jste se zeptat
mdevtalk
 
DevOps at Lean Apps
Lean Apps
 
Unit tests & TDD
Dror Helper
 
Tdd is not about testing (OOP)
Gianluca Padovani
 
A Comprehensive Guide to Efficiently Writing and Implementing iOS Unit Tests.pdf
flufftailshop
 
Best 5 Swift IDEs and Code Editors for Your Next iOS Project.pdf
Expert App Devs
 
Tdd is not about testing
Gianluca Padovani
 
Ad

Recently uploaded (20)

PDF
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
PPTX
quantum computing transition from classical mechanics.pptx
gvlbcy
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PDF
Natural_Language_processing_Unit_I_notes.pdf
sanguleumeshit
 
PPTX
Inventory management chapter in automation and robotics.
atisht0104
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PPT
Understanding the Key Components and Parts of a Drone System.ppt
Siva Reddy
 
PPTX
Online Cab Booking and Management System.pptx
diptipaneri80
 
PPTX
Information Retrieval and Extraction - Module 7
premSankar19
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PDF
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
PDF
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
quantum computing transition from classical mechanics.pptx
gvlbcy
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
Natural_Language_processing_Unit_I_notes.pdf
sanguleumeshit
 
Inventory management chapter in automation and robotics.
atisht0104
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
Understanding the Key Components and Parts of a Drone System.ppt
Siva Reddy
 
Online Cab Booking and Management System.pptx
diptipaneri80
 
Information Retrieval and Extraction - Module 7
premSankar19
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
Machine Learning All topics Covers In This Single Slides
AmritTiwari19
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 

iOS Development at Scale @Chegg

Editor's Notes

  • #3: We grew really fast in the last 2 years and we want to share some of the things we learnt along the way
  • #4: How we overcome the challenges whether we used code/tools or methodologies and processes.
  • #5: What is a meetup without a little bit of code
  • #6: My goal for today is to teach you some concepts and tools to help you handle scale better And to show you ways to write higher standard code with scale in mind – more people, better resilient to changes.
  • #7: The concepts and tools I am about to speak on can be integrate partly you don’t have to use all the things I mention to make things work you will need to find the right balance that fits you – balance is everything.
  • #9: Some fun facts on Chegg
  • #10: We are student first which means we are looking to help students succeed at studying whether is by saving costs or by learning. So we help students in a few ways We have a product called Study, which you can think of as an improved stack overflow for students, it means that students can ask questions and get answers from qualified persons and students can search from all of the questions already solved before (30 million give or take) some of them with step by step solutions and some are with videos to enhance the experience. Math – Dedicated product for coping with one of the greatest challenges for students math problems – if you always dreamt in your academic study to magically get the solution with Math it just a matter of taking a picture. Prep – A new product we just launched – this is were I am , it help students memorize. He does it using flashcards. And it purpose it to help students maximize this aspect for students using effective methods and gamfication.
  • #11: The team really grew so having one team per platform is not enough
  • #12: We had multiple apps for each team ownership
  • #20: In the journey we went from small team into multiple teams we felt scaling pains we had to handle.
  • #22: We figured we needed to solve the following to be able to scale correctly Merge checks -> Adds protection for making sure code that fails to builds won’t be merged into our codebase Also helps in knowing when changes in shared frameworks like foundation works for one app but breaks another. TODO: change cross teams ui framework -> sharing code
  • #25: Benefits: Smaller contract and specific for our use. We don’t need to use foundation = less decoupling We have a few approaches to integrate this in a way that our app could know this. We can always keep the protocol and let each instance that uses to provide it’s own implementation but usually that’s not the case. Balance is key!
  • #26: Benefits: Easy and straight forward to achieve. Downside: The protocol must be in a dependency of the implementing side or inside the same framework.
  • #27: Wrappers are just small utilities for reusing a pattern. Benefits: More abstract The protocol doesn’t need to move to a cross team Downside: the wrapper still needs to be in a centralized place of the app that knows the dependency, for example PrepShared. A bit more code, for large classes can be tedious.
  • #32: We figured we needed to solve the following to be able to scale correctly Merge checks -> Adds protection for making sure code that fails to builds won’t be merged into our codebase Also helps in knowing when changes in shared frameworks like foundation works for one app but breaks another. TODO: change cross teams ui framework -> sharing code
  • #38: We figured we needed to solve the following to be able to scale correctly Merge checks -> Adds protection for making sure code that fails to builds won’t be merged into our codebase Also helps in knowing when changes in shared frameworks like foundation works for one app but breaks another. TODO: change cross teams ui framework -> sharing code
  • #41: Sounds like something that can really benefits multiple teams work!
  • #42: There is no sliver bullet, each module is different and can have some or all of the things mentioned.
  • #43: We are all human and usually when there is an extra step involved it makes us think more and self reflect This can help pre PR to think about which code should be moved.
  • #50: TODO: add code example near the inspector to understand better
  • #52: Should be in the same way Apple UIKit components are built without any knowledge of their data.
  • #53: This concept is not a new one we see it all over UIKit lets make sure to keep these guidelines for our own good.
  • #54: This concept is not a new one we see it all over UIKit lets make sure to keep these guidelines for our own good.
  • #57: Let’s take UIComponents as an example and elaborate on why it is a great MicroFrontend. When working cross teams it is important to be aligned with UI and designers which can be hard if there is no one source of truth one of our initial pains. Reduces iterations and bugs to the bare minimum of what’s important, no more colors and components outside the styleguide.
  • #60: Questions??
  • #70: When we open a pull request our CI automatically build our project and runs tests also, if some of the jobs fails we disable the option to merge the code until new commit is push that makes everything run again.
  • #72: Communication is super important! Especially on multiple teams.
  • #73: Tech designs – it is always good to have another set of eyes to check us, when sharing your tech design with the whole guild you can get very good ideas and solution you might have missed.
  • #74: Tech designs – it is always good to have another set of eyes to check us, when sharing your tech design with the whole guild you can get very good ideas and solution you might have missed.
  • #75: Tech designs – it is always good to have another set of eyes to check us, when sharing your tech design with the whole guild you can get very good ideas and solution you might have missed.
  • #76: Tech designs – it is always good to have another set of eyes to check us, when sharing your tech design with the whole guild you can get very good ideas and solution you might have missed.
  • #79: About time, explain how we developed this architecture while keeping up with our schedule for the release, need to find the right balance of abstraction CI/CD – talk about the need of having a way to share scripts & tools you use across frameworks – could be a private gem submodule or any other solution that suits.
  • #80: Remember having balance with your abstraction, docs and tests to give the best fit for your needs and timeline.