<?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>Programmer&#039;s Paradox</title>
	<atom:link href="http://www.programmersparadox.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.programmersparadox.com</link>
	<description>Long form thoughts from a Software Engineer</description>
	<lastBuildDate>Mon, 05 Mar 2012 15:20:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Testing API Integrations In RSpec</title>
		<link>http://www.programmersparadox.com/2012/03/05/testing-api-integrations-in-rspec/</link>
		<comments>http://www.programmersparadox.com/2012/03/05/testing-api-integrations-in-rspec/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 15:20:52 +0000</pubDate>
		<dc:creator>Mark Mzyk</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.programmersparadox.com/?p=1548</guid>
		<description><![CDATA[RSpec, a Behavior Driven Development framework, is great for various kinds of testing, such as unit and integration testing. However one area that is hard to test is integrations that cross APIs. You call into a service, then need to wait while it takes some action before proceeding with the test you want. An example [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://www.relishapp.com/rspec">RSpec</a>, a <a href="http://en.wikipedia.org/wiki/Behavior_driven_development">Behavior Driven Development</a> framework, is great for various kinds of testing, such as unit and integration testing. However one area that is hard to test is integrations that cross APIs. You call into a service, then need to wait while it takes some action before proceeding with the test you want. An example of this would be inserting an item into a search service, then querying the service to test the output, ensuring your item is there. The service might have a queue and so doesn&#8217;t insert the item immediately. How do you test this?</p>
<p>One way is to call the API, sleep, and then run the test. The problem with this is that you have to wait the entire sleep duration for every test run, even if the results are ready before the sleep is done. RSpec&#8217;s and Ruby&#8217;s flexibility allow you to avoid this situation by writing a  helper function:</p>
<p><code>
<pre>
def wait(time, increment = 5, elapsed_time = 0, &amp;block)
  begin
    yield
  rescue Exception =&gt; e
    if elapsed_time &gt;= time
      raise e
    else
      sleep increment
      wait(time, increment, elapsed_time + increment, &amp;block)
    end
  end
end
</pre>
<p></code></p>
<p>To use this function, you pass your test to it as a block. The wait function will immediately try the test. If a failure is reported &#8211; which in RSpec is just an exception &#8211; the function catches the failure and sleeps. The assumption is that a failure means the API that is called into has not yet completed the action that is being waited upon. The wait function continues to retry the test until the test either passes or until it reaches the timeout that was passed to it, at which point it will raise the last error it caught, which will be the last failure of the test it ran.</p>
<p>The wait function has the benefit of returning successes as soon as they are encountered, so the tests don&#8217;t have to sleep for the entire duration specified. However, it still has to wait the entire sleep period for a failure, because it can&#8217;t distinguish a legitimate failure from the API service not yet returning the correct results.</p>
<p>Using the wait function in an RSpec test looks like this:</p>
<p><code>
<pre>
describe "a test" do
  before :each do
    insert_user_remote_service("user")
  end

  after :each do
    delete_user_remote_service("user")
  end

  it "should receive the results it expects from the api" do
    wait 30 do
      search_for_user_in_remote_service("user").should == "user"
    end
  end
end
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.programmersparadox.com/2012/03/05/testing-api-integrations-in-rspec/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Git Info</title>
		<link>http://www.programmersparadox.com/2012/02/29/git-info/</link>
		<comments>http://www.programmersparadox.com/2012/02/29/git-info/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 13:16:04 +0000</pubDate>
		<dc:creator>Mark Mzyk</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git-info]]></category>

		<guid isPermaLink="false">http://www.programmersparadox.com/?p=1540</guid>
		<description><![CDATA[Git info is a bash script I wrote that searches for git repositories with modified files and returns a list of the modified files and current branch name. It searches one level deep in subdirectories of the directory it is invoked in. It&#8217;s useful if you collect a bunch of git repos in one master [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://github.com/mmzyk/git-info">Git info</a> is a bash script I wrote that searches for git repositories with modified files and returns a list of the modified files and current branch name. It searches one level deep in subdirectories of the directory it is invoked in.</p>
<p>It&#8217;s useful if you collect a bunch of git repos in one master folder (say ~/src, for instance) and want to be able to scan the current state of each repo easily.</p>
<p>You can also pass the script the -b or &#8211;branch option and it will report the current branch of repos that don&#8217;t have any modified files, in addition to those that branches that do have modified files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.programmersparadox.com/2012/02/29/git-info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chef and ActiveSupport</title>
		<link>http://www.programmersparadox.com/2012/02/18/chef-and-activesupport/</link>
		<comments>http://www.programmersparadox.com/2012/02/18/chef-and-activesupport/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 17:56:44 +0000</pubDate>
		<dc:creator>Mark Mzyk</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[activesupport]]></category>
		<category><![CDATA[chef]]></category>
		<category><![CDATA[opscode]]></category>

		<guid isPermaLink="false">http://www.programmersparadox.com/?p=1507</guid>
		<description><![CDATA[Upfront disclaimer: While I work for Opscode, maker of Chef, this blog post reflects my personal opinion and is not company position. Chef has a major pain point in the Ruby community: ActiveSupport. ActiveSupport is a library of useful functions that was born from Rails, adding into Ruby all sorts of helper functions. It does [...]]]></description>
			<content:encoded><![CDATA[<p><em>Upfront disclaimer</em>: While I work for <a href="http://www.opscode.com/">Opscode</a>, maker of <a href="http://wiki.opscode.com/display/chef/Home">Chef</a>, this blog post reflects my personal opinion and is not company position.</p>
<p>Chef has a major pain point in the Ruby community: <a href="http://as.rubyonrails.org/">ActiveSupport</a>. </p>
<p>ActiveSupport is a library of useful functions that was born from Rails, adding into Ruby all sorts of helper functions. It does so by monkey patching core classes. The monkey patching makes it easy to not even realize you&#8217;re using ActiveSupport.</p>
<p>ActiveSupport works great in Rails &#8211; because Rails was built from the ground up to use ActiveSupport. Where ActiveSupport falls down is in projects not built from the ground up to use it. Chef is one of those projects.</p>
<p>Chef does not use ActiveSupport. If you run Chef there is no need to install ActiveSupport and Chef will not install ActiveSupport. However, one of the great features of Chef is that you can use any Ruby code of your choosing in the cookbooks &#8211; including ActiveSupport, or more insidiously, a gem that pulls in ActiveSupport.</p>
<p>When ActiveSupport gets into Chef&#8217;s load path, it has the potential for insidious harm, due to the monkey patching it performs. With Chef this particularly strikes around json operations. Chef does a fair amount of serializing to and from json, using the <a href="http://rubygems.org/gems/json">json gem</a> to accomplish this. ActiveSupport has its own opinions on how json should be serialized/deserialized and will override the json gem.</p>
<p>The Rails team is aware that ActiveSupport interferes with the json gem and <a href="http://weblog.rubyonrails.org/2009/4/24/this-week-in-edge-rails">has provided ways to defer to it</a>. These work great, so long as you have consciously made the decision to load ActiveSupport and to tell it to use the json gem. What if your project is like Chef, which doesn&#8217;t need or want ActiveSupport, but might find it loaded? It is difficult to undo monkey patching once it is present, especially if you want to be a good citizen and not interfere with ActiveSupport when something else might be relying on it. </p>
<p>Opscode has tried to devise fixes that work around ActiveSupport when it is present, without changing the behavior of ActiveSupport. These should go out in a future Chef release. My recommendation is, even after the fixes go out, to run Chef without ActiveSupport. If you must use ActiveSupport and you see an error that can be traced to strange json, try setting ActiveSupport to use the json gem for its backend. It&#8217;s also possible that you won&#8217;t notice anything wrong with ActiveSupport present, as Chef is fairly promiscuous in the json it allows and will often correctly interpret the json.</p>
<p>If all else fails, file a bug with Opscode and we&#8217;ll do our best to keep working around ActiveSupport, since it isn&#8217;t going away anytime soon. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.programmersparadox.com/2012/02/18/chef-and-activesupport/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking out a branch from Github</title>
		<link>http://www.programmersparadox.com/2011/12/07/checking-out-a-branch-from-github/</link>
		<comments>http://www.programmersparadox.com/2011/12/07/checking-out-a-branch-from-github/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 15:18:10 +0000</pubDate>
		<dc:creator>Mark Mzyk</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://www.programmersparadox.com/?p=1491</guid>
		<description><![CDATA[These are the set of commands to checkout a branch of a repository from Github, which is not immediately obvious the first time you try it. First clone the repo if you haven&#8217;t: git clone url-to-repo-you-want Clone has already checked out the branches, but it only initially creates the master branch. You have to tell [...]]]></description>
			<content:encoded><![CDATA[<p>These are the set of commands to checkout a branch of a repository from Github, which is not immediately obvious the first time you try it.</p>
<p>First clone the repo if you haven&#8217;t:</p>
<p><code>git clone url-to-repo-you-want</code></p>
<p>Clone has already checked out the branches, but it only initially creates the master branch. You have to tell it to create the other branches you might want.</p>
<p>To do that:</p>
<p><code>git checkout -t origin/branch-name</code></p>
<p>This will checkout and create a branch that has the name branch-name and that tracks the remote branch at origin/branch-name.</p>
<p>If you want your branch to have a different name from the remote branch:</p>
<p><code>git checkout -t -b your-branch-name origin/branch-name</code></p>
<p>This creates a branch with your-branch-name that tracks the branch at origin/branch-name.</p>
<p>Because these commands uses checkout you will then have the new branch as your current working branch. You can use git branch with the -t (&#8211;track) flag to create the branch without switching to it.</p>
<p>If you&#8217;re working in a repo you&#8217;ve already cloned and want to checkout a newer branch, it maybe necessary to do a git fetch first to make sure your local checkout knows about the remote branch before you create a local branch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.programmersparadox.com/2011/12/07/checking-out-a-branch-from-github/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Trappings of Agile</title>
		<link>http://www.programmersparadox.com/2011/11/09/the-trappings-of-agile/</link>
		<comments>http://www.programmersparadox.com/2011/11/09/the-trappings-of-agile/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 15:00:19 +0000</pubDate>
		<dc:creator>Mark Mzyk</dc:creator>
				<category><![CDATA[Management]]></category>
		<category><![CDATA[agile]]></category>

		<guid isPermaLink="false">http://www.programmersparadox.com/?p=1475</guid>
		<description><![CDATA[It&#8217;s easy to think that the agile movement has been around forever. It certainly feels like it has in the raging torrent that is software development time. Yet if you read the Agile Manifesto that started it all, at the bottom, in small letters, you&#8217;ll notice the copyright date. © 2001. Only ten years ago [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s easy to think that the agile movement has been around forever. It certainly feels like it has in the raging torrent that is software development time. Yet if you read the <a href="http://agilemanifesto.org/">Agile Manifesto</a> that started it all, at the bottom, in small letters, you&#8217;ll notice the copyright date.</p>
<p>© 2001.</p>
<p>Only ten years ago the agile movement formally started. I&#8217;m sure it was around informally before then. Now it&#8217;s an institution that is embodied in methodologies and programs from <a href="http://www.extremeprogramming.org/">XP</a> to <a href="http://www.scrumalliance.org/learn_about_scrum">Scrum</a>.</p>
<p>It good to read the manifesto that started it all. To see the simplicity that launched a movement. Because overtime, as is human nature, we keep adding on facets, until we forget what the original item looked like. This can be for better or worse (think a person from the 50s would recognize a TV today as a TV, if it wasn&#8217;t on?).</p>
<p>One facet we&#8217;ve added is the concept of velocity. <a href="http://jimhighsmith.com/2011/11/02/velocity-is-killing-agility/">Jim Highsmith</a> details nicely how the concept of velocity has been stretched so it chokes the agile process. A key quote:</p>
<blockquote><p>Compounding the problem, the Agile movement has focused on high levels of customer involvement—basically a good thing—but we’ve gone too far. A large number of Agilists decry that they can’t get organizations to focus on technical practices—but why should that be a surprise when we encourage product managers/owners to make all the priority decisions and then measure performance using velocity?</p></blockquote>
<p>This point is spot on. In my experience, product owners are often given complete control over priority, so technical optimizations or necessary muck work aren&#8217;t prioritized. Going back to the agile manifesto, read over the names of the original signers. They all have experience in the technical and the business sides of the equation. They intuitively know how to balance both. Now that agile has gained widespread adoption, teams do not necessarily have this experience.</p>
<p>The idea of the self organizing team needs to return to the agile movement. The team doesn&#8217;t have to be self organizing in that team members constantly change. That becomes too disruptive. The team needs to be self organizing in that the team picks the order of the work they will complete. The product owner might set priority, but it is the team that takes on the work and the order they complete it. There is obviously back and forth between the team and the product owner, but as the manifesto says: people over process. We trust that the team will organize itself, taking into consideration the wishes of the business, so that the work gets done as quickly as possible with the highest quality.</p>
<p>I think people often forget that agile is not a rigid system to be followed. It is simply a belief that change is constant, so we should favor a way of doing things that makes change easy.</p>
<p>In short, do what works for you so that you develop quality software on time. That&#8217;s the definition of agile, with all the trappings stripped away.</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.programmersparadox.com/wp-content/uploads/2011/11/developmentstarts.jpg"><img class="aligncenter size-full wp-image-1480" title="development_starts" src="http://www.programmersparadox.com/wp-content/uploads/2011/11/developmentstarts.jpg" alt="" width="500" height="333" /></a></p>
<p style="text-align: center;"><a href="http://www.flickr.com/photos/tim_d/5243205245/">And so development starts</a> / <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/deed.en">CC License</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.programmersparadox.com/2011/11/09/the-trappings-of-agile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

