The most common objection to implementing feature flags is the technical debt management that comes with it.
Technical debt is a concept in software development that reflects the extra development work that needs to be done to incorporate new features or fix software bugs. It is often described as the trade-off between taking shortcuts during development in order to finish a project on time, and doing things the "right" way, which may take longer but will result in less work in the long run.
Put it this way: Would you rather spend 20 additional minutes maintaining clean code with feature flags on a Tuesday morning, or be rushing to meet a deployment deadline at the end of the month and releasing messy–and therefore risky–code to your end users?
How to manage tech debt
Here are some best practices to managing technical debt and maintaining clean code with feature flags:
Select the proper feature type
As mentioned in a previous section, knowing the difference between feature types and when to use them is important. For more information on the different flag types and what each should be used for, take a look at DevCycle’s Feature Types.
Create the feature
(and stick to the naming convention!)
In DevCycle, a unique feature key (which is the key by which the feature and variable will be referenced in code) is created for you.
Of course–when you’re creating a feature for an actual project, you likely would stick to a strategic naming convention (i.e. not “My Beautiful Feature'') to help keep code clean across your organization. Your feature flag naming convention should be as descriptive as possible and include things like the date, flag type, and what it does. For example, if your flag is related to a beta test, you might name it BetaTest_04-02-21_beta
Submit your Pull Request (PR):
Submit your pull request to be sure that your code passes code review, and then merge and deploy as usual.
Stay in the know re: flag status at all times:
As your feature flag usage increases, flag management becomes more complex. Having the right feature management tooling in place is critical to solving this problem.
DevCycle is the only feature management platform with a feature-first dashboard that shows you how all of your flags are progressing through your environments. It gives you (along with your product and other non-technical team members) instant flag status updates so that you know which are running, where the dependencies are, and which flags can be deprecated.
Remove old code:
Always remove flags that are no longer needed to keep your workflow clean and organized. Important to note is that not every tool makes it easy to see when your code is expired or can be deprecated. Choose a tool that supports code maintenance as much as it does feature production.