A Journey Into Feature Toggles - OSCON Austin 2017

A Journey Into Feature Toggles - OSCON Austin 2017

Feature toggles (aka feature flags) are a set of patterns that enable dev teams to deliver features to users rapidly and safely. Pete Hodgson leads you on a journey with a dev team as they adopt feature toggles, covering what they are, why they're helpful, and how to use them successfully.

Fe6b81005d1553accd6b2a28f6a2bef1?s=128

Pete Hodgson

May 11, 2017
Tweet

Transcript

  1. Pete Hodgson OSCON Aus1n 2017 FEATURE TOGGLES a journey into

  2. @ph1 #oscon Let me
 tell you
 a story

  3. @ph1 #oscon Boy, that merge conflict we ran into sure

    was painful “
  4. @ph1 #oscon master ! Sam's feature branch Jesse’s feature branch

    merge bomb based on: martinfowler.com/bliki/FeatureBranch.html
  5. @ph1 #oscon avoiding the
 merge bombs

  6. @ph1 #oscon Product Details Buy Related Products

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

  8. @ph1 #oscon function old_relatedProducts(product){ // current implementation lives here }

    function new_relatedProducts(product){ // TODO: write a better // related products algorithm }
  9. @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 }
  10. @ph1 #oscon exis1ng implementa1on client

  11. @ph1 #oscon exis1ng implementa1on new implementa1on client

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

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

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

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

  16. @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 }
  17. @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;
  18. @ph1 #oscon let’s get dynamic

  19. @ph1 #oscon function relatedProducts(product){ var useNewAlgorithm = false; if( useNewAlgorithm

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

    return old_relatedProducts(product); } }
  21. @ph1 #oscon exis1ng implementa1on new implementa1on client

  22. @ph1 #oscon exis1ng implementa1on new implementa1on client

  23. @ph1 #oscon FEATURE TOGGLES

  24. @ph1 #oscon FEATURE TOGGLES a journey into

  25. @ph1 #oscon FLAGS BITS FLIPPERS FEATURE TOGGLES

  26. @ph1 #oscon decoupling deployment from release

  27. @ph1 #oscon it starts with
 merge conflicts

  28. @ph1 #oscon back to
 the story...

  29. @ph1 #oscon Canary
 Releases A/B Tests Kill Switches Beta Testers

    Premium
 Features
  30. @ph1 #oscon 1me out!

  31. @ph1 #oscon you keep using that word…

  32. @ph1 #oscon choosing code paths at runLme

  33. @ph1 #oscon client

  34. @ph1 #oscon client

  35. @ph1 #oscon treat different toggles differently

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

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

    toggles
 are around for years
  38. @ph1 #oscon dynamism release toggles
 vary per deployment experiment toggles


    vary per request
  39. @ph1 #oscon ownership release toggles ops toggles permission toggles experiment

    toggles owned by devs owned by ops owned by product
  40. @ph1 #oscon toggle longevity

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

    return old_relatedProducts(product); } }
  42. @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 }
  43. @ph1 #oscon toggle dynamism

  44. @ph1 #oscon Product Details Buy Related Products

  45. @ph1 #oscon Product Details BUY!

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

    renderProductDetailsSection({renderBuyButton:false}); renderReallyBigBuyButton(); } }
  47. @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(); } }
  48. @ph1 #oscon toggle configuraLon sta1c dynamic

  49. @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
  50. @ph1 #oscon ? sta1c dynamic

  51. @ph1 #oscon make toggle
 configuraLon observable

  52. @ph1 #oscon allow overriding configuraLon for tesLng

  53. @ph1 #oscon advice from the trenches

  54. @ph1 #oscon toggles aren’t free

  55. @ph1 #oscon tesLng toggled code
 isn’t easy

  56. @ph1 #oscon toggles help you 
 go faster

  57. FEATURE TOGGLES your journey into @ph1 #oscon

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