SlideShare a Scribd company logo
Branching Strategies
Chris Birchall
2013/06/21
#m3_dev
Branching strategies
Feature Branches
vs
Branch By Abstraction
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 master
master
feature A
feature B
Feature Branches: Problems
Merging is HARD WORK
Merging is HARD WORK
Sometimes impossible for git/svn to auto-merge
master
feature A
feature B
BOOM!
Me
class
FooService
interface
FooService
class
DefaultFooService
class
CachingFooService
changed class to interface
Other dev
class
FooService
● altered a bunch of existing methods
● added a bunch of new methods
BOOM!
Real life example (happened last week)
Took over an hour to merge manually
Feature Branches: Problems
Merging is SCARY
Merging is SCARY
Do you trust your tools to merge correctly?
Have had problems with buggy tools (e.g. git-svn)
Feature Branches: Problems
Merging is A CHANGE
to the codebase
Merging is A CHANGE to the codebase
Merging counts as a change to the codebase
→ Need to perform manual tests before rollout
End up doing same tests before and after merge
Feature Branches: Problems
Feature branches are not
subject to CI
Feature branches are not subject to CI
Jenkins is only working against master
Manually creating a job per feature branch is silly
Can automate it, but it's complicated and brittle
Feature Branches: Problems
Feature branches go ROGUE
Feature branches go ROGUE
Branch can diverge massively from master
Becomes impossible to merge safely
Branch lives for weeks, months, ...
A solution?
Branch by Abstraction
Branch by Abstraction
The name is misleading...
Using B by A, we DON'T BRANCH!
NO BRANCHES == No MERGING
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
Making a change using B by A
1. Add abstraction layer around the code you want to
change. (Extract interfaces, etc.)
2. Add the new implementation, but keep using the
old implementation in production.
3. Flip the switch! (Update flags, switch Guice modules, etc.)
4. Remove old implementation if no longer needed
Example: Switching to a new auth API
1. Refactor concrete class LoginService into
interface + impl class
class
LoginService
interface
LoginService
class
LegacyLoginServic
e
Update surrounding code to use LegacyLoginService
(Maybe add a factory to provide the implementation?)
Example: Switching to a new auth API
2. Add new implementation (+ unit tests, of course!)
interface
LoginService
class
LegacyLoginServic
e
Add feature flag to allow switching between implementations in
test environment
interface
LoginService
class
LegacyLoginServic
e
class
NewLoginService
Example: Switching to a new auth API
3. Flip the switch!
Update the value of the feature flag in production
Example: Switching to a new auth API
4. Remove old implementation
interface
LoginService
class
LegacyLoginServic
e
interface
LoginService
class
DefaultLoginServic
e
class
NewLoginService
Refactor (change class names, etc.) if necessary
Example: Switching to a new auth API
Finished!
Remember:
● All this happened on master
● Codebase was stable throughout the process
● Both new and old impls were subject to CI
● No merging!
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
Thank you!
Further reading:
http://paulhammant.com/blog/branch_by_abstraction.html/

More Related Content

PPTX
Feature toggles
PPTX
The SOLID Principles Illustrated by Design Patterns
PDF
Git Branching Model
PPTX
Git branching strategies
PDF
Red Hat Openshift on Microsoft Azure
PPTX
Les bonnes pratiques pour migrer d'Oracle vers Postgres
 
PDF
Introduction to DevOps slides.pdf
PDF
How did we move the mountain? - Migrating 1 trillion+ messages per day across...
Feature toggles
The SOLID Principles Illustrated by Design Patterns
Git Branching Model
Git branching strategies
Red Hat Openshift on Microsoft Azure
Les bonnes pratiques pour migrer d'Oracle vers Postgres
 
Introduction to DevOps slides.pdf
How did we move the mountain? - Migrating 1 trillion+ messages per day across...

What's hot (20)

PDF
Git and github - Verson Control for the Modern Developer
PPTX
Feature Toggles
PDF
Learning git
PPTX
TECHTALK 20210727 モニタリングツールでQlik Senseの 運用環境を最適化
PPTX
GitOps w/argocd
PDF
stupid-simple-kubernetes-final.pdf
PDF
Feature toggling
PDF
GitLab Auto DevOps 大解析—CI/CD 原來可以這樣做
PDF
Feature Toggle
PPTX
Git Branch
PDF
Platform Engineering: Manage your infrastructure using Kubernetes and Crossplane
PDF
Git flow
PPTX
Introduction to kubernetes
PDF
ArgoCD Meetup PPT final.pdf
PPT
Git workflows
PPTX
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
PPTX
Introduction to Feature Toggle and FF4J
PDF
Git branch management
PPTX
Kubernetes #2 monitoring
PDF
Event driven autoscaling with KEDA
Git and github - Verson Control for the Modern Developer
Feature Toggles
Learning git
TECHTALK 20210727 モニタリングツールでQlik Senseの 運用環境を最適化
GitOps w/argocd
stupid-simple-kubernetes-final.pdf
Feature toggling
GitLab Auto DevOps 大解析—CI/CD 原來可以這樣做
Feature Toggle
Git Branch
Platform Engineering: Manage your infrastructure using Kubernetes and Crossplane
Git flow
Introduction to kubernetes
ArgoCD Meetup PPT final.pdf
Git workflows
Infrastructure-as-Code (IaC) Using Terraform (Advanced Edition)
Introduction to Feature Toggle and FF4J
Git branch management
Kubernetes #2 monitoring
Event driven autoscaling with KEDA
Ad

