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

Feature Flag Best Practices - A case study of LINE Android

Feature Flag Best Practices - A case study of LINE Android

LINE DevDay 2020

November 26, 2020
Tweet

More Decks by LINE DevDay 2020

Other Decks in Technology

Transcript

  1. Agenda › What is Feature Flag-based development? › Best Practice

    1: Change logic with Feature Flag › Best Practice 2: Guard the only entry point
  2. Agenda › What is Feature Flag-based development? › Best Practice

    1: Change logic with Feature Flag › Best Practice 2: Guard the only entry point
  3. Feature Flag Achieves > Instant toggling > Smoother release schedule

    management > Conflict minimization > Better collaboration with stakeholders
  4. Feature Flag Achieves > Instant toggling > Smoother release schedule

    management > Conflict minimization > Better collaboration with stakeholders
  5. Agenda › What is Feature Flag-based development? › Best Practice

    1: Change logic with Feature Flag › Best Practice 2: Guard the only entry point
  6. Structure of Image File Managers > Scattered logics UseCase ImageFilePathUtil

    StorageUtil ImageUtil Depends on ImageFileManager BaseFileManager
  7. BaseFileManager Structure of Image File Managers > Scattered logics UseCase

    ImageFilePathUtil StorageUtil ImageUtil ImageFileManager Depends on OldFileManager
  8. Structure of Image File Managers > New logics applied one

    by one UseCase NewFileManager ✗ ✗ ✗ OldFileManager
  9. ✗ ✗ ✗ NewFileManager OldFileManager Structure of Image File Managers

    > New logics applied one by one UseCase No Feature Flag to toggle
  10. Problem: Hard to Revert > Critical if many bugs reported

    Main branch Problematic PR Dependency Revert Conflict ! Another PR
  11. Best Practice: Change Logic with Feature Flag UseCase OldFileManager NewFileManager

    val FEATURE_REFACTORING = true Change Reference val FEATURE_REFACTORING = false
  12. Agenda › What is Feature Flag-based development? › Best Practice

    1: Change Logic with Feature Flag › Best Practice 2: Guard the only entry point
  13. Code Using Feature Flag // Application initialization function fun onCreate()

    { // The other initialization codes if (FeatureFlag.HOME_TAB_RECOMMENDATION) { val periodicSyncRequest: WorkRequest = … WorkManager.getInstance(…).enqueue(periodicSyncRequest) } }
  14. MessageListViewAdapter Best Practice: Guard the Only Entry Point MessageListActivity MessageListAdapterInterface

    MessageRecyclerViewAdapter val RECYCLER_VIEW_REPLACEMENT = false val RECYCLER_VIEW_REPLACEMENT = true Change Implementation
  15. Code Using Feature Flag val adapter = if (FeatureFlag.RECYCLER_VIEW_REPLACEMENT) {

    MessageRecyclerViewAdapter(…) } else { MessageListViewAdapter(…) } setAdapter(adapter)
  16. > Minimize reverting cost with instant toggling Summary > Find

    a single entry point for easiest application