All right, so that was the life cycle. The big takeaway there, of course, again, is this stale flag management, probably the hardest part about feature flags at scale, to be honest. Let's now talk about the third wall, which is architecture. And architecture is going to have two parts. The first one will be testing, and then the second one will be kind of more infrastructure focused. So testing is really interesting with feature flags. And by interesting, I mean really hard. And that's because of the combinatorial explosion. What do I mean by combinatorial explosion? Well, with five Boolean flags, which, right, that's pretty simple. Five Boolean flags on or off, you already have 32 combinations. You move up to 20 flags that are just on off, that's over a million combinations. And the problem is, as well, if you have a million combinations in your code base, how are you going to test all of those combinations? Even if those took just one second per test, that would still be 12 days of continuous testing. It's just not possible. So the big problem is how to reckon with this fact that with more feature flags, especially feature flags that are more complex, imagine if they weren't Boolean flags, but had much more complex logic tied to them, how are you going to test it? Well, the truth of the matter is that you can't test every combination. It's just not physically possible. So the recommendations here are as follows. So the first one is to test critical paths. And what does that mean? Basically, those paths that you know are essential to the function of your app, those are the paths that you want to test first. This makes sense, but it's just something to keep in mind. The other side of that is also to test production states. So think about this is with those 20 flags, if there's a certain configuration on and off of each of those flags that is going to be most prevalent in production, that's obviously a configuration that you do want to test and make sure that that's part of, you know, the testing going forward. Another way that you can approach this, which is becoming more and more common for every feature flag provider, is to do something that we call safe rollouts, and it might have different names, but the idea here is that every feature that you release with a feature flag that you attach basically an EB test to it that allows you to check for some kind of failure rate. If that failure rate is triggered, then the feature is automatically rolled back. For example, how this would work, let's say you're testing a new checkout flow feature. You would say that if the checkout failure rate goes above some kind of percentage, then automatically roll back this feature. This allows you to have some peace of mind when you're using a feature flag with a new feature that you get this automatic roll back if things go south, and, of course, sometimes they will. Another great tool to look for in your feature flag platform is some kind of tool that allows you to look at the actual app and simulate different feature flag states, experiment states, and I'll show you a video of this. This becomes really useful for kind of looking at, well, if I have this kind of user or this sort of attribute, how's the flag actually going to perform in the app? If you have a tool that allows you to do this easy, it lets you catch a lot of bugs before production, or if you do have a bug in production, it makes it much easier to debug what's going on. And then two other easy ones, some minimized nesting and dependencies. You can get into a situation where one flag is going to depend on the outcome of another, and so you should follow just good principles for code where you're modularizing things, trying to minimize that nesting and dependency as much as possible.
Comments