$30 off During Our Annual Pro Sale. View Details »

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. Ship Faster with feature flags 🚀🚩 #droidconKE2022

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

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

    away 1,000 lines of code.” by Ken Thompson.
  4. “This New Law affects us we need to change things

    before we get fined.”
  5. Possible solutions - Force update all users 🥶

  6. Enter feature flags

  7. What are they? 🤔

  8. “Software technique that enables you to make changes to code

    during runtime without additional code changes”
  9. Are we magicians now?🪄

  10. 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.
  11. STEP 1: Have A Simple Json file

  12. STEP 1: Have A Simple Json file:HOSTING

  13. 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) } }
  14. STEP 3: React to changes to the json

  15. That’s it right?😎

  16. 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
  17. Inhouse or 3rd party #droidconKE22

  18. INHOUSE 🏠

  19. PROS CONS - Custom setup built for the business needs

    - Can configure audiences(depends) - Could have some form of documentation - More maintenance work
  20. 3RD PARTY 🤝

  21. Some Examples

  22. Some Examples

  23. Some Examples

  24. Some Examples

  25. How do we get them in 1. Follow integration guide

    2. Use SDK as per stated in the API guide
  26. STEP 1: follow integration guide(FIREBASE)

  27. STEP 1: follow integration guide

  28. STEP 2: USE SDK val remoteConfig: FirebaseRemoteConfig = Firebase.remoteConfig val

    configSettings = remoteConfigSettings { minimumFetchIntervalInSeconds = 3600 } remoteConfig.setConfigSettingsAsync(configSettings)
  29. 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() }
  30. STEP 2: USE SDK Use available methods on remote config

    object • getBoolean() • getDouble() • getLong() • getString()
  31. 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
  32. General Benefits - Review PRs with more confidence - Reduce

    need for force updates
  33. 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.
  34. Interesting use cases

  35. Interesting use cases - Large refactoring tasks not just product

    related tasks - Depending on tooling support, can stand in for backend.* - Client didn’t pay 😉
  36. Feature Flags vs A/B TESTING VS PRODUCT FLAVORS

  37. References - Json Bin: Json Hosting - Firebase: Remote Config

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

  39. Thanks for coming