Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Feature Toggles vs Feature Branches

What are "Feature Toggles" and "Feature Branches" and what's the difference between them?

What are the pros and cons? Why is one better than the other?

I found some articles on Google regarding this, and I tend to be in the "Feature Toggles" camp, but I'm not convinced that "Feature Toggles" is the better choice in all the cases.

like image 643
Sergiu Avatar asked Oct 17 '13 18:10

Sergiu


People also ask

Why you should not use feature branches?

You'll Waste Time Fixing Unnecessary Merge Conflicts Merge conflicts are the biggest pitfall of using feature branches. Nothing hurts more than spending unnecessary time fixing merge conflicts, especially when a feature branch has been there for a while. But time is not the only factor.

What is the difference between branch and feature branch?

Feature branches are created from develop. When a feature is complete it is merged into the develop branch. When the release branch is done it is merged into develop and main. If an issue in main is detected a hotfix branch is created from main.

Why are feature toggles bad?

Feature toggles hinder continuous integration They delay integration, so they tend to move away from continuous integration. A risk of this is late feedback - you don't catch issues fast, because the issue is hidden behind the toggle.

What is a feature branch?

A feature branch is a copy of the main codebase where an individual or team of software developers can work on a new feature until it is complete. With many engineers working in the same code-base, it's important to have a strategy for how individuals work together.


1 Answers

Feature toggles are methodology used in a Continuous Integration/Continuous Delivery (CI/CD) chain (Agile/Kanban project methodology). Basically, you send new features to production in a disabled state, then in an admin console turn the feature on (or off if you discover it's broken).

Feature branches can be part of a release methodology and integrated into a continuous integration chain. You can develop in a feature branch, deploy the branch to DEV/QA, get certification, merge the feature branch to trunk, then push the trunk to SIT/UAT/PROD environments.

There are pros and cons associated with this approach. Feature toggling requires very strict discipline as broken/dark code is making it to production. This is great for startups and shops where management knows how to pull this off and has system automation tools in place (Chef/Puppet/cfengine, etc.) Google, Facebook, LinkedIn, WordPress all deploy to production environments using feature toggling and system automation.

There are some prerequisite "techs" to do feature toggling properly: Continuous Delivery/Deployment, Continuous Integration, Automated Unit Testing, Automated Integration Testing, Automated Stress/Performance Testing, System Automation. If you don't have these in place, consider a simpler release strategy (e.g. feature branching.)

like image 59
Electrawn Avatar answered Oct 01 '22 14:10

Electrawn