SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
Jorge D. Ortiz Fuentes


Mobile Developer Advocate, MongoDB
WELCOME
Implementing Feature Flags
Tell Me Quando
Agenda
What are Feature Flags? Why using Feature
Flags?


Implementing Feature Flags


Three Common Scenarios


Recap
What are Feature
Flags? Why using
them?
A set of constants
that hide or expose
functionality while
it is on development
It is all
about
features
Feature: a characteristic of your
product (has/is)


User Story: a feature from the
perspective of the end-user
Display list of items
Receive notifications about data changes
Add a new item to the list
Persist data locally
New look and feel
Sync with other devices
Animations and eye-candy
…
New Feature
Let s Code Then!
git branch
No!
🙅
It is all
about
branching
Git Flow:


• Main, develop, feature, release, hot-fix…


• Long-lived branches


• Feature code reviews


GitHub Flow:


• Main & feature branches


• Long-lived branches still possible


• Feature code reviews


(Scaled) Trunk-Based Development:


• Trunk/main, releases


• Daily/very frequent


• Smaller code reviews (WIP)
Why not JUST Coding?
Features need time and most likely several steps to complete adding the required code


Fixes might be needed while developing the feature


Some features get discarded after being implemented


Even if they get accepted, they may require


• Some process and


• Waiting for the next version


You need to address your different target audiences: your tests, QA, beta tester production
One Codebase to Rule them all
Implementing
Feature Flags
Make Simple Things Simple
#if THIS_ENABLED {


// New code


#else


// Previous behavior implementation, if any


#endif
Put the
logic in the
code
Different configuration ≠ Feature flags


Use booleans instead of configuration
But where do I set
those flags?
Requirements for the Flag Variables
• Produce different builds for the different audiences from the same codebase


• A feature starts being developed in alpha and it is disabled for any other build


• It is enabled for the next stage when the previous stage is completed
Building with Xcode
List of files (code &
resources) to generate a
product
Target
A set of settings
applied to targets
Build Configurations
Defines actions
combining target and
configuration
Scheme
SWIFT_ACTIVE_COMPILATION_CONDITIONS
Evolution of a Feature Flag
Release
Beta
QA
Alpha
Release
Debug
❌
✅ ❌ ❌
Development
Clean up ➖
Internal test ✅ ❌ ❌
✅
External test ✅ ❌
✅ ✅
Release ✅ ✅ ✅ ✅
➖ ➖ ➖
Xcode
Trickery
Don’t use targets to have different files
for the flags


Use build configurations for each
development stage


Use xcconfig files for each stage, to
enable the flags and use include for
other settings


Configurations can be tuned exposing


$(CONFIGURATION) in Info.plist


Use Product Bundle Identifier if you
want more than one version running on
the same device
Build Configurations
Static vs


Dynamic
Static


• Removes unused code


• Fully controlled by development


• Defined in the project


Dynamic


• All code paths are in the binary


• Behavior can be changed without
rebuilding


• Controlled from elsewhere
Three Common
Scenarios
Three Common Scenarios
Change some logic or how
a layer is implemented


Logic or layer impl.
Change color, text,
position, but keep the
“same” UI structure
Minor View Change
Increase or reduce the
number of views used to
interact with the user
Mayor View Change
Let s Code
Together
CODE REPOSITORY AVAILABLE LATER
https://bit.ly/


sh
2
2
-realm
Minor UI Change
struct MoodButton: View {


let mood: Mood


var body: some View {


Text(String("(mood)"))


.font(Font.system(size: 40))


.padding()


#if NEW_UI


.background(Color.red)


#else


.background(Color.accentColor)


#endif


.cornerRadius(10)


}


}
Major UI Change
@main


struct MoodLoggerApp: App {


var body: some Scene {


WindowGroup {


NavigationView {


#if NEW_UI


NewEntriesListView(viewModel: NewEntriesListViewModel(repository: InMemoryEntryRepository()))


#else


EntriesListView(viewModel: EntriesListViewModel(repository: InMemoryEntryRepository()))


#endif


}


}


}


}
Do I Need to have
Tests in Place?
No! You don’t
need to
But it does help a
lot
Love your future
self and your team
HINT
How do the
tests
change?
Test your old code: feature flag
disabled


Test your new code: feature flag
enabled
Recap
Summary
Feature flags allow to be agile


