SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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
 

Similaire à 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)
 

Plus de Jorge Ortiz

Plus 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
 

Dernier

Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
BalamuruganV28
 
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
Madan Karki
 

Dernier (20)

The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
The battle for RAG, explore the pros and cons of using KnowledgeGraphs and Ve...
 
Operating System chapter 9 (Virtual Memory)
Operating System chapter 9 (Virtual Memory)Operating System chapter 9 (Virtual Memory)
Operating System chapter 9 (Virtual Memory)
 
Quiz application system project report..pdf
Quiz application system project report..pdfQuiz application system project report..pdf
Quiz application system project report..pdf
 
Online book store management system project.pdf
Online book store management system project.pdfOnline book store management system project.pdf
Online book store management system project.pdf
 
Raashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashid final report on Embedded Systems
Raashid final report on Embedded Systems
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
 
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
Fabrication Of Automatic Star Delta Starter Using Relay And GSM Module By Utk...
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdf
 
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
NEWLETTER FRANCE HELICES/ SDS SURFACE DRIVES - MAY 2024
 
"United Nations Park" Site Visit Report.
"United Nations Park" Site  Visit Report."United Nations Park" Site  Visit Report.
"United Nations Park" Site Visit Report.
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
Theory for How to calculation capacitor bank
Theory for How to calculation capacitor bankTheory for How to calculation capacitor bank
Theory for How to calculation capacitor bank
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docx
 
AI in Healthcare Innovative use cases and applications.pdf
AI in Healthcare Innovative use cases and applications.pdfAI in Healthcare Innovative use cases and applications.pdf
AI in Healthcare Innovative use cases and applications.pdf
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
 
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdfALCOHOL PRODUCTION- Beer Brewing Process.pdf
ALCOHOL PRODUCTION- Beer Brewing Process.pdf
 
Insurance management system project report.pdf
Insurance management system project report.pdfInsurance management system project report.pdf
Insurance management system project report.pdf
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
Multivibrator and its types defination and usges.pptx
Multivibrator and its types defination and usges.pptxMultivibrator and its types defination and usges.pptx
Multivibrator and its types defination and usges.pptx
 
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message QueuesLinux Systems Programming: Semaphores, Shared Memory, and Message Queues
Linux Systems Programming: Semaphores, Shared Memory, and Message Queues
 

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