Journey of Feature Flag development in LINE Android

Journey of Feature Flag development in LINE Android

Hidetsugu Tamaki
LINE App Dev Team3 Software Engineer
https://linedevday.linecorp.com/jp/2019/sessions/D2-4

Be4518b119b8eb017625e0ead20f8fe7?s=128

LINE DevDay 2019

November 21, 2019
Tweet

Transcript

  1. 2019 DevDay Journey of Feature Flag Development in LINE Android

    > Hidetsugu Tamaki > LINE App Dev Team3 Software Engineer
  2. > LINE Android development Hidetsugu Tamaki Introduction > Apr. 2018

    ~
  3. Agenda > Pain Points of Feature Branches > Benefits of

    Feature Flags > History of Feature Flags in LINE Android
  4. Agenda > Pain Points of Feature Branches > Benefits of

    Feature Flags > History of Feature Flags in LINE Android
  5. Feature Branch Main branch

  6. Feature Branch Main branch Feature branch

  7. Feature Branch Main branch Feature branch Pull requests

  8. Feature Branch Main branch Feature branch Pull requests

  9. LINE Android Project Developers 100 Changes per week in LoC

    20,000
  10. Feature Branches in Large Applications Main branch Feature branches

  11. Agenda > Pain Points of Feature Branches > Benefits of

    Feature Flags > History of Feature Flag in LINE Android
  12. Feature Flag Strategy Main branch Sticker feature PRs

  13. Feature Flag Strategy Main branch Sticker feature PRs

  14. Feature Flag Strategy Main branch Sticker feature PRs

  15. Feature Flag Usage > View visibility . .

  16. Feature Flag Usage > Activity I B CG CG )

    G E )B = .( . ((. L CG CG G F . = C G I GK B FF I BF L CG CG G F B: = C G I GK B FF I > View visibility FG A E GG C F F B ) G E )B = )( ( ,(
  17. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  18. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  19. Conflict Minimization Main branch Sticker feature PRs

  20. Conflict Minimization Main branch Sticker feature PRs Theme feature PRs

  21. Conflict Minimization Main branch Sticker feature PRs Theme feature PRs

    Saved PRs Saved PRs
  22. Conflict Minimization Main branch Sticker feature PRs Theme feature PRs

    Conflict Saved PRs Saved PRs
  23. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  24. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  25. Smoother Release Schedule Management Main branch Sticker feature PRs

  26. Smoother Release Schedule Management Main branch Release branches 1.0 Sticker

    feature PRs
  27. Smoother Release Schedule Management Main branch Release branches 1.0 Sticker

    feature PRs
  28. Smoother Release Schedule Management Main branch Release branches 1.0 2.0

    Sticker feature PRs
  29. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  30. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  31. Instant Toggling Main branch Release branch 1.0 Sticker feature PR

  32. ✗ Instant Toggling Main branch Release branch 1.0 Critical issue

    Sticker feature PR
  33. Instant Toggling Main branch Release branch 1.0 Critical issue Sticker

    feature PR Conflicting PR ✗
  34. ✗ Instant Toggling Main branch Release branch 1.0 Critical issue

    Conflicting PR Sticker feature PR
  35. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  36. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  37. Better Collaboration with Stakeholders Developer Planner Tester Designer Organization

  38. Better Collaboration with Stakeholders Developer Planner Tester Designer Users Partners

    Organization
  39. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  40. Feature Flags Achieve > Conflict minimization > Smoother release schedule

    management > Instant toggling > Better collaboration with stakeholders
  41. Limitation of Feature Flags Not a “silver bullet” > Difficult

    to apply > Updating libraries > Overkill > Prototyping
  42. Reference https://youtu.be/H81EEAZ4XAI Presented at DroidKaigi 2019 https://speakerdeck.com/line_developers/flag-based-feature-management

  43. Agenda > Pain Points of Feature Branches > Benefits of

    Feature Flags > History of Feature Flags in LINE Android
  44. Feature Flags in LINE Android > Started with a simple

    Gradle script (Dec. 2015) > Injects values into BuildConfig file > Loads values from a property file
  45. Feature Flags in LINE Android > Started with a simple

    Gradle script (Dec. 2015) > Injects values into BuildConfig file A A A C= # . " A A A C= # " #. > Loads values from a property file
  46. Feature Flags in LINE Android > Started with a simple

    Gradle script (Dec. 2015) > Injects values into BuildConfig file > Loads values from a property file
  47. > Toggle flag by user name or app version >

    Toggle flag at runtime > Support Gradle submodule Growth of Feature Flags
  48. > Toggle flag by user name or app version >

    Toggle flag at runtime > Support Gradle submodule Growth of Feature Flags
  49. Module Structure of LINE Android line-android-app submodule-sticker Product Flavor Product

    Flavor   
  50. Module Structure of LINE Android line-android-app submodule-sticker Product Flavor Product

    Flavor    dev, beta, rc, release debug, release
  51. Initial Feature Flags Implementation line-android-app FeatureFlag script Flag Property File

    Product Flavor Refers to Product Flavor submodule-sticker   
  52. Initial Feature Flags Implementation line-android-app FeatureFlag script Flag Property File

    Product Flavor BuildConfig.java Injects values into Product Flavor submodule-sticker Refers to   
  53. Misused Feature Flags in Submodules line-android-app FeatureFlag script Flag Property

    File Product Flavor BuildConfig.java FeatureFlag script Product Flavor BuildConfig.java submodule-sticker Refers to Injects values into Refers to Injects values into   
  54. Misused Feature Flags in Submodules line-android-app FeatureFlag script Flag Property

    File Product Flavor BuildConfig.java FeatureFlag script Product Flavor BuildConfig.java submodule-sticker Back reference    Refers to Injects values into Refers to Injects values into
  55. Misused Feature Flags in Submodules line-android-app FeatureFlag script Flag Property

    File Product Flavor BuildConfig.java FeatureFlag script Product Flavor BuildConfig.java dev, beta, rc, release debug, release submodule-sticker Back reference    Refers to Injects values into Refers to Injects values into
  56. Misused Feature Flags in Submodules line-android-app FeatureFlag script Flag Property

    File Product Flavor BuildConfig.java FeatureFlag script Product Flavor BuildConfig.java dev, beta, rc, release debug, release submodule-sticker Back reference    Refers to Injects values into Refers to Injects values into
  57. Misused Feature Flags in Submodules line-android-app FeatureFlag script Flag Property

    File Product Flavor BuildConfig.java FeatureFlag script Product Flavor BuildConfig.java package com.linecorp.line package com.linecorp.sticker dev, beta, rc, release debug, release submodule-sticker Back reference    Refers to Injects values into Refers to Injects values into
  58. Problems of Misuse > Caused by BuildConfig.java and product flavors

    > Generated wrong values > Caused by back reference > Submodules were no longer standalone
  59. Problems of Misuse > Caused by BuildConfig.java and product flavors

    > Generated wrong values > Caused by back reference > Submodules were no longer standalone
  60. Workaround for Wrong Flag Values Simplified references by extracting Feature

    Flags into a module
  61. Workaround for Wrong Flag Values line-android-app FeatureFlag script Flag Property

    File Product Flavor BuildConfig.java FeatureFlag script Product Flavor BuildConfig.java submodule-sticker Back reference    Refers to Injects values into Refers to Injects values into
  62. Workaround for Wrong Flag Values line-android-app FeatureFlag script Flag Property

    File Product Flavor BuildConfig.java FeatureFlag script feature-flag BuildConfig.java Refers to submodule-sticker    Refers to Injects values into Injects values into
  63. Workaround for Wrong Flag Values BuildConfig.java BuildConfig.java Injects values into

    Injects values into package com.linecorp.line package com.linecorp.sticker
  64. Workaround for Wrong Flag Values FeatureFlag.java FeatureFlag.java Creates Creates package

    com.linecorp.line package com.linecorp.line
  65. Workaround for Wrong Flag Values line-android-app FeatureFlag script Flag Property

    File Product Flavor FeatureFlag.java FeatureFlag script feature-flag FeatureFlag.java Refers to submodule-sticker    Refers to Creates Creates
  66.    Workaround for Wrong Flag Values line-android-app FeatureFlag

    script Flag Property File Product Flavor FeatureFlag.java FeatureFlag script feature-flag FeatureFlag.java Refers to submodule-sticker      Refers to Creates Creates
  67. Workaround for Wrong Flag Values line-android-app FeatureFlag script Flag Property

    File Product Flavor FeatureFlag.java submodule-sticker    Refers to Creates
  68. Things Got Worse > Tricky usage of `  

     > Wrong dependencies still remain > Poor compatibility with automated testing
  69. Things Got Worse > Tricky usage of `  

     > Wrong dependencies still remain > Poor compatibility with automated testing
  70. Things Got Worse > Tricky usage of `  

     > Wrong dependencies still remain > Poor compatibility with automated testing
  71. Things Got Worse > Tricky usage of `  

     > Wrong dependencies still remain > Poor compatibility with automated testing
  72. Things Got Worse > Tricky usage of `  

     > Wrong dependencies still remain > Poor compatibility with automated testing
  73. Proper Solution Isolated dependencies by processing flags within modules

  74. Proper Solution line-android-app FeatureFlag script Flag Property File Product Flavor

    FeatureFlag.java submodule-sticker    Refers to Creates
  75. Proper Solution line-android-app FeatureFlag script Flag Property File Product Flavor

    FeatureFlag.java submodule-sticker    Refers to FeatureFlag script Flag Property File Product Flavor FeatureFlag.java Refers to Creates Creates
  76. Flag Property File Product Flavor Proper Solution debug, release

  77. FeatureFlag.java FeatureFlag.java Proper Solution package com.linecorp.line package com.linecorp.sticker

  78. Proper Solution line-android-app FeatureFlag script Flag Property File Product Flavor

    FeatureFlag.java submodule-sticker    Refers to FeatureFlag script Flag Property File Product Flavor FeatureFlag.java Refers to Links to Creates Creates
  79. Proper Solution line-android-app FeatureFlag script Flag Property File Product Flavor

    FeatureFlag.java submodule-sticker    Refers to FeatureFlag script Flag Property File Product Flavor FeatureFlag.java Refers to Links to Refers to Creates Creates
  80. Link to Submodule Flag Values &, - B = B

    A: &, - &, - line-android-app submodule-sticker
  81. )& ) ,) () CC )-)& ) = A: )&

    ) ,) -& ) Property Parsing: Format )& ) ,) () )-)& ) = A: )& ) ,) -& ) > Written with “disjunctive normal form” style property
  82. Property Parsing: Phase > Enabled if build variant is 

      Phase   Phase > Enabled if build variant is   
  83. Property Parsing: Value Calculation : E variant )( ( &

    ( ( ( ( ( CE A E : CD= : )( ( & ( - ( )( ( & ( D E: C: CE A E : CD= : )( ( & ( - ( F )( ( & ( D E: Optimization Phase resolution
  84. Property Parsing: Value Calculation : E variant )( ( &

    ( ( ( ( ( CE A E : CD= : )( ( & ( - ( )( ( & ( D E: C: CE A E : CD= : )( ( & ( - ( F )( ( & ( D E: Optimization Phase resolution
  85. Property Parsing: Value Calculation : E variant )( ( &

    ( ( ( ( ( CE A E : CD= : )( ( & ( - ( )( ( & ( D E: C: CE A E : CD= : )( ( & ( - ( F )( ( & ( D E: Optimization Phase resolution
  86. Property Parsing: Value Calculation : E variant )( ( &

    ( ( ( ( ( CE A E : CD= : )( ( & ( - ( )( ( & ( D E: C: CE A E : CD= : )( ( & ( - ( F )( ( & ( D E: Optimization Phase resolution
  87. Property Parsing: Value Calculation )& ) ) () )-)& )

    F AC: F E )& ) ) .-& ) )& ) ) F E F AC: F E )& ) ) .-& ) )& ) ) F AC: F E )& ) ) Optimization Variant resolution E F variant Package name extraction I )& ) ) CA CED F E E = )& ) )
  88. Property Parsing: Value Calculation )& ) ) () )-)& )

    F AC: F E )& ) ) .-& ) )& ) ) F E F AC: F E )& ) ) .-& ) )& ) ) F AC: F E )& ) ) Optimization Variant resolution E F variant Package name extraction I )& ) ) CA CED F E E = )& ) )
  89. Property Parsing: Value Calculation )& ) ) () )-)& )

    F AC: F E )& ) ) .-& ) )& ) ) F E F AC: F E )& ) ) .-& ) )& ) ) F AC: F E )& ) ) Optimization Variant resolution E F variant Package name extraction I )& ) ) CA CED F E E = )& ) )
  90. Property Parsing: Value Calculation )& ) ) () )-)& )

    F AC: F E )& ) ) .-& ) )& ) ) F E F AC: F E )& ) ) .-& ) )& ) ) F AC: F E )& ) ) Optimization Variant resolution E F variant Package name extraction I )& ) ) CA CED F E E = )& ) )
  91. Property Parsing: Value Calculation )& ) ) () )-)& )

    F AC: F E )& ) ) .-& ) )& ) ) F E F AC: F E )& ) ) .-& ) )& ) ) F AC: F E )& ) ) Optimization Variant resolution E F variant Package name extraction I )& ) ) CA CED F E E = )& ) )
  92. Results > Gradle plugin instead of script > Simplified dependencies

    > Correct feature flag values in submodules
  93. Results > Gradle plugin instead of script > Simplified dependencies

    > Correct feature flag values in submodules
  94. Results > Gradle plugin instead of script > Simplified dependencies

    > Correct feature flag values in submodules
  95. Results > Gradle plugin instead of script > Simplified dependencies

    > Correct feature flag values in submodules
  96. Available Today > https://github.com/line/feature-flag-android

  97. Summary > Solved pain points of feature branches with feature

    flags > Gradle plugin for Android is now available
  98. Thank You