<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hendrik Beck &#187; Coding</title>
	<atom:link href="http://blog.hendrikbeck.com/category/coding-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hendrikbeck.com</link>
	<description>Tech Startup Craftsmanship</description>
	<lastBuildDate>Mon, 02 Feb 2015 22:00:19 +0000</lastBuildDate>
	<language>de-DE</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.1</generator>
	<item>
		<title>DIY dark-launching feature toggle in 16 lines of Ruby</title>
		<link>http://blog.hendrikbeck.com/2015/02/02/ruby-rails-dark-launch-feature-toggle-diy/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ruby-rails-dark-launch-feature-toggle-diy</link>
		<comments>http://blog.hendrikbeck.com/2015/02/02/ruby-rails-dark-launch-feature-toggle-diy/#comments</comments>
		<pubDate>Mon, 02 Feb 2015 17:50:44 +0000</pubDate>
		<dc:creator><![CDATA[Hendrik Beck]]></dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[dark launch]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[feature toggle]]></category>
		<category><![CDATA[Product Management]]></category>
		<category><![CDATA[soft launch]]></category>
		<category><![CDATA[Sounds]]></category>

		<guid isPermaLink="false">http://blog.hendrikbeck.com/?p=695</guid>
		<description><![CDATA[Dark launching and soft launching functionality is an important ingredient for continuous shipping. To me by now, even 2 days of code changes piling up feel like more than necessary. Often enough, this is due to the fact that pending code changes aren&#8217;t complete enough yet to get them into production, let alone show it [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Dark launching and soft launching functionality is an important ingredient for continuous shipping. To me by now, even 2 days of code changes piling up feel like more than necessary. Often enough, this is due to the fact that pending code changes aren&#8217;t complete enough yet to get them into production, let alone show it to anyone.</p>
<p>As a solution to this there are approaches like dark-launches and soft roll-outs, but often enough they require code and tool changes that are being delayed until very late. That&#8217;s quite a bummer since dark-launching is so helpful in moving fast, from both a technical and a product management point of view.</p>
<ul>
<li>Developers are happy when they can get code into Production (&#8220;nice, it works, check!&#8221;)</li>
<li>Product Managers are happy when they can get early early feedback, at least from a few select customers (and without having to sacrifice on anything by publicly releasing something unfinished)</li>
<li>(The right group of) Users are happy if they get early access to features</li>
</ul>
<p>Sounds like reason enough to stop NOT doing it right away huh? <img src="http://blog.hendrikbeck.com/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley" /> </p>
<p>I was in this very situation on a relatively new project, with a million things to do, and I&#8217;ve decided to hack a DIY solution together and see where that gets me. Turns out it only a few lines of actual code and is already much much better than nothing. Here&#8217;s the premise:</p>
<ul>
<li>I just wanted to be able to hide access to a feature, i.e. hide the link in the nav bar that leads users to it (yeah, I know, but it&#8217;s ok in this case, and I bet in a lot of cases it is)</li>
<li>We&#8217;re on Heroku so I thought Heroku config vars would be a great way to control it (no code deploy necessary, but also no overhead with databases and backend access etc., Heroku already provides everything)</li>
<li>Toggling only on a per-user basis (we were THAT small, yes), no other fanciness like user groups, geographic distribution, load balancing or whatever (yet)</li>
</ul>
<p>And here&#8217;s the code that made it work:</p>
<script src="https://gist.github.com/c942a62980c3bcd91476.js?file=dark_launch.rb"></script>
<p>Quick run-down:</p>
<ul>
<li>Called the class DarkLaunch, more because I liked the sound of it than of its correctness <img src="http://blog.hendrikbeck.com/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley" /> </li>
<li>It has this one feature toggle method that can be used to surround links etc. a la &#8220;if DarkLaunch.feature_visible(&#8230;)&#8221;. It returns true whenever a particular user should see the feature in this moment, and false otherwise</li>
<li>It always returns false if there&#8217;s not current_user (since we&#8217;re toggling on a per-user basis)</li>
<li>It always returns true for Development and Test (which leads to other problems but for the moment I liked it to have everything visible on Dev)</li>
<li>Each feature becomes an identifier (like UPLOAD_PHOTOS) that is used when calling the feature_visible()</li>
<li>It expects a Heroku config var named FEATURE_UPLOAD_PHOTOS</li>
<li>This config var is expected to contain a comma-separated list of user IDs to should have access to the feature</li>
<li>feature_visible returns true if the ID of the given user is in that list</li>
<li>Or once we&#8217;re ready to make a feature public to everybody, we can just set the variable to &#8220;PUBLIC&#8221;. In that case it always returns true, without checking user IDs anymore</li>
<li>And otherwise it returns false, blocking the feature for everybody else</li>
</ul>
<p>Usage is then dead simple, as long as &#8220;launching&#8221; is as simple as showing something on the UI or hiding it:</p>
<script src="https://gist.github.com/c942a62980c3bcd91476.js?file=demo.haml"></script>
<p>It&#8217;s a bit of a quick hack, of course, and far from a complete or well-done (or flexible, or &#8230;) solution in so many ways. But it was great to see that a few lines of code added so much value to rolling out a feature. Feel free to let me know what you think or if you&#8217;re interested in using more of this. And who knows, maybe it becomes a little Gem&#8230; <img src="http://blog.hendrikbeck.com/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" /> </p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hendrikbeck.com/2015/02/02/ruby-rails-dark-launch-feature-toggle-diy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