Viewers also liked (20)

PDF
Phone Home: A client-side error collection system
PPTX
Coursera experience
PPTX
Writeexcelについて
PDF
DevOpsハッカソン参加レポート
PDF
Guess the Country - Playing with Twitter Streaming API
PDF
3分 gem クッキング
PDF
テストの運用について #m3dev
PDF
Skinny Controllers, Skinny Models
PDF
ScalaCache: simple caching in Scala
PDF
問題が起こった時、変えるのは人かそれともプロセスか?
PDF
Load testing with gatling
PDF
多分モダンなWebアプリ開発
PDF
Skinny Framework 1.0.0
PDF
マイクロサービス運用の所感 #m3dev
PPTX
Trunk Based Development in the Enterprise - Its Relevance and Economics
PDF
Trunk Based Development Explored
PDF
Trunk based development
PDF
Cognitive Biases
PPTX
Continously delivering
PDF
Java Swing vs. Android App
Phone Home: A client-side error collection system
Coursera experience
Writeexcelについて
DevOpsハッカソン参加レポート
Guess the Country - Playing with Twitter Streaming API
3分 gem クッキング
テストの運用について #m3dev
Skinny Controllers, Skinny Models
ScalaCache: simple caching in Scala
問題が起こった時、変えるのは人かそれともプロセスか?
Load testing with gatling
多分モダンなWebアプリ開発
Skinny Framework 1.0.0
マイクロサービス運用の所感 #m3dev
Trunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development Explored
Trunk based development
Cognitive Biases
Continously delivering
Java Swing vs. Android App
Ad

Similar to Branching Strategies: Feature Branches vs Branch by Abstraction (20)

PPTX
Refactoring
PDF
How to get reviewers to block your changes
PDF
Launch safely with Feature Flags
PDF
Intro to Gitflow
PDF
Branch to branch by Photis Patriotis
PDF
Git Series. Episode 3. Git Flow and Github-Flow
PPTX
OpenDaylight Developer Experience 2.0
PDF
CS_Note_Introduction to Git Workflow.pdf
PPTX
Angular TS(typescript)
PDF
Git Branching for Agile Teams
PPTX
Unit Testing in VS2012
PPTX
ALM@Work - Unit testing in Visual studio 2012
PPTX
Development and test infrastructure
PPTX
Multi-QA Environment, parallel development with Git
PDF
What's New in v2 - AnsibleFest London 2015
PDF
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
PPTX
CloudStack Release 4.1 Retrospective
PPT
Stopping the Rot - Putting Legacy C++ Under Test
PDF
OSGi Semantic Versioning with Baselining in enRoute - P Kriens
PPTX
Jenkins as the Test Reporting Framework
Refactoring
How to get reviewers to block your changes
Launch safely with Feature Flags
Intro to Gitflow
Branch to branch by Photis Patriotis
Git Series. Episode 3. Git Flow and Github-Flow
OpenDaylight Developer Experience 2.0
CS_Note_Introduction to Git Workflow.pdf
Angular TS(typescript)
Git Branching for Agile Teams
Unit Testing in VS2012
ALM@Work - Unit testing in Visual studio 2012
Development and test infrastructure
Multi-QA Environment, parallel development with Git
What's New in v2 - AnsibleFest London 2015
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
CloudStack Release 4.1 Retrospective
Stopping the Rot - Putting Legacy C++ Under Test
OSGi Semantic Versioning with Baselining in enRoute - P Kriens
Jenkins as the Test Reporting Framework

More from Chris Birchall (7)

PDF
Scala.js & friends: SCALA ALL THE THINGS
PDF
Rust 超入門
PDF
Tour of Distributed Systems 3 - Apache Kafka
PPTX
Tour of distributed systems 2 - Cassandra
PDF
Tour of distributed systems 1 - ZooKeeper
PDF
PDF
Debugging and Testing ES Systems
Scala.js & friends: SCALA ALL THE THINGS
Rust 超入門
Tour of Distributed Systems 3 - Apache Kafka
Tour of distributed systems 2 - Cassandra
Tour of distributed systems 1 - ZooKeeper
Debugging and Testing ES Systems

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
NewMind AI Weekly Chronicles - August'25 Week I
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Spectroscopy.pptx food analysis technology
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Understanding_Digital_Forensics_Presentation.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Unlocking AI with Model Context Protocol (MCP)
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Programs and apps: productivity, graphics, security and other tools
NewMind AI Weekly Chronicles - August'25 Week I
The AUB Centre for AI in Media Proposal.docx
Spectroscopy.pptx food analysis technology
MIND Revenue Release Quarter 2 2025 Press Release
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
Advanced methodologies resolving dimensionality complications for autism neur...
sap open course for s4hana steps from ECC to s4
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

Branching Strategies: Feature Branches vs Branch by Abstraction