Sie sind auf Seite 1von 29

Anand Agrawal

Feature branches
Continuous Integration

Feature Braches
Developer A


Developer B

! Pros
" Code for new feature could not make to

" No fear to check-in in branch
! Cons
" Merge hell
" Fear of refactoring
" Difficult to share code across branches

Continuous Integration

! 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

Then how to do Continuous


Feature Toggles

What are toggles?

Its a simple if statement

Feature toggle is a if
statement that hides certain
execution path

Types of Feature toggle

! Release

! Business toggles

Release Toggles
! To

hide incomplete feature

! Short lived
! Removed as soon as feature is ready
! Have pre-decided values across
environments (except dev)

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

Testing the Toggles

! Unit


" Test for both conditions i.e. toggle on and off

! Integration


" 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


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 validations
or provide default value

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

In case of logic change like

change the way payment is
Feature toggle by abstraction

Things to keep in mind

! Dont

try to toggle each and every line of

code. Use only where its needed.
! Keep the number of toggles under
! Try to create mutually exclusive toggles
! Clean up release toggles and dead code


Ways to implement toggles

! Config

! Toggle manager for Admin to manage
! Cookie store
! or whatever that makes sense

They are riding on the same


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

No free lunch
! Good

test suite (unit and acceptance)

! Fix or Revert the breaking change
! Break down features into smaller stories
! Break down stories into smaller tech
! Think of how to take your code to
production everyday than creating


Questions ?