• Evolve your code without causing disruptions


• Change priorities on the fly


• Tune up deployment


Implementation is easy


• Build configurations


• xcconfig for each of the configuration


• If expression to choose between old and new implementation


Use feature flags not just for domain logic, but alternative implementations, and different UIs
Thank you!
Q&A
Resources
Developer Hub:


https://developer.mongodb.com


YouTube Channel:


https://www.youtube.com/mongodb


Podcast:


https://www.mongodb.com/podcast


https://linktr.ee/unicodeu00d1


Twitter [Me]:


https://www.twitter.com/jdortiz

Mais conteúdo relacionado

Mais procurados

Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
intelliyole
 
Introduction to visual basic
Introduction to visual basicIntroduction to visual basic
Introduction to visual basic
Manav Khandelwal
 

Mais procurados (20)

React Native for ReactJS Devs
React Native for ReactJS DevsReact Native for ReactJS Devs
React Native for ReactJS Devs
 
JENKINS
JENKINSJENKINS
JENKINS
 
Designing Auto Generated Codes
Designing Auto Generated CodesDesigning Auto Generated Codes
Designing Auto Generated Codes
 
Angular js training
Angular js training Angular js training
Angular js training
 
Angular js Training in Hyderabad
Angular js Training in HyderabadAngular js Training in Hyderabad
Angular js Training in Hyderabad
 
A journey with Target Platforms
A journey with Target PlatformsA journey with Target Platforms
A journey with Target Platforms
 
Introduction to DL-BUILDER
Introduction to DL-BUILDERIntroduction to DL-BUILDER
Introduction to DL-BUILDER
 
React Native
React NativeReact Native
React Native
 
10 Usability Heuristics - IntelliJ IDEA
10 Usability Heuristics - IntelliJ IDEA10 Usability Heuristics - IntelliJ IDEA
10 Usability Heuristics - IntelliJ IDEA
 
Node in Production at Aviary
Node in Production at AviaryNode in Production at Aviary
Node in Production at Aviary
 
Eclipse 2011 Hot Topics
Eclipse 2011 Hot TopicsEclipse 2011 Hot Topics
Eclipse 2011 Hot Topics
 
Java 8 tooling in Eclipse
Java 8 tooling in EclipseJava 8 tooling in Eclipse
Java 8 tooling in Eclipse
 
利用 Appium + Robot Framework 實現跨平台 App 互動測試
利用 Appium + Robot Framework 實現跨平台 App 互動測試利用 Appium + Robot Framework 實現跨平台 App 互動測試
利用 Appium + Robot Framework 實現跨平台 App 互動測試
 
Exploring Android Studio
Exploring Android StudioExploring Android Studio
Exploring Android Studio
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Introduction to flutter
Introduction to flutterIntroduction to flutter
Introduction to flutter
 
Eclipse Luna - What's New!
Eclipse Luna - What's New!Eclipse Luna - What's New!
Eclipse Luna - What's New!
 
Introduction to visual basic
Introduction to visual basicIntroduction to visual basic
Introduction to visual basic
 
What's Coming in Visual Studio v.Next
What's Coming in Visual Studio v.NextWhat's Coming in Visual Studio v.Next
What's Coming in Visual Studio v.Next
 
Jetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UIJetpack Compose - Android’s modern toolkit for building native UI
Jetpack Compose - Android’s modern toolkit for building native UI
 

Semelhante a Tell Me Quando - Implementing Feature Flags

Android crash course
Android crash courseAndroid crash course
Android crash course
Showmax Engineering
 
Building Buzzword (Flex Camp Boston 2007)
Building Buzzword (Flex Camp Boston 2007)Building Buzzword (Flex Camp Boston 2007)
Building Buzzword (Flex Camp Boston 2007)
dcoletta
 

Semelhante a Tell Me Quando - Implementing Feature Flags (20)

Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
Introduction to Android- A session by Sagar Das
Introduction to Android-  A session by Sagar DasIntroduction to Android-  A session by Sagar Das
Introduction to Android- A session by Sagar Das
 
Final ppt
Final pptFinal ppt
Final ppt
 
Odo improving the developer experience on OpenShift - hack & sangria
Odo   improving the developer experience on OpenShift - hack & sangriaOdo   improving the developer experience on OpenShift - hack & sangria
Odo improving the developer experience on OpenShift - hack & sangria
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
 
