Anand Agrawal
Feature branches
&
Continuous Integration
Feature Braches
Trunk
Developer A
Developer B
 Pros
 Code for new feature could not make to
production
 No fear to check-in in branch
 Cons
 Merge hell
 Fear of r...
Continuous Integration
 Pros
 Avoid big merges
 Each check-in is production ready
 Continuously Integrate thorough out the
progress path of t...
Then how to do Continuous
Integration?
Feature Toggles
What are toggles?
It’s a simple if statement
Feature toggle is a if
statement that hides certain
execution path
Types of Feature toggle
 Release toggles
 Business toggles
Release Toggles
 To hide incomplete feature
 Short lived
 Removed as soon as feature is ready
 Have pre-decided values...
Business Toggles
 To enable A / B testing
 Release feature to certain groups of
people to get early feedback
 Could be ...
Testing the Toggles
 Unit Test
 Test for both conditions i.e. toggle on and off
 Integration Test
 Test with toggle st...
Tips and tricks to implement
Feature Toggle
In case of building new API end
point that is not public facing
No feature toggle needed
In case of creating new
model or table
No feature toggle needed
In case of adding a new column
in database and exposing it
through service
No feature toggle needed
May feature toggle val...
In case of new endpoint that is
public facing
Just feature toggle the url
In case of UI component
embedded in existing page
Feature toggle the view
element
In case of logic change like
change the way payment is
processed
Feature toggle by abstraction
Things to keep in mind
 Don’t try to toggle each and every line of
code. Use only where its needed.
 Keep the number of ...
Ways to implement toggles
 Config file
 Toggle manager for Admin to manage
 Cookie store
 … or whatever that makes sen...
They are riding on the same
boat
Feature Toggle is second best
solution. The best solution is to
find a way to gradually
integrate, without Feature
Branche...
No free lunch
 Good test suite (unit and acceptance)
 Fix or Revert the breaking change
immediately
 Break down feature...
References
 http://martinfowler.com/bliki/FeatureToggle.html
 http://www.infoq.com/presentations/Feature-Bits
 http://b...
Questions ?
Upcoming SlideShare
Loading in...5
×

Feature toggles

1,338

Published on

Feature toggle widely used in industry to release incomplete features and do A/B testing on features. The presentation covers pros and cons of the approach and share some tips and tricks.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,338
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
28
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Feature toggles

  1. 1. Anand Agrawal
  2. 2. Feature branches & Continuous Integration
  3. 3. Feature Braches Trunk Developer A Developer B
  4. 4.  Pros  Code for new feature could not make to production  No fear to check-in in branch  Cons  Merge hell  Fear of refactoring  Difficult to share code across branches
  5. 5. Continuous Integration
  6. 6.  Pros  Avoid big merges  Each check-in is production ready  Continuously Integrate thorough out the progress path of the feature  Cons  Incomplete feature may go to production  Fear to commit code
  7. 7. Then how to do Continuous Integration? Feature Toggles
  8. 8. What are toggles?
  9. 9. It’s a simple if statement
  10. 10. Feature toggle is a if statement that hides certain execution path
  11. 11. Types of Feature toggle  Release toggles  Business toggles
  12. 12. Release Toggles  To hide incomplete feature  Short lived  Removed as soon as feature is ready  Have pre-decided values across environments (except dev)
  13. 13. Business Toggles  To enable A / B testing  Release feature to certain groups of people to get early feedback  Could be enabled or disabled on the fly
  14. 14. Testing the Toggles  Unit Test  Test for both conditions i.e. toggle on and off  Integration Test  Test with toggle states that are going live  Test with toggle on  With business toggles be smart about what you want to test than try and test all combinations
  15. 15. Tips and tricks to implement Feature Toggle
  16. 16. In case of building new API end point that is not public facing No feature toggle needed
  17. 17. In case of creating new model or table No feature toggle needed
  18. 18. In case of adding a new column in database and exposing it through service No feature toggle needed May feature toggle validations or provide default value
  19. 19. In case of new endpoint that is public facing Just feature toggle the url
  20. 20. In case of UI component embedded in existing page Feature toggle the view element
  21. 21. In case of logic change like change the way payment is processed Feature toggle by abstraction
  22. 22. Things to keep in mind  Don’t try to toggle each and every line of code. Use only where its needed.  Keep the number of toggles under control  Try to create mutually exclusive toggles  Clean up release toggles and dead code
  23. 23. Ways to implement toggles  Config file  Toggle manager for Admin to manage  Cookie store  … or whatever that makes sense
  24. 24. They are riding on the same boat
  25. 25. Feature Toggle is second best solution. The best solution is to find a way to gradually integrate, without Feature Branches or Feature Toggles. Martin Fowler
  26. 26. No free lunch  Good test suite (unit and acceptance)  Fix or Revert the breaking change immediately  Break down features into smaller stories  Break down stories into smaller tech tasks  Think of how to take your code to production everyday than creating blockers
  27. 27. References  http://martinfowler.com/bliki/FeatureToggle.html  http://www.infoq.com/presentations/Feature-Bits  http://blog.pluralsight.com/favor-feature-toggles- over-feature-branches  http://paulhammant.com/blog/branch_by_abstracti on.html  http://labs.spotify.com/2014/03/27/spotify- engineering-culture-part-1/
  28. 28. Questions ?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×