What is a “feature flag”?

后端 未结 12 623
天涯浪人
天涯浪人 2020-11-30 17:32

High Scalability mentions feature flags here:

5 things toxic to scalability, \"5. Lack of Feature Flags\"

What exactly are feature flags?

12条回答
  •  孤城傲影
    2020-11-30 18:11

    My understanding is that feature flags help you gate functionality by deciding which users receive certain features.

    For example, let's say you only want your beta users to see a new feature. You would "toggle" that feature on for beta users and the rest of your users would not see it.

    LDUser user = new LDUser("user@test.com");
    
    boolean showFeature = ldClient.toggle("your.feature.key", user, false);
    
    if (showFeature) {
         // application code to show the feature 
     }
    else {
         // the code to run if the feature is off
     }
    

    I'm testing LaunchDarkly's feature flags for some front-end JS A/B tests - seems to be working well. You can also check out this site for feature toggles and feature flag libraries.

提交回复
热议问题