Slide 1

Slide 1 text

Pete Hodgson OSCON Aus1n 2017 FEATURE TOGGLES a journey into

Slide 2

Slide 2 text

@ph1 #oscon Let me
 tell you
 a story

Slide 3

Slide 3 text

@ph1 #oscon Boy, that merge conflict we ran into sure was painful “

Slide 4

Slide 4 text

@ph1 #oscon master ! Sam's feature branch Jesse’s feature branch merge bomb based on: martinfowler.com/bliki/FeatureBranch.html

Slide 5

Slide 5 text

@ph1 #oscon avoiding the
 merge bombs

Slide 6

Slide 6 text

@ph1 #oscon Product Details Buy Related Products

Slide 7

Slide 7 text

@ph1 #oscon function relatedProducts(product){ // current implementation lives here }

Slide 8

Slide 8 text

@ph1 #oscon function old_relatedProducts(product){ // current implementation lives here } function new_relatedProducts(product){ // TODO: write a better // related products algorithm }

Slide 9

Slide 9 text

@ph1 #oscon function relatedProducts(product){ var useNewAlgorithm = false; if( useNewAlgorithm ){ return new_relatedProducts(product); }else{ return old_relatedProducts(product); } } function old_relatedProducts(product){ // current implementation lives here } function new_relatedProducts(product){ // TODO: write a better // related products algorithm }

Slide 10

Slide 10 text

@ph1 #oscon exis1ng implementa1on client

Slide 11

Slide 11 text

@ph1 #oscon exis1ng implementa1on new implementa1on client

Slide 12

Slide 12 text

@ph1 #oscon exis1ng implementa1on client half-finished new implementa1on

Slide 13

Slide 13 text

@ph1 #oscon exis1ng implementa1on client half-finished new implementa1on

Slide 14

Slide 14 text

@ph1 #oscon exis1ng implementa1on client half-finished new implementa1on

Slide 15

Slide 15 text

@ph1 #oscon exis1ng implementa1on client half-finished new implementa1on

Slide 16

Slide 16 text

@ph1 #oscon function relatedProducts(product){ var useNewAlgorithm = false; if( useNewAlgorithm ){ return new_relatedProducts(product); }else{ return old_relatedProducts(product); } } function old_relatedProducts(product){ // current implementation lives here } function new_relatedProducts(product){ // TODO: write a better // related products algorithm }

Slide 17

Slide 17 text

@ph1 #oscon function relatedProducts(product){ var useNewAlgorithm = false; if( useNewAlgorithm ){ return new_relatedProducts(product); }else{ return old_relatedProducts(product); } } function old_relatedProducts(product){ // current implementation lives here } function new_relatedProducts(product){ // TODO: write a better // related products algorithm } true;

Slide 18

Slide 18 text

@ph1 #oscon let’s get dynamic

Slide 19

Slide 19 text

@ph1 #oscon function relatedProducts(product){ var useNewAlgorithm = false; if( useNewAlgorithm ){ return new_relatedProducts(product); }else{ return old_relatedProducts(product); } }

Slide 20

Slide 20 text

@ph1 #oscon function relatedProducts(product){ if( featureEnabled(“use-new-related-products-algo”) ){ return new_relatedProducts(product); }else{ return old_relatedProducts(product); } }

Slide 21

Slide 21 text

@ph1 #oscon exis1ng implementa1on new implementa1on client

Slide 22

Slide 22 text

@ph1 #oscon exis1ng implementa1on new implementa1on client

Slide 23

Slide 23 text

@ph1 #oscon FEATURE TOGGLES

Slide 24

Slide 24 text

@ph1 #oscon FEATURE TOGGLES a journey into

Slide 25

Slide 25 text

@ph1 #oscon FLAGS BITS FLIPPERS FEATURE TOGGLES

Slide 26

Slide 26 text

@ph1 #oscon decoupling deployment from release

Slide 27

Slide 27 text

@ph1 #oscon it starts with
 merge conflicts

Slide 28

Slide 28 text

@ph1 #oscon back to
 the story...

Slide 29

Slide 29 text

@ph1 #oscon Canary
 Releases A/B Tests Kill Switches Beta Testers Premium
 Features

