Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ship Faster With Feature Flags

David Odari
November 18, 2022

Ship Faster With Feature Flags

You've been working long and hard on this feature and your humongous PR is up, your code review takes days and the QA process spots one or two bugs you have to fix. You finally fix the issues and are ready to deploy to PlayStore, but that may be another 1 or 2 days (depending) and the app is out. Over a week has gone by trying to ship this feature, but what if we could cut down that time and ship faster with more confidence? Enter feature flags. I will share my learnings about feature flags from previous projects, how they quicken the development process, how you could start making use of them and some things to watch out for when using them.

David Odari

November 18, 2022
Tweet

More Decks by David Odari

Other Decks in Programming

Transcript

  1. Who is this guy? - Software Engineer @Flink - Android

    GDE - Twitter Noisemaker @_davidodari - My family's’ IT guy
  2. Scenarios 📽 “One of my most productive days was throwing

    away 1,000 lines of code.” by Ken Thompson.
  3. “Software technique that enables you to make changes to code

    during runtime without additional code changes”
  4. How do we get them in(Basic) 1. Have a simple

    json file. 2. Load up the json file configurations. 3. React to changes made in json file.
  5. STEP 2: Load up the json config val features =

    FeatureFlagsService.createFeaturesService().getFeatures() for (feature in features.record.flags){ if(feature.key == "red_button_color" && feature. enabled){ val dummyBtn = findViewById<Button>(R.id. dummyBtn) dummyBtn.setBackgroundColor(Color. RED) } }
  6. PROS CONS - Fast Setup - Good for basic use

    cases - Think about hosting json - Easy to introduce breaking changes - No connection to analytics - Handle cache logic - Has no form of documentation
  7. PROS CONS - Custom setup built for the business needs

    - Can configure audiences(depends) - Could have some form of documentation - More maintenance work
  8. How do we get them in 1. Follow integration guide

    2. Use SDK as per stated in the API guide
  9. STEP 2: USE SDK val remoteConfig: FirebaseRemoteConfig = Firebase.remoteConfig val

    configSettings = remoteConfigSettings { minimumFetchIntervalInSeconds = 3600 } remoteConfig.setConfigSettingsAsync(configSettings)
  10. STEP 2: USE SDK remoteConfig.fetchAndActivate() .addOnCompleteListener(this) { task -> if

    (task.isSuccessful) { val updated = task.result Log.d(TAG, "Config params updated: $updated") Toast.makeText(this, "Fetch and activate succeeded", Toast.LENGTH_SHORT).show() } else { Toast.makeText(this, "Fetch failed", Toast.LENGTH_SHORT).show() } displayWelcomeMessage() }
  11. STEP 2: USE SDK Use available methods on remote config

    object • getBoolean() • getDouble() • getLong() • getString()
  12. PROS CONS - Can configure audiences - Maintained by other

    teams and you can focus on business logic - Has edge cases you haven’t thought of yet and might be useful - Can be connected to analytics tools and build on A/B testing - Has documentation that is maintained - Caching strategies in place - Not fully custom to your needs or could be abit restrictive - Might be pricy
  13. General gotchas - Requires a restart of the app to

    propagate changes. - Testing paths will have to cater for both scenarios. - Keeping track of feature flags and cleanup.At what point do you qualify the flag. - Can be a bit unclear whether or not to include features behind flags in your release notes, especially if everyone isn’t getting it.
  14. Interesting use cases - Large refactoring tasks not just product

    related tasks - Depending on tooling support, can stand in for backend.* - Client didn’t pay 😉
  15. References - Json Bin: Json Hosting - Firebase: Remote Config

    - Launch Darkly - Optimizely - Remote config codelab
  16. QnA