Your SlideShare is downloading. ×
0
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Branching Strategies: Feature Branches vs Branch by Abstraction
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Branching Strategies: Feature Branches vs Branch by Abstraction

7,558

Published on

A look at some of the problems introduced by feature branches, and a short introduction to using Branch by Abstraction as an alternative.

A look at some of the problems introduced by feature branches, and a short introduction to using Branch by Abstraction as an alternative.

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

No Downloads
Views
Total Views
7,558
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
88
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Branching StrategiesChris Birchall2013/06/21#m3_dev
  • 2. Branching strategiesFeature BranchesvsBranch By Abstraction
  • 3. Feature Branches● master branch is used for rollouts● Little work done directly on master● For every feature/bugfix, cut a branch● To rollout a feature, merge to mastermasterfeature Afeature B
  • 4. Feature Branches: ProblemsMerging is HARD WORK
  • 5. Merging is HARD WORKSometimes impossible for git/svn to auto-mergemasterfeature Afeature BBOOM!
  • 6. MeclassFooServiceinterfaceFooServiceclassDefaultFooServiceclassCachingFooServicechanged class to interfaceOther devclassFooService● altered a bunch of existing methods● added a bunch of new methodsBOOM!Real life example (happened last week)Took over an hour to merge manually
  • 7. Feature Branches: ProblemsMerging is SCARY
  • 8. Merging is SCARYDo you trust your tools to merge correctly?Have had problems with buggy tools (e.g. git-svn)
  • 9. Feature Branches: ProblemsMerging is A CHANGEto the codebase
  • 10. Merging is A CHANGE to the codebaseMerging counts as a change to the codebase→ Need to perform manual tests before rolloutEnd up doing same tests before and after merge
  • 11. Feature Branches: ProblemsFeature branches are notsubject to CI
  • 12. Feature branches are not subject to CIJenkins is only working against masterManually creating a job per feature branch is sillyCan automate it, but its complicated and brittle
  • 13. Feature Branches: ProblemsFeature branches go ROGUE
  • 14. Feature branches go ROGUEBranch can diverge massively from masterBecomes impossible to merge safelyBranch lives for weeks, months, ...
  • 15. A solution?Branch by Abstraction
  • 16. Branch by AbstractionThe name is misleading...Using B by A, we DONT BRANCH!NO BRANCHES == No MERGING
  • 17. Branch by Abstraction● All dev is done on master● Incomplete work is disabled using feature flags● master is always stable, ready for rollout● Changes performed by introducing abstraction
  • 18. Making a change using B by A1. Add abstraction layer around the code you want tochange. (Extract interfaces, etc.)2. Add the new implementation, but keep using theold implementation in production.3. Flip the switch! (Update flags, switch Guice modules, etc.)4. Remove old implementation if no longer needed
  • 19. Example: Switching to a new auth API1. Refactor concrete class LoginService intointerface + impl classclassLoginServiceinterfaceLoginServiceclassLegacyLoginServiceUpdate surrounding code to use LegacyLoginService(Maybe add a factory to provide the implementation?)
  • 20. Example: Switching to a new auth API2. Add new implementation (+ unit tests, of course!)interfaceLoginServiceclassLegacyLoginServiceAdd feature flag to allow switching between implementations intest environmentinterfaceLoginServiceclassLegacyLoginServiceclassNewLoginService
  • 21. Example: Switching to a new auth API3. Flip the switch!Update the value of the feature flag in production
  • 22. Example: Switching to a new auth API4. Remove old implementationinterfaceLoginServiceclassLegacyLoginServiceinterfaceLoginServiceclassDefaultLoginServiceclassNewLoginServiceRefactor (change class names, etc.) if necessary
  • 23. Example: Switching to a new auth APIFinished!Remember:● All this happened on master● Codebase was stable throughout the process● Both new and old impls were subject to CI● No merging!
  • 24. Branch by Abstraction: Prerequisites● Reasonably good, modular codebase○ Easy to introduce abstractions● Good devs!○ Can be trusted not to break the build● A good suite of unit tests● A feature flag system○ Ideally, well-integrated with toolchain○ e.g. enable features using checkboxes in Jenkins
  • 25. Thank you!Further reading:http://paulhammant.com/blog/branch_by_abstraction.html/

×