Slide 1

Slide 1 text

2019 DevDay Journey of Feature Flag Development in LINE Android > Hidetsugu Tamaki > LINE App Dev Team3 Software Engineer

Slide 2

Slide 2 text

> LINE Android development Hidetsugu Tamaki Introduction > Apr. 2018 ~

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

Feature Branch Main branch

Slide 6

Slide 6 text

Feature Branch Main branch Feature branch

Slide 7

Slide 7 text

Feature Branch Main branch Feature branch Pull requests

Slide 8

Slide 8 text

Feature Branch Main branch Feature branch Pull requests

Slide 9

Slide 9 text

LINE Android Project Developers 100 Changes per week in LoC 20,000

Slide 10

Slide 10 text

Feature Branches in Large Applications Main branch Feature branches

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

Feature Flag Strategy Main branch Sticker feature PRs

Slide 13

Slide 13 text

Feature Flag Strategy Main branch Sticker feature PRs

Slide 14

Slide 14 text

Feature Flag Strategy Main branch Sticker feature PRs

Slide 15

Slide 15 text

Feature Flag Usage > View visibility . .

Slide 16

Slide 16 text

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 = )( ( ,(

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

Conflict Minimization Main branch Sticker feature PRs

Slide 20

Slide 20 text

Conflict Minimization Main branch Sticker feature PRs Theme feature PRs

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

Smoother Release Schedule Management Main branch Sticker feature PRs

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

Smoother Release Schedule Management Main branch Release branches 1.0 2.0 Sticker feature PRs

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

Instant Toggling Main branch Release branch 1.0 Sticker feature PR

Slide 32

Slide 32 text

✗ Instant Toggling Main branch Release branch 1.0 Critical issue Sticker feature PR

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

Better Collaboration with Stakeholders Developer Planner Tester Designer Organization

Slide 38

Slide 38 text

Better Collaboration with Stakeholders Developer Planner Tester Designer Users Partners Organization

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

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

Slide 41

Slide 41 text

Limitation of Feature Flags Not a “silver bullet” > Difficult to apply > Updating libraries > Overkill > Prototyping

Slide 42

Slide 42 text

Reference https://youtu.be/H81EEAZ4XAI Presented at DroidKaigi 2019 https://speakerdeck.com/line_developers/flag-based-feature-management

Slide 43

Slide 43 text

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

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

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

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

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

Slide 48

Slide 48 text

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

Slide 49

Slide 49 text

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

Slide 50

Slide 50 text

Module Structure of LINE Android line-android-app submodule-sticker Product Flavor Product Flavor dev, beta, rc, release debug, release

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

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

Slide 54

Slide 54 text

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

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

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

Slide 60

Slide 60 text

Workaround for Wrong Flag Values Simplified references by extracting Feature Flags into a module

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

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

Slide 63

Slide 63 text

Workaround for Wrong Flag Values BuildConfig.java BuildConfig.java Injects values into Injects values into package com.linecorp.line package com.linecorp.sticker

Slide 64

Slide 64 text

Workaround for Wrong Flag Values FeatureFlag.java FeatureFlag.java Creates Creates package com.linecorp.line package com.linecorp.line

Slide 65

Slide 65 text

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

Slide 66

Slide 66 text

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

Slide 67

Slide 67 text

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

Slide 68

Slide 68 text

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

Slide 69

Slide 69 text

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

Slide 70

Slide 70 text

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

Slide 71

Slide 71 text

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

Slide 72

Slide 72 text

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

Slide 73

Slide 73 text

Proper Solution Isolated dependencies by processing flags within modules

Slide 74

Slide 74 text

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

Slide 75

Slide 75 text

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

Slide 76

Slide 76 text

Flag Property File Product Flavor Proper Solution debug, release

Slide 77

Slide 77 text

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

Slide 78

Slide 78 text

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

Slide 79

Slide 79 text

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

Slide 80

Slide 80 text

Link to Submodule Flag Values &, - B = B A: &, - &, - line-android-app submodule-sticker

Slide 81

Slide 81 text

)& ) ,) () CC )-)& ) = A: )& ) ,) -& ) Property Parsing: Format )& ) ,) () )-)& ) = A: )& ) ,) -& ) > Written with “disjunctive normal form” style property

Slide 82

Slide 82 text

Property Parsing: Phase > Enabled if build variant is Phase Phase > Enabled if build variant is

Slide 83

Slide 83 text

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

Slide 84

Slide 84 text

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

Slide 85

Slide 85 text

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

Slide 86

Slide 86 text

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

Slide 87

Slide 87 text

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 = )& ) )

Slide 88

Slide 88 text

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 = )& ) )

Slide 89

Slide 89 text

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 = )& ) )

Slide 90

Slide 90 text

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 = )& ) )

Slide 91

Slide 91 text

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 = )& ) )

Slide 92

Slide 92 text

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

Slide 93

Slide 93 text

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

Slide 94

Slide 94 text

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

Slide 95

Slide 95 text

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

Slide 96

Slide 96 text

Available Today > https://github.com/line/feature-flag-android

Slide 97

Slide 97 text

Summary > Solved pain points of feature branches with feature flags > Gradle plugin for Android is now available

Slide 98

Slide 98 text

Thank You