Slide 30

Slide 30 text

@ph1 #oscon 1me out!

Slide 31

Slide 31 text

@ph1 #oscon you keep using that word…

Slide 32

Slide 32 text

@ph1 #oscon choosing code paths at runLme

Slide 33

Slide 33 text

@ph1 #oscon client

Slide 34

Slide 34 text

@ph1 #oscon client

Slide 35

Slide 35 text

@ph1 #oscon treat different toggles differently

Slide 36

Slide 36 text

@ph1 #oscon Ops Toggles Permission Toggles Release Toggles Experiment Toggles

Slide 37

Slide 37 text

@ph1 #oscon longevity release toggles
 are around for days permissions toggles
 are around for years

Slide 38

Slide 38 text

@ph1 #oscon dynamism release toggles
 vary per deployment experiment toggles
 vary per request

Slide 39

Slide 39 text

@ph1 #oscon ownership release toggles ops toggles permission toggles experiment toggles owned by devs owned by ops owned by product

Slide 40

Slide 40 text

@ph1 #oscon toggle longevity

Slide 41

Slide 41 text

@ph1 #oscon function relatedProducts(product){ if( featureEnabled(“use-new-related-products-algo”) ){ return new_relatedProducts(product); }else{ return old_relatedProducts(product); } }

Slide 42

Slide 42 text

@ph1 #oscon if( featureEnabled(“use-new-related-products-algo”) ){ // do X }else{ // do Y } if( featureEnabled(“use-new-related-products-algo”) ){ // do X }else{ // do Y } if( featureEnabled(“use-new-related-products-algo”) ){ // do X }else{ // do Y } if( featureEnabled(“use-new-related-products-algo”) ){ // do X }else{ // do Y }

Slide 43

Slide 43 text

@ph1 #oscon toggle dynamism

Slide 44

Slide 44 text

@ph1 #oscon Product Details Buy Related Products

Slide 45

Slide 45 text

@ph1 #oscon Product Details BUY!

Slide 46

Slide 46 text

@ph1 #oscon function renderProductDetailsPage(){ if( featureEnabled(“show-related-products”) ){ renderProductDetailsSection({renderBuyButton:true}); renderRelatedProductSection(); }else{ renderProductDetailsSection({renderBuyButton:false}); renderReallyBigBuyButton(); } }

Slide 47

Slide 47 text

@ph1 #oscon function renderProductDetailsPage(){ if( featureEnabled(“show-related-products”) ){ renderProductDetailsSection({renderBuyButton:true}); renderRelatedProductSection(); }else{ renderProductDetailsSection({renderBuyButton:false}); renderReallyBigBuyButton(); } } function renderProductDetailsPage(){ if( featureEnabled(“show-related-products”,request) ){ renderProductDetailsSection({renderBuyButton:true}); renderRelatedProductSection(); }else{ renderProductDetailsSection({renderBuyButton:false}); renderReallyBigBuyButton(); } }

Slide 48

Slide 48 text

@ph1 #oscon toggle configuraLon sta1c dynamic

Slide 49

Slide 49 text

@ph1 #oscon toggle configuraLon Hard-coded
 in source config baked
 into deployment parameterized
 config config in
 the app DB distributed config
 (e.g. Consul, ZooKeeper) sta1c dynamic

Slide 50

Slide 50 text

@ph1 #oscon ? sta1c dynamic

Slide 51

Slide 51 text

@ph1 #oscon make toggle
 configuraLon observable

Slide 52

Slide 52 text

@ph1 #oscon allow overriding configuraLon for tesLng

Slide 53

Slide 53 text

@ph1 #oscon advice from the trenches

Slide 54

Slide 54 text

@ph1 #oscon toggles aren’t free

Slide 55

Slide 55 text

@ph1 #oscon tesLng toggled code
 isn’t easy

Slide 56

Slide 56 text

@ph1 #oscon toggles help you 
 go faster

Slide 57

Slide 57 text

FEATURE TOGGLES your journey into @ph1 #oscon

Slide 58

Slide 58 text

@ph1 #oscon @ph1 thepete.net mar1nfowler.com/ar1cles/feature-toggles.html thanks!