|
9 | 9 | - [Why use feature toggling?](#why-use-feature-toggling) |
10 | 10 | - [Types of toggles](#types-of-toggles) |
11 | 11 | - [Managing toggles](#managing-toggles) |
| 12 | + - [Caveats](#caveats) |
12 | 13 | - [Toggling strategy](#toggling-strategy) |
13 | 14 | - [Toggle lifecycle](#toggle-lifecycle) |
14 | 15 | - [Best practice lifecycle](#best-practice-lifecycle) |
@@ -78,7 +79,16 @@ Poorly managed toggles can lead to complexity, bugs, and technical debt. Best pr |
78 | 79 | - Guard the feature behind a single toggle check, and pass the resulting behaviour or strategy through your code to minimise duplication and simplify removal. |
79 | 80 | - Ensure toggles are discoverable, testable, and auditable. |
80 | 81 | - Avoid nesting toggles or creating toggle spaghetti. |
81 | | -- Remove stale toggles once their purpose is fulfilled. |
| 82 | +- Remove stale toggles once their purpose is fulfilled. Ideally integrate this into your CI pipeline to report on stale flags. |
| 83 | + |
| 84 | +## Caveats |
| 85 | + |
| 86 | +Whilst there are obvious benefits to Feature Toggling, there are some caveats worth bearing in mind when implementing them |
| 87 | + |
| 88 | +- **Performance Overhead**: Feature toggles can introduce performance overhead if they are checked frequently, especially within loops and every evaluation goes back to the server. |
| 89 | +- **Toggle Bloat & Technical Debt**: Toggles are intended for short term use, failure to adhere to this principle can lead to conditional sprawl of if statements, harder code to read and maintain and increased risk of toggle conflicts or becoming orphaned |
| 90 | +- **Test Complexity**: More toggles increase your permutations around a single test path. A single toggle doubles the test scenarios and needs careful factoring in to the test approach. |
| 91 | +- **Increased Logging/Observability Needs**; Now need to know the state of the toggles at the point of the logs, otherwise inspecting the logs becomes incredibly difficult. |
82 | 92 |
|
83 | 93 | ## Toggling strategy |
84 | 94 |
|
@@ -136,4 +146,5 @@ Best practices: |
136 | 146 | - [Feature Toggles (aka Feature Flags) by Martin Fowler](https://martinfowler.com/articles/feature-toggles.html) |
137 | 147 | - [11 principles for building and scaling feature flag systems](https://docs.getunleash.io/topics/feature-flags/feature-flag-best-practices) |
138 | 148 | - [Best practices for coding with feature flags](https://launchdarkly.com/blog/best-practices-for-coding-with-feature-flags/) |
| 149 | +- [Defensive coding](https://docs.flagsmith.com/guides-and-examples/defensive-coding) |
139 | 150 | - [An example tool for feature toggling](https://docs.flagsmith.com/) |
0 commit comments