Fluttering
FlutteringFluttering
Fluttering
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una Daly
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile Apps
 
Eric grover strategies for sharing code with windows 8 and windows phone 8 ...
Eric grover   strategies for sharing code with windows 8 and windows phone 8 ...Eric grover   strategies for sharing code with windows 8 and windows phone 8 ...
Eric grover strategies for sharing code with windows 8 and windows phone 8 ...
 
Ignite your app development with Angular, NativeScript and Firebase
Ignite your app development with Angular, NativeScript and FirebaseIgnite your app development with Angular, NativeScript and Firebase
Ignite your app development with Angular, NativeScript and Firebase
 
Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1Basic iOS Training with SWIFT - Part 1
Basic iOS Training with SWIFT - Part 1
 
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud RunDesigning flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
 
A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0
A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0
A Sneak Peek At Visual Studio 2010 And .Net Framework 4.0
 
iOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for JasakomeriOS Development - Offline Class for Jasakomer
iOS Development - Offline Class for Jasakomer
 
Android crash course
Android crash courseAndroid crash course
Android crash course
 
Solid OOPS
Solid OOPSSolid OOPS
Solid OOPS
 
OOP, API Design and MVP
OOP, API Design and MVPOOP, API Design and MVP
OOP, API Design and MVP
 
Building Buzzword (Flex Camp Boston 2007)
Building Buzzword (Flex Camp Boston 2007)Building Buzzword (Flex Camp Boston 2007)
Building Buzzword (Flex Camp Boston 2007)
 

Mais de Jorge Ortiz

Mais de Jorge Ortiz (20)

Unit Test your Views
Unit Test your ViewsUnit Test your Views
Unit Test your Views
 
Control your Voice like a Bene Gesserit
Control your Voice like a Bene GesseritControl your Voice like a Bene Gesserit
Control your Voice like a Bene Gesserit
 
Kata gilded rose en Golang
Kata gilded rose en GolangKata gilded rose en Golang
Kata gilded rose en Golang
 
CYA: Cover Your App
CYA: Cover Your AppCYA: Cover Your App
CYA: Cover Your App
 
Refactor your way forward
Refactor your way forwardRefactor your way forward
Refactor your way forward
 
201710 Fly Me to the View - iOS Conf SG
201710 Fly Me to the View - iOS Conf SG201710 Fly Me to the View - iOS Conf SG
201710 Fly Me to the View - iOS Conf SG
 
Home Improvement: Architecture & Kotlin
Home Improvement: Architecture & KotlinHome Improvement: Architecture & Kotlin
Home Improvement: Architecture & Kotlin
 
Architectural superpowers
Architectural superpowersArchitectural superpowers
Architectural superpowers
 
Architecting Alive Apps
Architecting Alive AppsArchitecting Alive Apps
Architecting Alive Apps
 
iOS advanced architecture workshop 3h edition
iOS advanced architecture workshop 3h editioniOS advanced architecture workshop 3h edition
iOS advanced architecture workshop 3h edition
 
Android clean architecture workshop 3h edition
Android clean architecture workshop 3h editionAndroid clean architecture workshop 3h edition
Android clean architecture workshop 3h edition
 
To Protect & To Serve
To Protect & To ServeTo Protect & To Serve
To Protect & To Serve
 
Clean architecture workshop
Clean architecture workshopClean architecture workshop
Clean architecture workshop
 
Escape from Mars
Escape from MarsEscape from Mars
Escape from Mars
 
Why the Dark Side should use Swift and a SOLID Architecture
Why the Dark Side should use Swift and a SOLID ArchitectureWhy the Dark Side should use Swift and a SOLID Architecture
Why the Dark Side should use Swift and a SOLID Architecture
 
Dependence day insurgence
Dependence day insurgenceDependence day insurgence
Dependence day insurgence
 
Architectural superpowers
Architectural superpowersArchitectural superpowers
Architectural superpowers
 
TDD for the masses
TDD for the massesTDD for the masses
TDD for the masses
 
7 Stages of Unit Testing in iOS
7 Stages of Unit Testing in iOS7 Stages of Unit Testing in iOS
7 Stages of Unit Testing in iOS
 
Building for perfection
Building for perfectionBuilding for perfection
Building for perfection
 

Último

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 

Último (20)

UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 

