<?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>Chris Johnston &#187; Programming</title>
	<atom:link href="http://www.fuzzylizard.com/archives/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fuzzylizard.com</link>
	<description>Web development and design with a little VFX thrown in for fun</description>
	<lastBuildDate>Sun, 30 Oct 2011 14:23:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Code Formatting, Discuss the Spirit and not the Law</title>
		<link>http://www.fuzzylizard.com/archives/2011/07/20/1099/</link>
		<comments>http://www.fuzzylizard.com/archives/2011/07/20/1099/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 04:00:06 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[craftsmanship]]></category>
		<category><![CDATA[refactoring]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/?p=1099</guid>
		<description><![CDATA[One thing that always amazes me is the discussions that come up when a group of developers start talking about code formatting. I am taking my team through &#8220;Clean Code: A Handbook of Agile Software Craftsmanship&#8221; by Robert Martin. We just discussed chapters 4 and 5 on Comments and Formatting respectively. For the most part, [...]]]></description>
			<content:encoded><![CDATA[<p>One thing that always amazes me is the discussions that come up when a group of developers start talking about code formatting. I am taking my team through &#8220;<a href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?ie=UTF8&#038;qid=1311219977&#038;sr=8-1" title="Clean Code">Clean Code: A Handbook of Agile Software Craftsmanship</a>&#8221; by Robert Martin. We just discussed chapters 4 and 5 on Comments and Formatting respectively. </p>
<p>For the most part, everyone agreed with all that was presented in the Comments chapter, but once we got to the Formatting part, the real discussions started. There were three points in particular that people disagreed on:</p>
<ul>
<li>How to indent the <code>private</code> and <code>protected</code> keywords</li>
<li>How to indent continuation lines, i.e., when a line gets too long</li>
<li>And finally, how to indent, or line up, hashes</li>
</ul>
<p>You would think that by now this wouldn&#8217;t surprise me anymore. I know developers are passionate about their tools and the code that they craft with those tools, and this includes code formatting. What always surprises me is the speed at which developers want to quantify and codify what the formatting should be. I have seen teams waste hours discussing whether a method should be capped at 4 lines or 5 lines.</p>
<p>For me, this kind of discussion is useless and completely misses the point. Developers should be discussing what the code is telling them in terms of refactoring and not the legal length for a method should be. Discussions should revolve around method and variable names, delegation and decoration, and extracting or inlining variables, methods, and classes.</p>
<p>Thankfully, my team is incredible and the final decision regarding formatting was to allow each dev to determine the guidelines for themselves with the overriding principle being readability and clarity.</p>
<p>I am also finding it amazing how quickly the team is adapting to the ideas in &#8220;Clean Code&#8221; and applying them to the code they are creating. In just a few weeks good method and variable naming and making code readable have become major concerns and are quickly becoming a standard part of everyone&#8217;s pairing experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2011/07/20/1099/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advice for experienced devs when pairing with freshers</title>
		<link>http://www.fuzzylizard.com/archives/2009/02/11/1012/</link>
		<comments>http://www.fuzzylizard.com/archives/2009/02/11/1012/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 10:01:11 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/?p=1012</guid>
		<description><![CDATA[Siva Jagadeesan has posted an interesting article titled, &#8220;Fresher and Experienced Developers &#8211; Friends or Enemies ?&#8221; In the article he lists some of the advantages and problems of pairing freshers with experienced devs. He touches on many of the problems I have with pairing and does a much better job expressing some of my [...]]]></description>
			<content:encoded><![CDATA[<p>Siva Jagadeesan has posted an interesting article titled, &#8220;<a href="http://bizdriven.blogspot.com/2009/02/fresher-and-experienced-developers.html">Fresher and Experienced Developers &#8211; Friends or Enemies ?</a>&#8221; In the article he lists some of the advantages and problems of pairing freshers with experienced devs. He touches on many of the problems I have with pairing and does a much better job expressing some of my frustrations then I did.</p>
<p>I think I fall somewhere in between a fresher and an experienced developer, but I can definitely relate to all the problems listed. It is amazing how your morale suffers after 5 days watching someone else code cause you don&#8217;t know enough to contribute.</p>
<p>I have a problem with the solutions Siva gives though because they all seem to be aimed at the fresher. It takes two to have a problem and as such would like to offer up some advice to the experienced dev:</p>
<ol>
<li>Be patient and allow your pair to make mistakes to the point where they get themselves in trouble. We learn best from our mistakes.</li>
<li>Even if your pair is moving slowly, stay focused on the task at hand. I really hate when I start driving and my pair immediately starts doing something on his notebook computer.</li>
<li>Ask for and accept feedback from your pair, you are not always right regardless of how experienced you are.</li>
<li>Pairing is about more then just finishing a given story card, make sure you also teach. And teach more then just the task at hand, make sure you also teach the overall context.</li>
<li>Accept the possibility that your pair may know more then you in some area and be prepared to learn from them</li>
<li>Do not just jump all over the code base, wildly scrolling through pages. Slow down and explain what you are doing and what you are looking for.</li>
</ol>
<p>Also, one thing I think we miss is that fresher is both someone new to programming, e.g., someone just out of university, but also to someone new to the code base.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2009/02/11/1012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Note to self; Mockito cannot stub final methods</title>
		<link>http://www.fuzzylizard.com/archives/2008/08/23/973/</link>
		<comments>http://www.fuzzylizard.com/archives/2008/08/23/973/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 10:56:24 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Java Frameworks]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/?p=973</guid>
		<description><![CDATA[I realize this is clearly stated on the Mockito website, but it caught myself and my pair up for a little while. we were trying to stub out a ResourceBundle using Mockito and found that the unit test kept trying to find a concrete implementation of the ResourceBundle. The reason, we figured out is that [...]]]></description>
			<content:encoded><![CDATA[<p>I realize this is clearly stated on <a href="http://code.google.com/p/mockito/">the Mockito website</a>, but it caught myself and my pair up for a little while. we were trying to stub out a <code>ResourceBundle</code> using Mockito and found that the unit test kept trying to find a concrete implementation of the <code>ResourceBundle</code>. The reason, we figured out is that the <code>ResourceBundle.getString()</code> method is final and Mockito cannot mock or stub final methods. Something to keep in mind when working with this mocking framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2008/08/23/973/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playing with C# 3.0 and .NET 3.5</title>
		<link>http://www.fuzzylizard.com/archives/2008/07/02/949/</link>
		<comments>http://www.fuzzylizard.com/archives/2008/07/02/949/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 05:00:28 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/?p=949</guid>
		<description><![CDATA[It has been quite a while since my last post. Mostly that is because I have been fairly busy with a new project and busy trying to get my sorry butt into shape (it is amazing how much time exercising can take up). Anyway, the new project uses C# 3.0 and .NET 3.5, ASP.NET MVC [...]]]></description>
			<content:encoded><![CDATA[<p>It has been quite a while since my last post. Mostly that is because I have been fairly busy with a new project and busy trying to get my sorry butt into shape (it is amazing how much time exercising can take up). Anyway, the new project uses C# 3.0 and .NET 3.5, <a href="http://www.asp.net/mvc/">ASP.NET MVC</a> and <a href="http://jquery.com/">jQuery</a>. All three are new to me and I have to say that I really like all three.</p>
<p>C# 3.0 is a really nice language. It seems to have gotten generics correct making for some really nice code, especially were the database layer is concerned. We are using LINQ to SQL and we have been able to implement a single class for the repository which works with whatever model object type we give it. I also really like the inclusion of Lambdas and delegates, which make for some very clean code constructs and are much cleaner then anonymous methods in Java.</p>
<p>The second new technology to me is <a href="http://www.asp.net/mvc/">ASP.NET MVC</a>. This allows us to do ASP.NET without actually using ASP.NET. Currently, it is still in preview releases, but it is definitely heading in the right direction. Everything (with the possible exception of views) is completely and easily testable. This means no more having to hide functionality behind presenters or controllers and hoping it works in the code behind. Controllers are completely testable right down to testing what views or redirects they return.</p>
<p>The last new thing I am using is <a href="http://jquery.com/">jQuery</a>. I fully understand why it is becoming the defacto Javascript library. To do most things only require a few lines of jQuery Javascript and its AJAX and JSON capabilities are incredible. One nice thing about ASP.NET MVC is that it is capable of returning JSON results with a single line of code. This makes working with <a href="http://jquery.com/">jQuery</a> seamless.</p>
<p>If you are starting a new .NET web project, definitely check out <a href="http://www.asp.net/mvc/">ASP.NET MVC</a>, C# 3.0 and <a href="http://jquery.com/">jQuery</a>. If you are new to C# 3.0 then check out the book <a href="http://www.manning.com/skeet/">C# in Depth</a>. It highlights all the changes since 1.1 in a nice concise format that will bring you up to speed quickly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2008/07/02/949/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A walk-through of Git</title>
		<link>http://www.fuzzylizard.com/archives/2008/05/15/942/</link>
		<comments>http://www.fuzzylizard.com/archives/2008/05/15/942/#comments</comments>
		<pubDate>Thu, 15 May 2008 05:04:55 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/?p=942</guid>
		<description><![CDATA[If you are starting to work with Git, then have a read through this excellent introductory walk-through.]]></description>
			<content:encoded><![CDATA[<p>If you are starting to work with Git, then have a read through this excellent <a href="http://cworth.org/hgbook-git/tour/">introductory walk-through</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2008/05/15/942/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Two-Pizza Teams</title>
		<link>http://www.fuzzylizard.com/archives/2008/05/15/941/</link>
		<comments>http://www.fuzzylizard.com/archives/2008/05/15/941/#comments</comments>
		<pubDate>Thu, 15 May 2008 05:01:28 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/?p=941</guid>
		<description><![CDATA[The idea of Two-Pizza Teams has been around for a few years, but I just saw it a couple of days ago. I think it is the best term I have seen describing the optimal software development team size. The idea is that your team should contain no more people than can be fed by [...]]]></description>
			<content:encoded><![CDATA[<p>The idea of <a href="http://www.learningapi.com/blog/archives/000079.html">Two-Pizza Teams</a> has been around for a few years, but I just saw it a couple of days ago. I think it is the best term I have seen describing the optimal software development team size. The idea is that your team should contain no more people than can be fed by two pizzas. To give this a figure, a team of 5 &#8211; 10 people is perfect.</p>
<p>The idea behind this is that you shave off small problems and give them to small teams to solve. The team is completely autonomy and owns both the problem and the solution. This allows the team to innovate and create the best possible solution. In addition, since the team is so small, communication is fast and everyone stays on the same page throughout the project.</p>
<p>I think there are a few other advantages to having small teams which are:</p>
<ul>
<li>There is nowhere for anyone to hide. It is easy to recognize the dead wood and build small, efficient teams of highly skilled people</li>
<li>There is no space for specialization. Everyone on the team has to become proficient in every area within their discipline and beyond. A specialization represents a possible bottleneck, so everyone has to learn how to do all the different jobs. For example, you wouldn&#8217;t want a dedicated DBA so all the devs needs learn how to work with the database. The result is poly-skilled workers who are able to move from team to team and from technology to technology and have richer tool sets with which to solve problems.</li>
</ul>
<p>The best anecdote I have heard comes from IBM. Apparently, there were two teams at IBM both of which were trying to develop the same software. One was large and the other small. The software was non-trivial, something like an operating system. Software that you would expect a large to team to have to handle. In the end, the large team was over budget, over time and did not meet all the requirements while the small team met everyone of their milestones and their version contained all the features. (I believe this is properly documented in <a href="http://www.amazon.com/Mythical-Man-Month-Software-Engineering-Anniversary/dp/0201835959">The Mythical Man-Month</a>)</p>
<p>In reading about this idea, I came across several blogs that basically said there are some problems that <strong>must</strong> be solved by large teams. I think the above example proves this wrong. </p>
<p>One last thought about this is that teams should always have an odd number of people on them. This way, there is always someone to break the tie.</p>
<p>Other links:</p>
<ul>
<li><a href="http://www.37signals.com/svn/archives2/three_people_for_version_1.php">37Signals &#8211; 3 people for version 1</a></li>
<li><a href="http://www.37signals.com/svn/posts/995-if-youre-working-in-a-big-group-youre-fighting-human-nature">37Signals &#8211; If you’re working in a big group, you’re fighting human nature</a></li>
<li><a href="http://www.fastcompany.com/magazine/85/bezos_4.html">FastCompany &#8211; Inside the Mind of Jeff Bezos</a></li>
<li><a href="http://www.paulgraham.com/boss.html">Paul Graham &#8211; You Weren&#8217;t Meant to Have a Boss</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2008/05/15/941/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shaving with Ockham &#8211; Jim Weirich&#8217;s brilliant presentation on simplicity</title>
		<link>http://www.fuzzylizard.com/archives/2008/04/23/936/</link>
		<comments>http://www.fuzzylizard.com/archives/2008/04/23/936/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 04:08:43 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/?p=936</guid>
		<description><![CDATA[Jim Weirich gave a brilliant presentation called Shaving with Ockham this year at MountainWest RubyConf 2008. His premise was K.I.S.S &#8211; Keep it Simple Stupid. The presentation is both entertaining and educational. And at the very least, it servers as an excellent introduction to LISP. Weirich takes the audience for a walk through the various [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://onestepback.org/">Jim Weirich</a> gave a brilliant presentation called <a href="http://mtnwestrubyconf2008.confreaks.com/15weirich.html">Shaving with Ockham</a> this year at <a href="http://mtnwestrubyconf.org/">MountainWest RubyConf 2008</a>. His premise was K.I.S.S &#8211; Keep it Simple Stupid. The presentation is both entertaining and educational. And at the very least, it servers as an excellent introduction to LISP.</p>
<p>Weirich takes the audience for a walk through the various programing languages that he has used over his career. These include LISP, FORTH, Erlang, and something resembling Java/JSP. He then extracts a few simple rules from each of the first three languages that make them simple and very powerful. These elements are a small core, simple rules, and powerful abstractions. </p>
<p>Along with showing simplicity, Weirich also analyzes why programmers make complicated, complex programs. He suggests that it because we like to solve complicated, complex problems with complex solutions. We get so intent on solving a problem that we do not look around to see if there is a simple solution.</p>
<p>The presentation ends with <a href="http://en.wikipedia.org/wiki/Occam's_Razor">Ockham&#8217;s razor</a>: &#8220;entia non sunt multiplicanda praeter necessitatem&#8221;, or &#8220;entities should not be multiplied beyond necessity&#8221;. Also known as, &#8220;all other things being equal, the simplest solution is the best&#8221;. This is definitely a video that every programmer should watch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2008/04/23/936/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speed Bumps</title>
		<link>http://www.fuzzylizard.com/archives/2008/03/13/927/</link>
		<comments>http://www.fuzzylizard.com/archives/2008/03/13/927/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 02:16:43 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/archives/2008/03/13/927/</guid>
		<description><![CDATA[The last project I was on, I attempted to be very disciplined and do test-driven development all the time. This didn&#8217;t also work out. Far too often I found myself writing code for which I hadn&#8217;t written tests first for. I would have to stop myself and write a test first. Similar to driving, the [...]]]></description>
			<content:encoded><![CDATA[<p>The last project I was on, I attempted to be very disciplined and do test-driven development all the time. This didn&#8217;t also work out. Far too often I found myself writing code for which I hadn&#8217;t written tests first for. I would have to stop myself and write a test first. Similar to driving, the tests acted as speed bumps preventing me from going to fast.</p>
<p>Most of the time, writing tests was fine. They forced me to think about what I was doing. Instead of creating single, long methods that did more then one thing, the tests forced me to create small, single purpose methods. This resulted in cleaner code that was easier to test and easier to work with. And it also resulted in a much clearer understanding of the solution that I creating.</p>
<p>However, there were times when I knew exactly what I wanted to code and how to code it. This is where the speed bumps came in. Instead of just forging ahead and programming, I had to stop and create tests. And I must admit, far to often, I coded my solution first and created tests after. And far too often, I had to recode what I had done because it wasn&#8217;t testable. So the speed bumps, although frustrating at times, in the end proved to be the better way to code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2008/03/13/927/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Any tips for writing mapping code?</title>
		<link>http://www.fuzzylizard.com/archives/2008/01/10/917/</link>
		<comments>http://www.fuzzylizard.com/archives/2008/01/10/917/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 05:54:44 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/archives/2008/01/10/917/</guid>
		<description><![CDATA[Currently at work I am writing mapping code. Code that takes values from one anemic object model to another anemic object model to another anemic object model. Aside from the usual iteration code, most of the code is comprised of this.setSomething(other.getSomething());. Unfortunately, this code does not map one-to-one from one model to another. Being new [...]]]></description>
			<content:encoded><![CDATA[<p>Currently at work I am writing mapping code. Code that takes values from one anemic object model to another anemic object model to another anemic object model. Aside from the usual iteration code, most of the code is comprised of <code>this.setSomething(other.getSomething());</code>. Unfortunately, this code does not map one-to-one from one model to another.</p>
<p>Being new to this kind of coding, I am wondering if anyone has any tips, tricks, or patterns. We are trying to avoid having a large (1000+ line) class filled with procedural, linear code. So we have a bunch of utility, finder and builder methods and classes. This has made something better, but I am wondering if we could do more.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2008/01/10/917/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Rewrite or Refactor?</title>
		<link>http://www.fuzzylizard.com/archives/2007/11/22/911/</link>
		<comments>http://www.fuzzylizard.com/archives/2007/11/22/911/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 05:06:17 +0000</pubDate>
		<dc:creator>Chris Johnston</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.fuzzylizard.com/archives/2007/11/22/911/</guid>
		<description><![CDATA[When you inherit code, how do you know when to spend time refactoring a particular class versus simply throwing that class out and rewriting it? How bad does a class, method, package, section of code have to be to warrant rewriting it? On my current project, we have a few classes that are 1000s of [...]]]></description>
			<content:encoded><![CDATA[<p>When you inherit code, how do you know when to spend time refactoring a particular class versus simply throwing that class out and rewriting it? How bad does a class, method, package, section of code have to be to warrant rewriting it?</p>
<p>On my current project, we have a few classes that are 1000s of lines of code in length with maybe one or two methods. These classes are very procedural and generally only have one unit test. (On the up side, they have about 80% code coverage) The powers that be have decided to scrap the current code and rewrite it. Under these circumstances,  definitely agree with, and helped push, this decision. But this is a fairly extreme example.</p>
<p>Is this decision only faced in these extreme examples, or are there other legitimate reasons for rewriting code? In my experience, rewriting the code, if done properly (e.g., with refactoring and using TDD), would be faster and result in better results then refactoring.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fuzzylizard.com/archives/2007/11/22/911/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

