I’m part of a team of 10 developers, and recently our product team requires us to use feature flags for almost every new change.
The idea is that they can always “roll back” to the previous behavior by turning the flag off.
This leads to our existing Angular/TypeScript code becoming full of if checks, for example:
foo() { const dialog = this.featureFlag.has('...') ? dialogX : dialogY; dialog.work(); } bar() { // a very long and old function here.. .... if (this.featureFlag.has('...')) { // new code } else { // old code } .... } As time goes on, the code becomes harder to read and maintain.
Is there a better pattern or approach to handle many feature flags in Angular/TypeScript without cluttering the code with conditionals?
We’re using Angular, and the issue is mainly on the TypeScript side.