{"id":18295,"date":"2016-06-24T00:49:34","date_gmt":"2016-06-23T17:49:34","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/?p=18295"},"modified":"2019-02-14T17:33:53","modified_gmt":"2019-02-15T01:33:53","slug":"effective-patterns-for-feature-flags","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/devops\/effective-patterns-for-feature-flags\/","title":{"rendered":"Effective Patterns for Feature Flags"},"content":{"rendered":"<p>Today, we are inviting <a href=\"https:\/\/twitter.com\/edith_h\">Edith Harbaugh<\/a> from LaunchDarkly as a guest writer for the ALM Blog to talk a little bit about the different patterns of Feature Flag implementations which has been a common topic I get asked about from many of you.\u00a0 If you didn&#8217;t see it, Edith joined us on stage at Build 2016 earlier this year to <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudioalm\/2016\/03\/30\/new-build-2016-partner-extensions-in-the-visual-studio-team-services-marketplace\/\">launch a new marketplace extension of their feature flags service with Visual Studio Team Services<\/a>.<\/p>\n<p><strong>Ed Blankenship<\/strong>\nProduct Manager, Visual Studio Team Services\n<a class=\"twitter-follow-button\" href=\"https:\/\/twitter.com\/edblankenship\">Follow @edblankenship<\/a><\/p>\n<hr \/>\n<p>A question I get asked is \u201cAre feature flags better for risk mitigation, fast feedback, hypothesis-driven development or long term control?\u201d My answer is \u201cYes!\u201d There\u2019s no one right way to use feature flags, they\u2019re a valuable technique to power more effective DevOps. I\u2019ll walk through how you can use feature flags to speed up, derisk, and improve your development.<\/p>\n<h2>Kill Switch<\/h2>\n<p>A feature flag is a conditional in your code, an <em>If then<\/em> for two different options. \u00a0At its simplest, a feature flag can be used to flag a new or risky behavior. \u00a0First, the feature is deployed \u201coff\u201d. Then, separate from deployment, you can turn on the new feature. If the feature doesn\u2019t behave as expected, it\u2019s possible to shut it off quickly. This is better than rolling back an entire version because you\u2019ve isolated the change. In addition, it allows development on other features to continue without forcing a complete rollback. In effect, you\u2019re isolating the change while your code base evolves around it. Risk is uncertainty of unknown issues. With feature flagging, you\u2019re mitigating risk by making every feature encapsulated and controlled.<\/p>\n<p><figure id=\"attachment_18305\" aria-labelledby=\"figcaption_attachment_18305\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/FeatureFlagKillSwitch.jpg\"><img decoding=\"async\" class=\"wp-image-18305 size-large\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/06\/FeatureFlagKillSwitch-1024x576.jpg\" alt=\"Feature Flags for Kill Switches\" width=\"879\" height=\"494\" \/><\/a><figcaption id=\"figcaption_attachment_18305\" class=\"wp-caption-text\">Feature Flags for Kill Switches<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<h2>Beta Feedback and Feature Targeting<\/h2>\n<p>For faster feedback, beyond an on\/off switch, you can control at a very granular level who sees the new feature. You can choose VIPs, early beta users, or regions of the country. This technique is known as canary launches or dark launches. Instead of having \u201cone size fits all\u201d releases, you can iterate with some users to quickly get their feedback. You can also block users who are known to be picky or want only the stablest versions. Microsoft has been using these techniques (canary launches, dark launches for decades in their own releases. \u00a0For example, Microsoft gives early access to <a href=\"https:\/\/mvp.microsoft.com\/\">Microsoft MVP awardees<\/a> to get feedback on new features that are being built.<\/p>\n<p><figure id=\"attachment_18306\" aria-labelledby=\"figcaption_attachment_18306\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/FeatureFlagTargeting.jpg\"><img decoding=\"async\" class=\"size-large wp-image-18306\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/06\/FeatureFlagTargeting-1024x576.jpg\" alt=\"Feature Flags for Targeting\" width=\"879\" height=\"494\" \/><\/a><figcaption id=\"figcaption_attachment_18306\" class=\"wp-caption-text\">Feature Flags for Targeting<\/figcaption><\/figure><\/p>\n<p>&nbsp;<\/p>\n<h2>Hypothesis-Driven Development<\/h2>\n<p>Once a feature is cleanly encapsulated, it can be used for hypothesis-driven development, as <a href=\"http:\/\/blog.launchdarkly.com\/hypothesis-driven-development-yammer-case-study\/\">Microsoft\u2019s Yammer<\/a> does. Want to know whether a feature helped with engagement or lifted revenue? Feature flags allow you to tie back real metrics to code. After knowing the impact of your feature, you can switch the feature on (or off) for all users.<\/p>\n<p><figure id=\"attachment_18315\" aria-labelledby=\"figcaption_attachment_18315\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/HypothesisDrivenDevelopment.jpg\"><img decoding=\"async\" class=\"size-large wp-image-18315\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/06\/HypothesisDrivenDevelopment-1024x576.jpg\" alt=\"Hypothesis-Driven Development\" width=\"879\" height=\"494\" \/><\/a><figcaption id=\"figcaption_attachment_18315\" class=\"wp-caption-text\">Hypothesis-Driven Development<\/figcaption><\/figure><\/p>\n<p>Feature flags are also good for long-term access level control. If you have a feature that only advanced users should access, you can use a feature to have a different experience for \u201cnewbie\u201d vs \u201cpower users\u201d. You can use feature flags to control localization, or you can also block an entire country if a feature shouldn\u2019t be available there.<\/p>\n<p>&nbsp;<\/p>\n<h2>Subscription Plans and SKU Management<\/h2>\n<p>You can bundle several flags together to form a subscription. You can have a silver, platinum, and gold tier. You can build one-off tiers for users. LaunchDarkly does this ourselves to enable custom contracts.<\/p>\n<p><figure id=\"attachment_18325\" aria-labelledby=\"figcaption_attachment_18325\" class=\"wp-caption alignnone\" ><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/6\/2019\/05\/FeatureFlagsForSubscriptionManagement.jpg\"><img decoding=\"async\" class=\"size-large wp-image-18325\" src=\"https:\/\/devblogs.microsoft.com\/devops\/wp-content\/uploads\/sites\/6\/2016\/06\/FeatureFlagsForSubscriptionManagement-1024x576.jpg\" alt=\"Feature Flags for Subscription Management\" width=\"879\" height=\"494\" \/><\/a><figcaption id=\"figcaption_attachment_18325\" class=\"wp-caption-text\">Feature Flags for Subscription Management<\/figcaption><\/figure><\/p>\n<p>Now, with the Visual Studio Team Services <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=launchdarkly.launchdarkly-extension\" target=\"_blank\">LaunchDarkly extension<\/a>, it\u2019s easier than ever to fit feature flags into your releases. From Visual Studio Team Services, you can tie flags per environment into your release. You\u2019re in complete control of your releases and functionality.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Edith Harbaugh<\/strong>\nCEO and Co-Founder, <a href=\"http:\/\/launchdarkly.com\/microsoft\" target=\"_blank\">LaunchDarkly<\/a>\n<a class=\"twitter-follow-button\" href=\"https:\/\/twitter.com\/LaunchDarkly\">Follow @LaunchDarkly<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, we are inviting Edith Harbaugh from LaunchDarkly as a guest writer for the ALM Blog to talk a little bit about the different patterns of Feature Flag implementations which has been a common topic I get asked about from many of you.\u00a0 If you didn&#8217;t see it, Edith joined us on stage at Build [&hellip;]<\/p>\n","protected":false},"author":105,"featured_media":45953,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[227,226,229,1],"tags":[],"class_list":["post-18295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-agile","category-ci","category-community","category-devops"],"acf":[],"blog_post_summary":"<p>Today, we are inviting Edith Harbaugh from LaunchDarkly as a guest writer for the ALM Blog to talk a little bit about the different patterns of Feature Flag implementations which has been a common topic I get asked about from many of you.\u00a0 If you didn&#8217;t see it, Edith joined us on stage at Build [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/18295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/users\/105"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/comments?post=18295"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/posts\/18295\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media\/45953"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/media?parent=18295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/categories?post=18295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/devops\/wp-json\/wp\/v2\/tags?post=18295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}