DEV Community

Discussion on: Why you should not use (long-lived) feature branches

Collapse
bizzy237 profile image
Yury

the idea of feature toggles never clicked with me for some reason. maybe because I'd have to test that my code doesn't work unless I enable it. it's trivial if I change the old behavior with a shiny new one but how do I test that my buggy new feature is completely unavailable and cannot be accidentally called by something else?

Collapse
lirantal profile image
Liran Tal

Feature flags (or toggles) are essential for continuous deployment and quick delivery because they allow you to manage things like canary releases and the ability to "test in production" ( ๐Ÿคฏ). Obviously you should actual test and choose a well designed feature flags solution but at the end of the day and for the sake of simplicity you can think of them like a code branch:

if (ff.shiny_new_thing === 'on') {
  doThisNewThing();
} else {
  doThisOldThing();
}

You could also argue how those would be tested and while that's not always easy it's definitely doable. Another way to think of feature flags is that they are merely configuration items.