On Branching
Branching is a common practice in code versioning. To my experience, a branch is usually seen as a playground for experiments with brand new features. As far as I can tell, branches have typically been used as a natural shield against tight deadlines. Let’s branch out, see how it goes and take a qualified decision of what to merge back to trunk when the worst is over (i.e. post-delivery). There are several reasons for why this is not a good idea.
Okay, saying that long-lived branches, a.k.a. the Feature Branch pattern, are evil is old news. Since I have seen this practice way too often I was thinking that a quick summary wouldn’t harm. First of all, there is nothing wrong with branching as such. How would one work in parallel with others if branching was not an option?
- enables to hide / switch off any incomplete features
- incomplete code is still delivered but cannot be accessed
- requires easily configurable application and high code modularization
- suitable for large-scale changes (swapping an ORM provider)
- the original implementation gets hidden behind an interface
- gradually, a new implementation is built up behind the scenes
- requires fairly well structured code, otherwise it is tough to build up that additional layer