Tell Me Quando - Implementing Feature Flags

  • 1. Jorge D. Ortiz Fuentes Mobile Developer Advocate, MongoDB WELCOME Implementing Feature Flags Tell Me Quando
  • 2. Agenda What are Feature Flags? Why using Feature Flags? Implementing Feature Flags Three Common Scenarios Recap
  • 3. What are Feature Flags? Why using them?
  • 4. A set of constants that hide or expose functionality while it is on development
  • 5. It is all about features Feature: a characteristic of your product (has/is) User Story: a feature from the perspective of the end-user Display list of items Receive notifications about data changes Add a new item to the list Persist data locally New look and feel Sync with other devices Animations and eye-candy …
  • 7. Let s Code Then! git branch
  • 9. It is all about branching Git Flow: • Main, develop, feature, release, hot-fix… • Long-lived branches • Feature code reviews GitHub Flow: • Main & feature branches • Long-lived branches still possible • Feature code reviews (Scaled) Trunk-Based Development: • Trunk/main, releases • Daily/very frequent • Smaller code reviews (WIP)
  • 10. Why not JUST Coding? Features need time and most likely several steps to complete adding the required code Fixes might be needed while developing the feature Some features get discarded after being implemented Even if they get accepted, they may require • Some process and • Waiting for the next version You need to address your different target audiences: your tests, QA, beta tester production
  • 11. One Codebase to Rule them all
  • 13. Make Simple Things Simple #if THIS_ENABLED { // New code #else // Previous behavior implementation, if any #endif
  • 14. Put the logic in the code Different configuration ≠ Feature flags Use booleans instead of configuration
  • 15. But where do I set those flags?
  • 16. Requirements for the Flag Variables • Produce different builds for the different audiences from the same codebase • A feature starts being developed in alpha and it is disabled for any other build • It is enabled for the next stage when the previous stage is completed
  • 17. Building with Xcode List of files (code & resources) to generate a product Target A set of settings applied to targets Build Configurations Defines actions combining target and configuration Scheme SWIFT_ACTIVE_COMPILATION_CONDITIONS
  • 18. Evolution of a Feature Flag Release Beta QA Alpha Release Debug ❌ ✅ ❌ ❌ Development Clean up ➖ Internal test ✅ ❌ ❌ ✅ External test ✅ ❌ ✅ ✅ Release ✅ ✅ ✅ ✅ ➖ ➖ ➖
  • 19. Xcode Trickery Don’t use targets to have different files for the flags Use build configurations for each development stage Use xcconfig files for each stage, to enable the flags and use include for other settings Configurations can be tuned exposing 
 $(CONFIGURATION) in Info.plist Use Product Bundle Identifier if you want more than one version running on the same device
  • 21. Static vs Dynamic Static • Removes unused code • Fully controlled by development • Defined in the project Dynamic • All code paths are in the binary • Behavior can be changed without rebuilding • Controlled from elsewhere
  • 23. Three Common Scenarios Change some logic or how a layer is implemented Logic or layer impl. Change color, text, position, but keep the “same” UI structure Minor View Change Increase or reduce the number of views used to interact with the user Mayor View Change
  • 24. Let s Code Together CODE REPOSITORY AVAILABLE LATER
  • 26. Minor UI Change struct MoodButton: View { let mood: Mood var body: some View { Text(String("(mood)")) .font(Font.system(size: 40)) .padding() #if NEW_UI .background(Color.red) #else .background(Color.accentColor) #endif .cornerRadius(10) } }
  • 27. Major UI Change @main struct MoodLoggerApp: App { var body: some Scene { WindowGroup { NavigationView { #if NEW_UI NewEntriesListView(viewModel: NewEntriesListViewModel(repository: InMemoryEntryRepository())) #else EntriesListView(viewModel: EntriesListViewModel(repository: InMemoryEntryRepository())) #endif } } } }
  • 28. Do I Need to have Tests in Place? No! You don’t need to But it does help a lot Love your future self and your team HINT
  • 29. How do the tests change? Test your old code: feature flag disabled Test your new code: feature flag enabled
  • 30. Recap
  • 31. Summary Feature flags allow to be agile • Evolve your code without causing disruptions • Change priorities on the fly • Tune up deployment Implementation is easy • Build configurations • xcconfig for each of the configuration • If expression to choose between old and new implementation Use feature flags not just for domain logic, but alternative implementations, and different UIs
  • 33. Q&A