<?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>22 idea street &#187; Coding</title>
	<atom:link href="http://22ideastreet.com/blog/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://22ideastreet.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 30 Jan 2012 15:24:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>The State of Ruby and Testing</title>
		<link>http://22ideastreet.com/blog/2011/06/02/the-state-of-ruby-and-testing/</link>
		<comments>http://22ideastreet.com/blog/2011/06/02/the-state-of-ruby-and-testing/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 19:54:00 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[mocking]]></category>
		<category><![CDATA[ree]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[stubbing]]></category>
		<category><![CDATA[survey]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=1135</guid>
		<description><![CDATA[At the May 2011 Indy.rb meetup, I suggested creating a survey to figure out what versions of Ruby people were using, and what testing stacks they use and would like to use. I created this survey and tweeted it out, and was impressed with the results! Over a hundred people filled out the information, from [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2011/06/02/the-state-of-ruby-and-testing/">The State of Ruby and Testing</a></p>
]]></description>
			<content:encoded><![CDATA[<p>At the May 2011 <a href="indyrb.org">Indy.rb</a> meetup, I suggested creating a survey to figure out what versions of Ruby people were using, and what testing stacks they use and would like to use. I created this survey and tweeted it out, and was impressed with the results! Over a hundred people filled out the information, from several continents and numerous countries. Thanks to everyone who participated!</p>
<h2>The questions and their results</h2>
<ul>
<li>What versions of Ruby have you ever tried out?</li>
<li>What versions of Ruby do you currently use in production or for real apps?</li>
<li>What testing frameworks are your active projects using?</li>
<li>If you were starting a new Rails project right now, what testing frameworks would you use?</li>
<li>What mocking/stubbing frameworks are your active projects using?</li>
<li>If you were starting a new Rails project right now, what mocking/stubbing frameworks would you use?</li>
<li>What do your active projects use to populate testing data?</li>
<li>If you were starting a new Rails project right now, what would you use for populating testing data?</li>
</ul>
<hr/>
<p><b>What versions of Ruby have you ever tried out?</b><br />
<img src="http://d3r8zbeodql2nc.cloudfront.net/ruby_version_used.png" width="385" height="337"/><br />
Summary: a wide variety of Ruby versions used. What the heck is kiji, you might ask? This was a useful <a href="http://engineering.twitter.com/2011/05/faster-ruby-kiji-update.html">post on kiji</a>.</p>
<hr/>
<p><b>What versions of Ruby do you currently use in production or for real apps?</b><br />
<img src="http://d3r8zbeodql2nc.cloudfront.net/ruby_version_production.png" width="385" height="337"/><br />
Summary: Mostly 1.8.7 and 1.9.2 in production use right now. REE is production-ready. <a href="http://twitter.com/share" class="twitter-share-button" data-text="What are the most popular production Ruby environments?" data-count="none" data-via="panozzaj" data-related="indyrb:The Indianapolis Ruby Brigade">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p>
<hr/>
<p><b>What testing frameworks are your active projects using?</b><br />
<img src="http://d3r8zbeodql2nc.cloudfront.net/active_testing_frameworks.png" width="385" height="337"/></p>
<hr/>
<p><b>If you were starting a new Rails project right now, what testing frameworks would you use?</b><br />
<img src="http://d3r8zbeodql2nc.cloudfront.net/wanted_testing_frameworks.png" width="385" height="337"/><br />
Conclusion: Expect to see MiniTest in more production apps in the future. <a href="http://twitter.com/share" class="twitter-share-button" data-text="MiniTest will be in more future production apps" data-count="none" data-via="panozzaj" data-related="indyrb:The Indianapolis Ruby Brigade">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p>
<hr/>
<p><b>What mocking/stubbing frameworks are your active projects using?</b><br />
<img src="http://d3r8zbeodql2nc.cloudfront.net/active_mocking_frameworks.png" width="385" height="337"/></p>
<hr/>
<p><b>If you were starting a new Rails project right now, what mocking/stubbing frameworks would you use?</b><br />
<img src="http://d3r8zbeodql2nc.cloudfront.net/wanted_mocking_frameworks.png" width="385" height="337"/><br />
Conclusion: RSpec mocks are here to stay. <a href="http://twitter.com/share" class="twitter-share-button" data-text="Why RSpec mocks are here to stay" data-count="none" data-via="panozzaj" data-related="indyrb:The Indianapolis Ruby Brigade">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p>
<hr/>
<p><b>What do your active projects use to populate testing data?</b><br />
<img src="http://d3r8zbeodql2nc.cloudfront.net/active_test_data.png" width="385" height="337"/></p>
<hr/>
<p><b>If you were starting a new Rails project right now, what would you use for populating testing data?</b><br />
<img src="http://d3r8zbeodql2nc.cloudfront.net/wanted_test_data.png" width="385" height="337"/><br />
Conclusion: Factory Girl and Machinist are going to remain popular. Rails fixtures are hanging around. <a href="http://twitter.com/share" class="twitter-share-button" data-text="Why Rails fixtures aren't going anywhere soon" data-count="none" data-via="panozzaj" data-related="indyrb:The Indianapolis Ruby Brigade">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p>
<hr/>
<h4>The Data Source</h4>
<p>Here is the <a href="https://spreadsheets.google.com/spreadsheet/ccc?key=0AoI8YzLXy1J0dDQtN3pZOHFEZDhuQTVnTVpGTkJ4N1E&#038;hl=en_US">spreadsheet of results</a> (with contact information and bad rows stripped). I didn&#8217;t spend very much time making killer visualizations, and there are some great comments in there. Highly recommended to get a feel for what people are using. Someone else could probably create a correlation table of common tool sets. For example, showing that people who use RSpec commonly use a certain mocking framework. Also, there is geographic info there, so we can see which region is on the cutting edge&#8230; <img src='http://22ideastreet.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><b>Edit:</b> A note on the charts. People could respond with multiple answers, and I just tallied the answers for each category. For example, if 50 people said they used 1.8.6 and 1.8.7 and 50 people said 1.8.7, 1.8.7 would get 2/3 of the chart (100 &#8220;votes&#8221;), and 1.8.6 would get 1/3 (50 &#8220;votes&#8221;). The graphs could have been clearer, feel free to create a better visualization with the data. Thanks to the <a href="http://news.ycombinator.com/item?id=2662216">Hacker News commenters</a> for bringing this up.</p>
<h4>Logistics</h4>
<p>I took the data, and filtered it with this script:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#!/usr/bin/env ruby</span>
&nbsp;
types = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
<span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span>ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>line<span style="color:#006600; font-weight:bold;">|</span>
  line.<span style="color:#9900CC;">strip</span>!
  types <span style="color:#006600; font-weight:bold;">+</span>= line.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;, &quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> line.<span style="color:#9900CC;">length</span> == <span style="color:#006666;">0</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
counts = <span style="color:#CC00FF; font-weight:bold;">Hash</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>
types.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>type<span style="color:#006600; font-weight:bold;">|</span>
  counts<span style="color:#006600; font-weight:bold;">&#91;</span>type.<span style="color:#9900CC;">downcase</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">+</span>= <span style="color:#006666;">1</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
counts.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>key, value<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;#{key}<span style="color:#000099;">\t</span>#{value}&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Then, I put it in an Open Office spreadsheet, cleaned up the data a bit and sorted by the number descending. I should have probably outsourced this task, as it took awhile to get things looking right. It was terrible getting the chart images out of OO though. Had to copy to Draw, then export selection to an image file&#8230;</p>
<h4>What did I miss?</h4>
<p>Is your favorite testing framework not represented here? I left out some frameworks that only one person said. Check <a href="https://spreadsheets.google.com/spreadsheet/ccc?key=0AoI8YzLXy1J0dDQtN3pZOHFEZDhuQTVnTVpGTkJ4N1E&#038;hl=en_US">the spreadsheet</a> for all of the data and some great comments. If you want to fill out the survey after having read this, <a href="https://spreadsheets.google.com/spreadsheet/viewform?hl=en_US&#038;formkey=dHJIaFVmVnVrT0lhbnY3LVZ4Y0NoZkE6MQ#gid=0"> go ahead and do so here</a>. I might update this blog post at some point in the future or create a second one with updates&#8230;</p>
<p>What else could I have done, and do you want to be notified when future surveys take place? I&#8217;d imagine something in my survey process could have been improved. Leave a comment or email me at <a href="mailto:panozzaj@gmail.com">panozzaj@gmail.com</a>!</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2011/06/02/the-state-of-ruby-and-testing/">The State of Ruby and Testing</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2011/06/02/the-state-of-ruby-and-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Write-Copy-Fix-Refactor</title>
		<link>http://22ideastreet.com/blog/2011/01/14/write-copy-fix-refactor/</link>
		<comments>http://22ideastreet.com/blog/2011/01/14/write-copy-fix-refactor/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 17:00:23 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[Streaming]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=1050</guid>
		<description><![CDATA[Was writing some code the other day, and then wanted to have similar functionality in a different area of the codebase. I did not want to directly copy and paste, as I consider this to be a very recognizable code smell. Basically, copying and pasting is a clear indicator that there is similar structure that [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2011/01/14/write-copy-fix-refactor/">Write-Copy-Fix-Refactor</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Was writing some code the other day, and then wanted to have similar functionality in a different area of the codebase. I did not want to directly copy and paste, as I consider this to be a very recognizable code smell. Basically, copying and pasting is a clear indicator that there is similar structure that is not being realized. It is similar to making up really complicated equations and models for why planets in the sky do loop-de-loops, and then understanding that they all revolve around the sun. That understanding simplifies things.</p>
<p>However, it was tough to think about what needed to be abstracted out of the solution that I was going to use. What I did was to copy the original to another area, change it to work in that context, and then factor out the common parts as best as possible to a library function. I expect to use this function a few times, so this seems to make the most sense from a flexibility and maintenance perspective.</p>
<p>Copying allowed me to clearly see the similarities and the differences so that I knew where the seams were. Just doing it in my head was not as helpful. I was overthinking it, and came up with a couple of solutions at first that were suboptimal. Then, I said, &#8220;whatever, just get it done and I can refactor from there.&#8221;  That seemed to be a better solution. Also, I felt that I did not overgeneralize the functions when I used this approach. This is a positive, as when I overgeneralize, the code becomes harder to work with in the future.</p>
<p>Note that I did indeed go back and reduce the duplication. <img src='http://22ideastreet.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Pushing it out to a nebulous &#8220;sometime&#8221; would have been quite ineffective. Instead, I promised myself &#8220;in half an hour.&#8221; I felt good about keeping this promise to myself.</p>
<p>I guess the lesson I learned was: use the materials you have to help you on your way. Whether this is temporary image files when you are preparing your website overhaul, or scraps of paper or whiteboard space, getting ideas out in physical form lessens the load on your mind. See also my post on <a href="http://22ideastreet.com/blog/2009/08/04/problem-solving-stack">streaming</a>, which I still use on a daily basis.</p>
<p>Do you have any rules of thumb for this type of situation?</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2011/01/14/write-copy-fix-refactor/">Write-Copy-Fix-Refactor</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2011/01/14/write-copy-fix-refactor/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Four Noble Truths of Coding</title>
		<link>http://22ideastreet.com/blog/2010/08/05/the-four-noble-truths-of-coding/</link>
		<comments>http://22ideastreet.com/blog/2010/08/05/the-four-noble-truths-of-coding/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 19:00:39 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Philosophy]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=1015</guid>
		<description><![CDATA[The four noble truths in Buddhism are, approximately: Life is suffering. The origin of suffering is attachment, due to ignorance. The cessation of suffering is attainable. The eight-fold path leads to liberation. I was coding happily along, and realized in a flash of insight that this applied to what I was working on. In coding, [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/08/05/the-four-noble-truths-of-coding/">The Four Noble Truths of Coding</a></p>
]]></description>
			<content:encoded><![CDATA[<p>The four noble truths in Buddhism are, approximately:</p>
<p>Life is suffering.<br />
The origin of suffering is attachment, due to ignorance.<br />
The cessation of suffering is attainable.<br />
The eight-fold path leads to liberation.</p>
<p>I was coding happily along, and realized in a flash of insight that this applied to what I was working on.</p>
<p>In coding, suffering comes from:</p>
<ul>
<li>not being comfortable making a change because you don&#8217;t quite understand how the system works</li>
<li>working hard but realizing your code is still buggy</li>
<li>a client being less than impressed by &#8220;a change that couldn&#8217;t break anything&#8221;, but did</li>
<li>not being able to refactor because you can&#8217;t see all of the implications</li>
<li>wondering if this ever really worked at all</li>
<li>having that bug pop up again, although we thought it was fixed</li>
<li>not delivering with quality and on time</li>
</ul>
<h4>The Four Noble Truths of Coding</h4>
<p>Coding is suffering.<br />
The origin of suffering is attachment, due to ignorance.<br />
The cessation of suffering is attainable.<br />
The path of executable specifications leads to liberation.</p>
<p>This is a bold statement to make.  By using automated means of capturing the assumptions present in code, one breaks the painful cycle that comes from ignorance about the code base.  Coding then becomes not suffering, nor not-not suffering, but just coding.  Instead of coding in fear, it again becomes a creative process that encourages working with others in harmony.  With automated tests of some sort, instead of having the law of cause and effect operating over the course of months, weeks, or days, feedback operates instead in terms of minutes.</p>
<p>However, there is a middle path to take here.  If one is entirely safe, one loses the creative edge that makes the project exciting and lessens nimbleness with too much process and boilerplate.  If one is too loose, one stands to let some quality slip.  Experience seems to be the best guide.</p>
<p>This thought probably emerged from reading philosophy and <i>Working Effectively With Legacy Code</i>.</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/08/05/the-four-noble-truths-of-coding/">The Four Noble Truths of Coding</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2010/08/05/the-four-noble-truths-of-coding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refactoring Tip</title>
		<link>http://22ideastreet.com/blog/2010/06/02/refactoring-tip/</link>
		<comments>http://22ideastreet.com/blog/2010/06/02/refactoring-tip/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 22:30:24 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Refactoring]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=990</guid>
		<description><![CDATA[When you have something like // connect to database code code code This might be an indicator that you can extract the code under the comment into a separate method to make things clearer and more modular. For example: public Connection connectToDatabase&#40;necessary parameters&#41; &#123; code code code &#125; This is nice because it is just [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/06/02/refactoring-tip/">Refactoring Tip</a></p>
]]></description>
			<content:encoded><![CDATA[<p>When you have something like</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// connect to database</span>
code
code
code</pre></div></div>

<p>This might be an indicator that you can extract the code under the comment into a separate method to make things clearer and more modular.</p>
<p>For example:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Connection</span> connectToDatabase<span style="color: #009900;">&#40;</span>necessary parameters<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    code
    code
    code
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This is nice because it is just as readable, and it&#8217;s harder for the description of the code block to get out of sync with what the code actually does.</p>
<p>Between when I thought of this and when I actually published it, I read <a href="http://theadmin.org/articles/2010/02/19/daily-refactor-final-extract-method-in-auth-source-ldap/">a similar blog post</a> that confirmed this thought pattern.  Fowler also talks about this in <i>Refactoring</i>.</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/06/02/refactoring-tip/">Refactoring Tip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2010/06/02/refactoring-tip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Tool For Your Toolbox:  Risk Poker</title>
		<link>http://22ideastreet.com/blog/2010/03/09/a-tool-for-your-toolbox-risk-poker/</link>
		<comments>http://22ideastreet.com/blog/2010/03/09/a-tool-for-your-toolbox-risk-poker/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 01:00:04 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Risk Poker]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=971</guid>
		<description><![CDATA[This is an idea that I read about in Managing the Design Factory (detailed outline). Around page 226, Reinertsen says: Let us start with the first source of technical risk, the high-risk subsystem. Which subsystems have high technical risk? To assess this we must perform our project-level analysis to determine how each program objective (expense, [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/03/09/a-tool-for-your-toolbox-risk-poker/">A Tool For Your Toolbox:  Risk Poker</a></p>
]]></description>
			<content:encoded><![CDATA[<p>This is an idea that I read about in <i><a href="http://www.amazon.com/Managing-Design-Factory-Donald-Reinertsen/dp/0684839911">Managing the Design Factory</a></i> (<a href="http://22ideastreet.com/blog/notes/managing-the-design-factory-outline/">detailed outline</a>).  Around page 226, Reinertsen says:</p>
<blockquote><p>
Let us start with the first source of technical risk, the high-risk subsystem.  Which subsystems have high technical risk?  To assess this we must perform our project-level analysis to determine how each program objective (expense, cost, performance, and speed) will impact profits.  Then we assess each subsystem to determine how it might impact each of these factors.  The easiest way to do this is to use a team meeting in which members estimate the downside risk for each subsystem in terms of magnitude and probability.  This can be done by having each member assess risks independently, having a discussion on why different team members have rated risk differently, and then having team members reassess risks.  The output of such a meeting is a surprisingly good understanding of project risk.  Contrary to the common view that unknown risks are most important, most teams are surprisingly aware of where they are likely to fail in a program.
</p></blockquote>
<p>This reminds me so much of the Agile practice of <a href="http://en.wikipedia.org/wiki/Planning_poker">planning poker</a> that I&#8217;m dubbing it &#8220;risk poker&#8221;.  Both practices make sense to me because they use crowdsourcing to solve the problem.  I think software teams are more aware of the risks on the project than they typically give themselves credit for, leading to the paradoxical value of this practice.  By doing this practice, teams make explicit the knowledge that they already have but are often <a href="http://22ideastreet.com/blog/2009/01/16/software-as-a-sitcom/">hesitant to act on</a> for one reason or another.</p>
<p>While doing some basic research to see if this term had been employed yet, I also stumbled across <a href="http://collaboration.csc.ncsu.edu/laurie/Security/ProtectionPoker/">protection poker</a>, which deals more with security risks.</p>
<p>Perhaps I&#8217;m reinventing the wheel and risk poker is a well-known concept with a different name.  Has anyone employed something like this on a project?</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/03/09/a-tool-for-your-toolbox-risk-poker/">A Tool For Your Toolbox:  Risk Poker</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2010/03/09/a-tool-for-your-toolbox-risk-poker/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Guilty Developer Syndrome</title>
		<link>http://22ideastreet.com/blog/2010/02/02/guilty-developer-syndrome/</link>
		<comments>http://22ideastreet.com/blog/2010/02/02/guilty-developer-syndrome/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 17:00:03 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[Guilt]]></category>
		<category><![CDATA[Personal Improvement]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=940</guid>
		<description><![CDATA[I&#8217;ve noticed that when developers have worked on a project and then someone else takes it over, they seem to feel guilty about decisions made on the project. When I ask them why certain decisions were made, they might sheepishly say, &#8220;Yeah&#8230; I know it&#8217;s not the best way to do this, and it&#8217;s not [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/02/02/guilty-developer-syndrome/">Guilty Developer Syndrome</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve noticed that when developers have worked on a project and then someone else takes it over, they seem to feel guilty about decisions made on the project.  When I ask them why certain decisions were made, they might sheepishly say, &#8220;Yeah&#8230;  I know it&#8217;s not the best way to do this, and it&#8217;s not the way I would do it now.&#8221;  Some might get defensive, or cite external constraints like schedule pressure.  But my belief is that developers should not feel strongly negative about older projects.</p>
<h4>Experience</h4>
<p>I&#8217;ll admit that I got a mulligan.  It was a Ruby on Rails project for an internal tool.  I hadn&#8217;t worked with that technology stack much before.  I kind of hacked something together based on the requirements, and it worked fine.  There were few tests, and the design definitely did not use best practices.  But it worked.</p>
<p>Next, I worked on a six-month-long Rails project using mostly TDD.  After that, an opportunity arose to clean up the internal tool and add some features.</p>
<p>It felt really good.  I felt like I knew the environment so much better, and could see where problems in the code could be easily solved using better Rails or Ruby techniques.  It was quite exciting.  At times, I was surprised that the code actually worked at all.  I think that most developers rarely get this type of opportunity unless they are on a maintenance project, and I do think it was a valuable experience to see the aftermath of my own coding.</p>
<h4>Synthesis</h4>
<p>But afterwards I came to the realization that developers shouldn&#8217;t feel guilty about producing software.  There are always going to be new technologies and practices to learn, tradeoffs to be made, and hindsight clearer than the present view.  Should I refactor this class now or later?  Should I make this easily extensible, or are we truly not going to need it?  What should we work on first to reduce the technical risk on this project?</p>
<p>After every book I read on a subject, I learn new techniques and ways of thinking about problems.  But this shouldn&#8217;t stop activity in the present.  I will never have one hundred percent of the knowledge I need, and the solutions that I come up will only satisfice the problem.</p>
<p>I&#8217;m assuming that developers are really putting their best effort forth.  This doesn&#8217;t absolve the developer from learning from their mistakes or preemptively learning.</p>
<p>I&#8217;m just trying to say that developers shouldn&#8217;t feel bad because they didn&#8217;t know enough to prevent every problem or solve every dilemma in the best way possible.  Seeing mistakes in the past for what they are just indicates growth.  Getting it right every time implies skill stagnation or perfection.  Which one is more likely?</p>
<p>Have you had an experience where you wish you could go back and change something on a software project?  A time when you read your own code and cringed?  Where&#8217;s the balance between getting things right and getting things done?  Consider leaving a comment!</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/02/02/guilty-developer-syndrome/">Guilty Developer Syndrome</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2010/02/02/guilty-developer-syndrome/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>TODO:  FIXME, HACK, and XXX</title>
		<link>http://22ideastreet.com/blog/2010/01/15/todo-fixme-hack-and-xxx/</link>
		<comments>http://22ideastreet.com/blog/2010/01/15/todo-fixme-hack-and-xxx/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 19:27:07 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Codetags]]></category>
		<category><![CDATA[Comments]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=930</guid>
		<description><![CDATA[I was wondering what people&#8217;s standards for using tags in comments like TODO, FIXME, HACK, XXX, and the like were. // TODO: implement the foo module here ... // HACK here be dragons ... // XXX ... /* FIXME: late at night, I need some sleep */ ... One advantage of using these tags is [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/01/15/todo-fixme-hack-and-xxx/">TODO:  FIXME, HACK, and XXX</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I was wondering what people&#8217;s standards for using tags in comments like TODO, FIXME, HACK, XXX, and the like were.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// TODO: implement the foo module here</span>
...
<span style="color: #666666; font-style: italic;">// HACK here be dragons</span>
...
<span style="color: #666666; font-style: italic;">// XXX</span>
...
<span style="color: #666666; font-style: italic;">/* FIXME:  late at night, I need some sleep */</span>
...</pre></div></div>

<p>One advantage of using these tags is that they are easy to search for and give an understanding of where the code can be improved.  Most IDEs even have a special view to look for these kinds of things.</p>
<p>My personal view is that writing a comment like these basically says that I should do something.  If it gets checked into source control then it&#8217;s a problem.  I should either address this right now or create a task to address the problem in the future.  In the rare case that something is urgently broken, it&#8217;s best to fix it and then immediately figure out the root cause and any ramifications, when the problem is freshest.  Delaying just adds a time cost to whoever tries to fix this in the future.  Maintainers need to ask, &#8220;Is this still relevant or important, and how do I fix it if it is?&#8221;  The second option is to put TODOs into a standard tracking system for later analysis instead.  What seems urgent to fix at this time might not matter much in the greater scheme of things, so this work should be prioritized like everything else.</p>
<p>TODOs are definitely not acceptable for commenting out large swaths of code that break the build.  The build exists for a reason&#8211;use it as a tool for creating higher quality integrated code.  If your code doesn&#8217;t integrate, it&#8217;s your problem to fix it immediately.  Commented-out tests are worse than useless because they add to the codebase and are not kept in sync with the main development line.</p>
<p>As a tangent, I usually write a date and author in comments.  Even though people can use repository annotations (svn/git blame/praise), it&#8217;s much easier to see how relevant this comment is.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// AJP20021116 - I'm not sure that this works for all values of N.</span></pre></div></div>

<p>Hence, if you were working on a project and saw this comment, it&#8217;s clear that it immediately is probably out of date or just not that important if it hasn&#8217;t been fixed in the past eight years.  If I&#8217;m still around, future developers can ask me to recall what I was thinking.</p>
<p>What are your thoughts?  Do you use TODOs in your code?  What do you use them for?  Do they make maintaining a project easier or harder?</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2010/01/15/todo-fixme-hack-and-xxx/">TODO:  FIXME, HACK, and XXX</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2010/01/15/todo-fixme-hack-and-xxx/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>git svn</title>
		<link>http://22ideastreet.com/blog/2009/09/28/git-svn/</link>
		<comments>http://22ideastreet.com/blog/2009/09/28/git-svn/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 19:00:51 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=855</guid>
		<description><![CDATA[I recently had a chance to use the Git interface to Subversion (git-svn), and it&#8217;s the best way that I&#8217;ve found to work with Subversion (SVN). Using git-svn is better than using plain SVN. The primary reasons I feel this way are that it provides a convenient staging environment and superior local branching capabilities. The [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/28/git-svn/">git svn</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I recently had a chance to use the Git interface to Subversion (git-svn), and it&#8217;s the best way that I&#8217;ve found to work with Subversion (SVN).  Using git-svn is better than using plain SVN.  The primary reasons I feel this way are that it provides a convenient staging environment and superior local branching capabilities.</p>
<p>The staging environment provided by Git means that I have a local version control system that no one else can see.  This allows me to take continually check things in without worrying about mucking up the general repository.  I like this because I can make changes quickly and check in whenever I make progress and things mostly run correctly.  This is great because I hate it when things are improving and then I make some boneheaded change to a bunch of files and can&#8217;t figure out how to get back to a working state.</p>
<p>When I&#8217;m ready to check into the shared repository (in SVN), I can do this as a separate operation.  What&#8217;s nice is that I can squash, modify, and reorder local commits so that my development history is clean of the rabbit trails that inevitably pop up.  Theoretically, the staging environment allows me to not need to run full test suites before locally committing to ensure that I don&#8217;t break the build.  This was not really a gain that I utilized though.</p>
<p>The second advantage was quick local branching capability.  This allowed me to have several streams of development going that were mostly independent of each other.  This was invaluable for quick bug fixes, and helped when work was blocked due to a client member being unreachable.  Another great advantage was the ability to have my master branch be clean and always be ready for a demo.  Git branches differ significantly from SVN branches, in that they are much faster to work with, require less space, and, perhaps most importantly, Git offers better merging capabilities.</p>
<p>Everyone else on your team can still use SVN normally, and you will see their changes if you use the correct workflow.  There are numerous sites that describe this workflow and variations of it, so I won&#8217;t detail this.  Just Google &#8216;git svn workflow&#8217;.</p>
<h4>Issues</h4>
<p><i>Attention conservation notice:  heavy Git nomenclature to follow, probably not useful for the casual reader.</i></p>
<p>I ran into a couple of problems that I&#8217;d like to discuss, and my final solution.  One issue was that I developed for quite awhile in Git and then needed to put this into the client&#8217;s SVN repository.  There are numerous risks that I should have mitigated by doing this as I was going along with the project.  I did not commit against my better judgment because I thought that my code structure might change significantly.  However, it never really did.  In the future I won&#8217;t hesitate to do this now, as the pain of messing around with version control is not really all that high.  </p>
<p>I initially was interested in keeping my development history around, but this turned out to be pretty hard based on some specific things that I did.  I think that the main reason for this is that I wanted my commit messages to have the correct name and email.  I&#8217;m pretty sure I changed this setting in ./.git/config, but something must have gone awry.  Hence, I ran a one-liner at the command line similar to the following:</p>
<pre>
git filter-branch --env-filter "export GIT_AUTHOR_NAME='&lt;my name&gt;';
                                export GIT_AUTHOR_EMAIL='&lt;my email&gt;';
                                export GIT_COMMITTER_NAME='&lt;my name&gt;';
                                export GIT_COMMITTER_EMAIL='&lt;my email&gt;'" HEAD
</pre>
<p>However, when then subsequently running git-svn commands, I received this error:  <i>Can&#8217;t call method &#8220;full_url&#8221; on an undefined value at /usr/lib/git-core/git-svn line 425.</i></p>
<p>My understanding of what this error means is that git-svn can&#8217;t find a join point between local development and your remote branch.  Running the git-svn init or clone commands sets this up correctly, but what I was doing messed it up.  I think I lost quite a bit of time by not understanding that rewriting the history at the end (which I typically did) would cause git-svn to get out of sync.  I also messed around with grafts for awhile, which probably didn&#8217;t help matters any.  I think in retrospect I probably should have only rewritten commit history for commits that I did locally, and not mess around with grafts at all.  This would have probably allowed me to just `git svn rebase` to keep my history and have a flurry of checkins with the right information.  But at this point, I was alright with losing my development history since I had already spent a bit of time working on it.</p>
<p>Once I was ready to import my changes, I found the following process to be helpful.  Basically I add SVN directories, sync with these directories, copy over the files in master from my local directory, then commit the changes and dcommit to SVN.  First, let&#8217;s add the standard SVN layout to the SVN repo.  If you&#8217;re worried about messing something up, doing this process locally first is helpful, and then doing it to a sandbox directory might be advisable.  See <a href="http://eikke.com/importing-a-git-tree-into-a-subversion-repository/">this page</a> for an example of the former.</p>
<pre>
&gt; svn co &lt;repo/folder&gt;
&gt; cd &lt;folder&gt;
&gt; mkdir trunk tags branches
&gt; svn add trunk tags branches
   A         trunk
   A         tags
   A         branches
&gt; svn commit -m "Base directory structure."
   Adding         trunk
   Adding         tags
   Adding         branches
   Committed revision 1.
</pre>
<p>Then in a clean directory, you can execute:</p>
<pre>
# the --prefix=svn/ gives you remote branches prefixed with svn/
# which helps to namespace them
&gt; git svn clone &lt;repo/folder&gt; -s --prefix=svn/
   Initialized empty Git repository in &lt;folder&gt;/.git/
   Using higher level of URL: &lt;repo/folder&gt; => &lt;repo&gt;
   W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '&lt;folder&gt;'
   W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
   This may take a while on large repositories
   r1 = &lt;treeish&gt; (svn/trunk)
   Checked out HEAD:
     &lt;repo/folder&gt; r1
&gt; cd &lt;folder&gt;
&gt; git branch -a
   * master
   svn/trunk
</pre>
<p>I&#8217;d modify your .git/config file to have the correct username / email if necessary at this point.</p>
<p>Then you can copy all of the files from your original working directory (the one where you did all of the development) <b>except for the .git directory</b>.  If you copy this over, you&#8217;ll have to start all over again.  At this point:</p>
<pre>
> git status
   # all of your files
> git add .
> git commit -m "Changes from my local repository."
   Created commit &lt;treeish&gt;: Changes from my local repository.
   ...
</pre>
<p>And finally:</p>
<pre>
# in case someone updated the SVN directory that you're working with (unlikely)
> git svn fetch
> git svn dcommit --dry-run
   Should see something about pushing to &lt;repo/folder/trunk&gt;
> git svn dcommit
   A file1
   # etc....
</pre>
<p>This should add your files in the trunk folder in the SVN repo.  Hope this helps!</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/28/git-svn/">git svn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2009/09/28/git-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regular Expression Anchor Mnemonic</title>
		<link>http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/</link>
		<comments>http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 13:51:02 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Mnemonic]]></category>
		<category><![CDATA[Regular Expression]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=816</guid>
		<description><![CDATA[In most languages, regular expressions have symbols to indicate when the first part or last part must match the first or last part of the string or line. These are called anchors. Anchors are usually the caret (^) for matching the beginning of a string, and the dollar sign ($) for the end of the [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/">Regular Expression Anchor Mnemonic</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In most languages, regular expressions have symbols to indicate when the first part or last part must match the first or last part of the string or line.  These are called anchors.  Anchors are usually the caret (^) for matching the beginning of a string, and the dollar sign ($) for the end of the string.  Hence:</p>
<pre>
'abc' =~ /c$/     => true
'abc' =~ /a$/     => false
'abc' =~ /^a/     => true
'abc' =~ /^c/     => false
</pre>
<p>I can remember what the anchors are.  When I have trouble remembering which is which, I use the following mnemonic:</p>
<blockquote><p>
Regular expressions are perfect, like the Garden of Eden.<br />
Snakes end the Garden of Eden.
</p></blockquote>
<p>In this case, the dollar sign looks a lot more like a snake than the caret does, so it&#8217;s the ending anchor.  This might be corny, or perhaps not completely accurate to the original story or the true nature of regular expressions (hairy beasts that they are), but it&#8217;s served me pretty well.</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/">Regular Expression Anchor Mnemonic</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2009/09/20/regular-expression-anchor-mnemonic/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Problem Solving Stack</title>
		<link>http://22ideastreet.com/blog/2009/08/04/problem-solving-stack/</link>
		<comments>http://22ideastreet.com/blog/2009/08/04/problem-solving-stack/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 01:33:00 +0000</pubDate>
		<dc:creator>Anthony Panozzo</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Stack]]></category>
		<category><![CDATA[Streaming]]></category>

		<guid isPermaLink="false">http://22ideastreet.com/blog/?p=722</guid>
		<description><![CDATA[I recently started a new supplementary coding technique that I have not heard about anywhere else. I&#8217;m not sure what to call it, although internally I&#8217;ve been calling it streaming, an abbreviation for stream of consciousness programming. It works by writing out how you are solving a problem. Here&#8217;s a real-life example that likely took [...]<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/08/04/problem-solving-stack/">Problem Solving Stack</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I recently started a new supplementary coding technique that I have not heard about anywhere else.  I&#8217;m not sure what to call it, although internally I&#8217;ve been calling it streaming, an abbreviation for stream of consciousness programming.  It works by writing out how you are solving a problem.</p>
<p>Here&#8217;s a real-life example that likely took place over the course of a couple of hours:</p>
<pre>
control_parsing
 Go through documents and figure out what appropriate values would be for the metadata and the control data to get it out
  Given a standard document, the ability to correctly parse out the fields
   Given a patient identifier, find the matching patient
    What API call do I use for this?
     Where is the system id of 387 coming from?  I could swear I've seen that before
      I don't think it's actually used, I think that we just use the patient identifier and the user's institution id
       Pretend we are calling the API call with the known patient identifier and user's institution id to ensure that I have the right mental model
</pre>
<h4>Process</h4>
<p>I use vim to type out my thoughts and save them a text file.  I could see marking things off by putting &#8216;#&#8217; at the beginning of the line, which for me would gray the line out, but normally I just delete things when I get done.  This results in a nice feeling of crossing things off of the list.  If I&#8217;m in the heat of solving a problem, I often don&#8217;t write or delete lines.  But when I come to a stopping point or am considering what next to do, I usually write out what I am thinking.  This minimizes overhead and preserves flow.</p>
<h4>A Tangent</h4>
<p>The subject in the first line is the git branch that I am currently working with (I typically use description-datetime-created as the branch format.)  If there is a need to switch branches, then I keep this stream around to remind me of the current state of the problem.</p>
<p>A script named cb (create branch) is how I usually create branches now with git:</p>
<pre>
#!/usr/bin/zsh
zmodload zsh/datetime
git checkout -b $1-`strftime "%Y%m%d-%H%M" $EPOCHSECONDS`
</pre>
<p>Then `cb branch_name` results in a new branch called branch_name-YYYYMMDD-HHMM.  If there is an easier way to query the time a branch was created, I&#8217;d be interested to hear it.</p>
<h4>Benefits</h4>
<p>Constantly specifying the next thing that I need to do or resolve has the benefit of keeping me conscious about what I am doing.  While I saw this with the <a href="blog/2009/02/16/the-pomodoro-technique/">pomodoro technique</a> (&#8220;how does what I&#8217;m doing relate to the current pomodoro?&#8221;), this makes the process more explicit.  I can easily track my problem-solving process and see where I might have gotten into some rabbit holes.  Sometimes I just find myself looking at a file and realizing that I have no idea how I got there.  Whenever I find myself in that situation, I immediately switch to the stream file and reorient myself to the problem I&#8217;m currently trying to solve.</p>
<p>Another benefit of the streaming technique is being able to jump back into problem solving after breaks and interruptions.  There are times when I can come back to the computer and see where the cursor is in the file and know the next thing to do, but it normally takes awhile to load the problem into my head.  Reading through my thought process seems to decrease this ramp up time.  Perhaps just writing down how I am approaching the problem makes things clearer for me the next time.</p>
<p>It seems like the problem solving process can generally be best represented as a stack, so I try to reflect this with indentation.  Sometimes it forms a bit of a tree structure, but this is likely a problem-solving smell.  If a new line does not fit cleanly under the main heading, then I examine the new direction carefully.  As a result, I tend to be more aware of when I am considering something that might increase work in progress.  Perhaps this task should be considered later, or maybe I should create a new branch before trying to implement this change.  Seeing a very long chain of things might indicate that I have too many questions or am not breaking work up effectively.</p>
<p>Like I said, it&#8217;s new, so I haven&#8217;t worked out all the kinks.  But so far it has been well worth any trouble.  Let me know what you think if you try it out for a day!</p>
<p><br/><br/>Original article:  <a href="http://22ideastreet.com/blog/2009/08/04/problem-solving-stack/">Problem Solving Stack</a></p>
]]></content:encoded>
			<wfw:commentRss>http://22ideastreet.com/blog/2009/08/04/problem-solving-stack/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

