Live data from Hacker News

Ask HN: Do you use feature flags? What's the best tool for the job?

news.ycombinator.com

1–10 of 19 posts

Re: Ask HN: Do you use feature flags? What's the best tool for the job?

#3
Should you use a tool at all? One code file with the flags, and a small piece of router middleware that allows the URL to override the value of flags, and then just if statements. This has served me well on the past 3 frontend projects I have built.

Re: Ask HN: Do you use feature flags? What's the best tool for the job?

#4
This isn't a huge ordeal to DIY. A database table with some fields (name, on/off, dates) and a module to call that checks the db. A simple UI/API to CRUD those rows.

If it's a SaaS, how does your app function if the SaaS is unavailable?

Re: Ask HN: Do you use feature flags? What's the best tool for the job?

#5

This isn't a huge ordeal to DIY. A database table with some fields (name, on/off, dates) and a module to call that checks the db. A simple UI/API to CRUD those rows. If it's a SaaS, how does your app function if the SaaS is unavailable?

I've never used a full blown whiz-bang solution for feature flags, but when I stared at the launch darkly API one day it seemed as if:

* feature flags were generalised as certain class of functions that made an on/off decision based on certain inputs, and the definition of these functions could be sent from the server to client services that had integrated the feature flag library. Functions could be refined at runtime etc -- generalised notion of toggling a toggle.

* there appeared to be capability for services to maintain local cache of the feature flag / expression rules so it didn't introduce a hard failure point on external service. Functions uses to make toggling decisions could be evaluated with inputs locally.

Take this with several grains of salt, never used it, I might be misremembering and it might not actually work this way

Re: Ask HN: Do you use feature flags? What's the best tool for the job?

#7
I think something to note on this as I already see this in the comments. There's always the suggestion of "Yeah that's easy we could do that".

To this I'd say it totally depends on the usecase, I've seen 10s of tech teams build this badly and end up causing more harm than good, some even just static config files that require a build to change which totally defeats the point.

I think looking for an open source tool is great, to this I'd say consider the following :

- Before anything else, you'd definitely want the ability to turn the flags off per environment (dev/prod etc) without having to deploy code.

- Do you want to control who can manage features? Quite often you'd want to enable non-tech people to manage / test features.

- How scalable does it need to be? Some people might want to just not have to worry about serving thousands or millions of flags.

- Do you want to serve flags based on users or maybe even groups of users? I've seen attempts at this but then you start having to worry about setting traits and building some sort of rules engine.

Re: Ask HN: Do you use feature flags? What's the best tool for the job?

#9

Should you use a tool at all? One code file with the flags, and a small piece of router middleware that allows the URL to override the value of flags, and then just if statements. This has served me well on the past 3 frontend projects I have built.

So the URL can turn on different features?

Re: Ask HN: Do you use feature flags? What's the best tool for the job?

#10
If you mean global feature flags, use the config file built into virtually every single webframework and and an if statement.

It's really not complicated.

Some webframeworks require an app restart for config file changes to be detected, or restart the app automatically when it detects changes to the file, so I've seen people use databases. But it tends to be an overcomplication and it's usually turned out to be a bit of a pita. It's only worth it if you're regulalrly turning the feature on and off.

Many languages also support build flags, which strips the extra code out completely, but it's an obscure feature, unless you write libraries, that can confuse other programmers.

Post reply on HN