Flags vs. Branching
When chatting with one of our very own developers, he told us that “The biggest pain point that feature flags solve for us is the safety of being able to merge code without it sitting in branches forever.”
Feature branches have decent intentions. When used properly (i.e. kept short-lived, and paired with a distributed version control system such as GitHub or BitBucket), branches enable devs to work independently, but in parallel, with one another in a central codebase. But long-lived feature branches cause more pain than they do good for any dev team.
With feature flags, devs can more effectively control short-lived branches, work in parallel, and achieve a CICD pipeline.
So long, long-lived branches!
Without proper feature management tooling in place, devs complete their part of the code and ship it to a very long branch where it has to sit for weeks (sometimes even months) before everyone else finishes their part and it can actually be merged to the main branch + deployed.
This is problematic because code is living–there is always something being changed about it. So, if a developer creates a feature flag based on how the code is written one day, and it sits in a branch long enough for the code it’s based on to be changed by someone else, the feature flag will no longer work properly once it’s deployed. Even worse, the developer probably won’t know that it doesn’t work until it’s deployed–meaning they’ll spend even more time post-deployment rolling the code back and attempting to fix the bug. (Only to deploy it to a long branch again–and hope for the best, again. It’s a vicious cycle.)
Additionally, releases are not automatically decoupled from deployments when using feature branching alone. Thus, developers can’t simply toggle a feature on or off, or gradually rollout a feature to users once it’s shipped to the main branch.
The Power of Feature Flags + Feature Branches
This is where feature flags come into play to give developers utmost and granular control over their releases and branches. When you merge a feature in the main (production) branch that is wrapped in a flag, you can deploy the feature “off” and roll it out to users gradually from there. You can also use a kill switch to turn the feature off all together and revert to the default experience if it doesn’t perform well once deployed.
Some key benefits:
Boost developer productivity: Instead of waiting around for someone else to complete their code, devs can now complete their ticket & ship their code to main while waiting for the rest of the code to come in. Once in main, it’ll be merged, tested, and shipped to production.
Communication & Collaboration: With a proper feature management solution in place, keeping your dev & eng teams, your product team and other key business stakeholders in the loop on flag status updates is easy. DevCycle’s dashboard gives everyone an instant view into how each flag is progressing across environments.
Risk Mitigation: Feature branches + feature flag can help to improve the quality of code by allowing for more thorough testing before code changes are merged into the main development branch.Toggle your features on or off throughout the entire development process to be sure it functions properly without impacting development environments.