<?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>Valuable Code</title>
	<atom:link href="http://www.valuablecode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.valuablecode.com</link>
	<description>What is it about code that makes it valuable?</description>
	<lastBuildDate>Sun, 27 Feb 2011 22:58:27 +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>Notes from a Study Group</title>
		<link>http://www.valuablecode.com/2011/02/notes-from-a-study-group/</link>
		<comments>http://www.valuablecode.com/2011/02/notes-from-a-study-group/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 22:58:27 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/?p=40</guid>
		<description><![CDATA[Here are my notes from a series of Study Group meeting where our group was studying Working Effectively with Legacy Code by Michael Feathers. I described the different Study Group roles in an earlier post. Kickoff Meeting Introductions: Does everyone know everyone else? Ice-breaker Question: What do you want to get out of this Study [...]]]></description>
			<content:encoded><![CDATA[<p>Here are my notes from a series of Study Group meeting where our group was studying <a href="http://www.informit.com/store/product.aspx?isbn=0131177052">Working Effectively with Legacy Code</a> by Michael Feathers. I described the different Study Group roles in an earlier <a href="http://www.valuablecode.com/2010/07/use-study-groups-to-support-learning/">post</a>.</p>
<hr />
<p><strong>Kickoff Meeting</strong></p>
<p>Introductions: Does everyone know everyone else?<br />
Ice-breaker Question: What do you want to get out of this Study Group?</p>
<p>Time: How long per meeting?<br />
Location: Where can we have our meetings?<br />
Frequency: Shall we meet every 1 or 2 weeks?<br />
Pace: How many pages per meeting? How much time per reading? Do we want to be speedy to get through the material or do we want to go deep?<br />
Focus: To what extent do we want to stick to the text of the reading during our meeting?<br />
Expectations: Is it okay to come to the meeting if you haven&#8217;t completed the reading?<br />
Roles: Shall we choose to follow the suggested roles?</p>
<hr />
<p><strong>Meeting One</strong></p>
<p><strong>Assigned Reading</strong>: Preface, Introduction, and Part I (Chapters 1-5).<br />
<strong>Assigned Roles</strong>: Everyone will take on the role of <em>Discussion Director</em> and <em>Technical Vocabulary Enricher</em>.</p>
<p>Opening questions:</p>
<ul>
<li>Does it make sense to create locked down APIs? For example, final classes and concrete classes hidden behind factories?</li>
<li>How does duplicate code affect our ability to preserve existing behavior? To add new behavior?</li>
<li>What dependencies in our current code base are going to give us the most problems?</li>
</ul>
<p>Technical vocabulary:</p>
<ul>
<li>Legacy Code (xvi)</li>
<li>Edit and Pray (9)</li>
<li>Unit Test (14)</li>
<li>The Legacy Code Change Algorithm (18)</li>
<li>Sensing and Separation (21)</li>
<li>Seams (30)</li>
<li>Mock Objects (47)</li>
</ul>
<p><span id="more-40"></span></p>
<hr />
<p><strong>Meeting Two</strong></p>
<p><strong>Assigned Reading</strong>: Chapter 6: <em>I Don&#8217;t Have Much Time and I have to Change It</em> and Chapter 7: <em>It Takes Forever to Make a Change</em>.<br />
<strong>Assigned Roles</strong>: Everyone will take on the role of <em>Discussion Director</em> and <em>Technical Vocabulary Enricher</em>.</p>
<p>Opening questions:</p>
<ul>
<li>Does it make sense to create a <em>Sprout Method</em> or a <em>Sprout Class</em> even when doing so degrades the design?</li>
</ul>
<p>Technical vocabulary:</p>
<ul>
<li>Sprout Method (59)</li>
<li>Sprout Class (63)</li>
<li>Wrap Method (67)</li>
<li>Wrap Class (71)</li>
</ul>
<hr />
<p><strong>Meeting Three</strong></p>
<p><strong>Assigned Reading</strong>: Chapter 9: <em>I Can&#8217;t Get This Class into a Test Harness</em>. Note: we are skipping Chapter 8: <em>How Do I Add a Feature?</em>.</p>
<p><strong>Assigned Roles</strong>: Everyone will take on the role of <em>Discussion Director</em> and <em>Technical Vocabulary Enricher</em>.</p>
<p>Opening questions:</p>
<ul>
<li>How to decide between using <em>Extract Interface</em> and <em>Extract Implementor</em>?</li>
<li>Have you ever used the <em>Null Object Pattern</em>? If so, could you illustrate with code or on the whiteboard?</li>
<li>Is there any reason to use a <em>Singleton</em>?</li>
</ul>
<p>Technical vocabulary:</p>
<ul>
<li>Construction Test (107)</li>
<li>Pass Null (111)</li>
</ul>
<p>Technical vocabulary (Dependency-Breaking Techniques):</p>
<ul>
<li>Extract Interface (362)</li>
<li>Parameterize Constructor (379)</li>
<li>Subclass and Override Method (401)</li>
</ul>
<hr />
<p><strong>Meeting Four</strong></p>
<p><strong>Assigned Reading</strong>: None.<br />
<strong>Assigned Roles</strong>: Rick and Igor will take on the role of <em>Code Connector</em>. The plan is to (1) find some code that was recently changed without using techniques from <em>Working Effectively with Legacy Code</em>; (2) bring the original code to our meeting; and (3) work through the same change using techniques from <em>Working Effectively with Legacy Code</em>.</p>
<hr />
<p><strong>Meeting Five</strong></p>
<p><strong>Assigned Reading</strong>: Chapter 10: <em>I Can&#8217;t Run This Method in a Test Harness</em> and Chapter 11: <em>I Need to Make a Change. What Methods Should I Test?</em><br />
<strong>Assigned Roles</strong>: Everyone will take on the role of <em>Discussion Director</em> and <em>Technical Vocabulary Enricher</em>.</p>
<p>Opening questions:</p>
<ul>
<li>Has anyone caught themselves doing anything differently because of what we&#8217;ve learned so far?</li>
<li>Does adherence to the Single Responsibility Principle affect testability?</li>
<li>Is anyone familiar with the Command/Query Separation design principle? If so, could you explain it to the group?</li>
<li>What is Michael Feathers advice on testing private methods?</li>
</ul>
<p>Technical vocabulary:</p>
<ul>
<li>Skin and Wrap the API (205)</li>
<li>Lean on the Compiler (315)</li>
</ul>
<p>Technical vocabulary (Dependency-Breaking Techniques):</p>
<ul>
<li>Adapt Parameter (326)</li>
<li>Expose Static Method (345)</li>
</ul>
<p>As a group we all felt that the techniques in Chapter 11 were overkill. Rather than discuss that chapter we chose to create a mindmap that captured the costs and benefits of unit testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2011/02/notes-from-a-study-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unit Test Tip: No Conditional Logic in a Test Case</title>
		<link>http://www.valuablecode.com/2011/01/unit-test-tip-no-conditional-logic-in-a-test-case/</link>
		<comments>http://www.valuablecode.com/2011/01/unit-test-tip-no-conditional-logic-in-a-test-case/#comments</comments>
		<pubDate>Sun, 30 Jan 2011 21:44:12 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/?p=39</guid>
		<description><![CDATA[I thought I&#8217;d share my response to this e-mail from a colleague: I find myself having huge arguments with someone at work about how to write unit tests. In particular, things like having ifs and loops in tests. I am wondering if you could send me resources about the format of writing unit tests. The [...]]]></description>
			<content:encoded><![CDATA[<p>I thought I&#8217;d share my response to this e-mail from a colleague: </p>
<p><em>I find myself having huge arguments with someone at work about how to write unit tests.  In particular, things like having ifs and loops in tests.  I am wondering if you could send me resources about the format of writing unit tests</em>.</p>
<p>The definitive resource is <a href="http://www.informit.com/store/product.aspx?isbn=0131495054">xUnit Test Patterns: Refactoring Test Code</a> by Gerard Meszaros. I&#8217;ve often used the book to influence people: if you don&#8217;t agree right now I will club you with this book that I&#8217;m holding. Kidding.</p>
<p>Most of the book is <a href="http://xunitpatterns.com/">online</a>. In the part of the book that describes test smells, Meszaros calls out <a href="http://xunitpatterns.com/Conditional%20Test%20Logic.html">Conditional Test Logic</a> as a code test smell. There is a section of the <a href="http://xunitpatterns.com/ResultVerification.html">Result Verification</a> chapter that describes how to Avoid Conditional Test Logic.</p>
<p>I prefer to write test code that is straight line code: no conditional logic whatsoever. I suggest you adopt this guideline and see how it works for you. I would be interested in seeing any of your tests where you felt that  conditional logic was needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2011/01/unit-test-tip-no-conditional-logic-in-a-test-case/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How Well Do You Know Eclipse?</title>
		<link>http://www.valuablecode.com/2010/09/how-well-do-you-know-eclipse/</link>
		<comments>http://www.valuablecode.com/2010/09/how-well-do-you-know-eclipse/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 04:31:48 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/?p=38</guid>
		<description><![CDATA[Eclipse is the IDE that I use for most of my software development. I&#8217;m very comfortable using Eclipse. I&#8217;ve learnt many shortcuts, techniques, and tricks that allow me to create code with very little friction between my thoughts and what I see onscreen. I&#8217;ve noticed that not everyone I pair with uses Eclipse like I [...]]]></description>
			<content:encoded><![CDATA[<p>Eclipse is the IDE that I use for most of my software development. I&#8217;m very comfortable using Eclipse. I&#8217;ve learnt many shortcuts, techniques, and tricks that allow me to create code with very little friction between my thoughts and what I see onscreen.</p>
<p>I&#8217;ve noticed that not everyone I pair with uses Eclipse like I do. So I share what I know whenever I pair. In return I&#8217;m always picking up new shortcuts, techniques, and tricks.</p>
<p>If you use Eclipse and you don&#8217;t have a pairing partner to teach you shortcuts, techniques, and tricks then you might want to look at <a href="http://eclipseone.wordpress.com/">Eclipse on E</a>. I highly recommend it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2010/09/how-well-do-you-know-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Unit Testing</title>
		<link>http://www.valuablecode.com/2010/08/introducing-unit-testing/</link>
		<comments>http://www.valuablecode.com/2010/08/introducing-unit-testing/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 18:29:00 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/?p=37</guid>
		<description><![CDATA[I&#8217;m introducing unit testing to a group of developers that are new to unit testing. Here is the list of stories that I&#8217;m using as a guide: As a developer I need to run all the unit tests before checking in. As a developer I need to understand where unit testing fits into my day-to-day [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m introducing unit testing to a group of developers that are new to unit testing. </p>
<p>Here is the list of stories that I&#8217;m using as a guide:</p>
<ul>
<li>As a <em>developer</em> I need to run all the unit tests before checking in.</li>
<li>As a <em>developer</em> I need to understand where unit testing fits into my day-to-day work.</li>
<li>As a <em>developer</em> I need to know what counts as a unit test.</li>
<li>As a <em>developer</em> I need some reference tests and example tests to get me started.</li>
<li>As a <em>developer</em> I need to understand what tools to use and how to use them.</li>
<li>As a <em>developer</em> I need to see code coverage for my unit tests.</li>
<li>As a <em>build support person</em> I need to configure the build to run all the unit tests.</li>
<li>As a <em>development manager</em> I need to see the that unit tests are being created.</li>
<li>As a <em>developer</em> or a <em>development manager</em> I need to see when a build has a failing unit test.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2010/08/introducing-unit-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Study Groups to Support Learning</title>
		<link>http://www.valuablecode.com/2010/07/use-study-groups-to-support-learning/</link>
		<comments>http://www.valuablecode.com/2010/07/use-study-groups-to-support-learning/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 21:08:53 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/?p=36</guid>
		<description><![CDATA[Supporting learning is necessary feature of any agile transition. I always advocate the creation of one or more study groups. When my kids were in middle school they learned a technique for reading and discussing a book called a Literature Circle. They taught me the technique and I&#8217;ve used it to create a study group [...]]]></description>
			<content:encoded><![CDATA[<p>Supporting learning is necessary feature of any agile transition. I always advocate the creation of one or more study groups.</p>
<p>When my kids were in middle school they learned a technique for reading and discussing a book called a <a href="http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&amp;field-keywords=literature+circles">Literature Circle</a>. They taught me the technique and I&#8217;ve used it to create a study group work agreement that I&#8217;d like to share. This particular work agreement was for a study group that was reading <a href="http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052">Working Effectively with Legacy Code</a> by <a href="http://michaelfeathers.typepad.com/">Michael Feathers</a>. Feel free to adapt it for your own study group.</p>
<p><strong>Study Group Work Agreement</strong></p>
<p>All meetings will be scheduled for Tuesdays from 12:30 to 2:00. During the first 30 minutes we will eat lunch together. All members of the Study Group are expected to be present by 1:00. If we all arrive earlier we may choose to start the formal part of the meeting prior to 1:00.</p>
<p>To amplify our effectiveness we have chosen to assign the following roles: <em>Discussion Director</em>, <em>Code Connector</em>, <em>Key Concept Illustrator</em>, and <em>Technical Vocabulary Enricher</em>. Roles will be rotated each meeting and may be assigned to more than one participant. We won&#8217;t be assigning the typical meeting roles of <em>Facilitator</em>, <em>Timekeeper</em>, and <em>Scribe</em>&mdash;it is everyone&#8217;s responsibility to discuss the material in a respectful and timely manner.</p>
<p>As <em>Discussion Director</em> your responsibility is to develop a list of questions that your group might want to discuss about the material. Don&#8217;t worry about the small details: your task is to help the group talk over the big ideas in the material and share their thoughts. You are expected to post your questions to the study group wiki.</p>
<p>As <em>Code Connector</em> your responsibility is to choose one or more examples of code from your respective project that relates to the material. The <em>Code Connector</em> is also responsible for making positive changes to their project code base using techniques from the material just covered and to present their results at the next meeting.</p>
<p>As <em>Key Concept Illustrator</em> your responsibility is to choose a few special sections of the material to talk over. The idea is to help members of the group remember one or more the important concepts from the material. Once you have made your choices decide how to share the material. You might draw a UML diagram on a white board or tell a relevant story from your own work experience.</p>
<p>As <em>Technical Vocabulary Enricher</em> your responsibility is to be on the lookout for especially important technical words that your group needs to understand such as the <em>Expose Static Method</em> dependency breaking technique. Other examples from Working Effectively with Legacy Code are <em>Sprout Method</em> and <em>Effect Sketches</em>.</p>
<p>In addition to these roles you may also want to assign the role of <em>Snack Supplier</em>. As <em>Snack Supplier</em> your responsibility is to provide your study group members with a small inexpensive snack. For example, during the study group pilot the members of the study group were treated to Maple Syrup Pie and Lindt chocolates.</p>
<p><strong>Further Reading</strong></p>
<p><a href="http://www.informit.com/articles/article.aspx?p=459617">Fearless Change: Patterns for Introducing New Ideas</a> by Mary Lynn Manns and Linda Rising<br />
<a href="http://www.industriallogic.com/papers/kh.html">Pools of Insight: A Pattern Language for Study Groups</a> by Joshua Kerievsky</p>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2010/07/use-study-groups-to-support-learning/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Can We Please Agree On What Counts as a Unit Test?</title>
		<link>http://www.valuablecode.com/2010/07/what-counts-as-a-unit-test/</link>
		<comments>http://www.valuablecode.com/2010/07/what-counts-as-a-unit-test/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 14:42:30 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[TDD]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/?p=35</guid>
		<description><![CDATA[Learning to write valuable unit tests is tough for any team. The first hurdle is to create consensus on the team as to what exactly counts as a unit test. The two definitions that I always share with any team that I&#8217;m coaching are from Michael Feathers, A Set of Unit Testing Rules, and Mike [...]]]></description>
			<content:encoded><![CDATA[<p>Learning to write valuable unit tests is tough for any team. The first hurdle is to create consensus on the team as to what exactly counts as a unit test.</p>
<p>The two definitions that I always share with any team that I&#8217;m coaching are from Michael Feathers, <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=126923">A Set of Unit Testing Rules</a>, and Mike Hill, <a href="http://anarchycreek.com/2009/05/20/theyre-called-microtests/">They’re Called Microtests</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2010/07/what-counts-as-a-unit-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Porting My Blog</title>
		<link>http://www.valuablecode.com/2010/05/porting-my-blog/</link>
		<comments>http://www.valuablecode.com/2010/05/porting-my-blog/#comments</comments>
		<pubDate>Sat, 01 May 2010 10:58:58 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/?p=1</guid>
		<description><![CDATA[Blogger have changed their infrastructure and no longer support ftp hosting. Please be patient while I transfer my old blog posts.]]></description>
			<content:encoded><![CDATA[<p>Blogger have changed their infrastructure and no longer support ftp hosting.</p>
<p>Please be patient while I transfer my old blog posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2010/05/porting-my-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How a Code Retreat Taught Me to Be Comfortable Throwing Away Code</title>
		<link>http://www.valuablecode.com/2009/09/how-a-code-retreat-taught-me-to-be-comfortable-throwing-away-code/</link>
		<comments>http://www.valuablecode.com/2009/09/how-a-code-retreat-taught-me-to-be-comfortable-throwing-away-code/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 20:51:00 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/2009/09/how-a-code-retreat-taught-me-to-be-comfortable-throwing-away-code/</guid>
		<description><![CDATA[Can you believe that I passed up a beautiful August weekend, at a cottage on a pristine lake just outside Algonquin Park, to spend the day back in the hot, humid city writing code for 45 minutes at a time and immediately throwing the code away? I can hardly believe it myself. The code retreat [...]]]></description>
			<content:encoded><![CDATA[<p>Can you believe that I passed up a beautiful August weekend, at a cottage on a pristine lake just outside Algonquin  Park, to spend the day back in the hot, humid city writing code for 45 minutes at a time and immediately throwing the code away? I can hardly believe it myself.</p>
<p>The code retreat started at 8:30am, bright and early, on Saturday, August 8. The retreat was hosted by <a href="http://mikedebo.ca/">Mike DiBernardo</a> at the <a href="http://www.platespin.com/">PlateSpin</a> office and led by <a href="http://www.jbrains.ca/">Joe (J.B.) Rainsberger</a> and <a href="http://www.coreyhaines.com/">Corey Haines</a>.</p>
<p>Corey needed a place to stay in Toronto so I offered him a place <em>chez moi</em> (lots of room because the rest of my family was, naturally, at the cottage swimming in the pristine lake). Early Saturday morning Corey and I took the <a href="http://rosemaryrowe.typepad.com/creampuff_revolution/WindowsLiveWriter/CreampuffAddendum_104FE/1780516-TTC_streetcar_downtown_Toronto%5B2%5D.jpg">Red Rocket</a> from my place in Kensington Market to Platespin.</p>
<p>After some bagels and coffee, Corey and Joe introduced us participants to the structure of the code retreat: work in focused sessions of 45 minutes; use Java because it is a straight forward language that most everyone understands; develop the code in pairs (or triples); switch pairs after each session; pick at least one thing as the learning objective for each session; and, finally, throw the code away after each session.</p>
<p>What? Throw away the code after each session? Delete the code from version control too?</p>
<p>Yep. I found it quite difficult to throw away the first session&#8217;s code. However, by the end of the code retreat I was happily throwing away my code.</p>
<p>The goal of a code retreat is to practice programming rather than to accomplish a programming task. The structure of the code retreat cleverly supported this goal in the following ways:</p>
<ol>
<li>Starting as 8:30 in the morning on a summer Saturday guarantees only keen participants who wanted to learn;</li>
<li>45 minutes is too short to complete an implementation of Conways&#8217;s <a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life">Game of Life</a>;</li>
<li>While one participant characterized Java as a “baby” language, I think the choice was a good one because we didn&#8217;t spend a whole lot of time getting past basic understanding which we might have done had we chosen some other language;</li>
<li>Pairing and frequent pair switching are practices that emphasise learning rather than immediate productivity;</li>
<li>Because every pair was asked to choose one learning goal for each session the programming in each session felt like deliberate practice;</li>
<li>Throwing away the code each time was liberating because I could start a session with a new pair without either one of us having to understand the code that we had just written in the previous session.</li>
</ol>
<p>Here are some of the deliberate learning goals that my pairs and I chose: don&#8217;t use if statements, work inside out by implementing the survival rules for a single cell, write tests using mock objects, and work outside in by writing tests using a DSL to describe the transition from one generation to the next.</p>
<p>Most of the code that I wrote with my pair was awkward and not worth keeping. But that is okay. As <a href="http://chadfowler.com/">Chad Fowler</a> writes in his book, <a href="http://www.pragprog.com/titles/cfcar2/the-passionate-programmer">The Passionate Programmer</a>, <em>if I sit down to practice coding and nothing but elegant code comes out, I&#8217;m probably sitting near the “center” of my current capabilities instead of the edges, where a good practice session should place me.</em></p>
<p>The code retreat reminded me how important it is to make time for deliberate practice. That is, make time where it is okay to ignore the strong pull of completing tasks and instead give myself a chance to experiment, learn, and practice my craft.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2009/09/how-a-code-retreat-taught-me-to-be-comfortable-throwing-away-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Time to Impose a Requirements Tax On Your Project?</title>
		<link>http://www.valuablecode.com/2009/08/time-to-impose-a-requirements-tax-on-your-project/</link>
		<comments>http://www.valuablecode.com/2009/08/time-to-impose-a-requirements-tax-on-your-project/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 21:41:00 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/2009/08/time-to-impose-a-requirements-tax-on-your-project/</guid>
		<description><![CDATA[I&#8217;ve been reading and enjoying these beautiful O&#8217;Reilly books: Beautiful Architecture, Beautiful Code, and Beautiful Teams. I have yet to read these other titles from the collection: Beautiful Data, Beautiful Security, and Beautiful Testing. Those books will have to wait because the O&#8217;Reilly book that I&#8217;m reading right now is Masterminds of Programming. I want [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reading and enjoying these beautiful <a href="http://oreilly.com/">O&#8217;Reilly</a> books: <a href="http://oreilly.com/catalog/9780596517984/">Beautiful Architecture</a>, <a href="http://oreilly.com/catalog/9780596510046/">Beautiful Code</a>, and <a href="http://oreilly.com/catalog/9780596518028/">Beautiful Teams</a>. I have yet to read these other titles from the collection: <a href="http://oreilly.com/catalog/9780596157111/">Beautiful Data</a>, <a href="http://oreilly.com/catalog/9780596527488/">Beautiful Security</a>, and <a href="http://oreilly.com/catalog/9780596159818/">Beautiful Testing</a>.</p>
<p>Those books will have to wait because the O&#8217;Reilly book that I&#8217;m reading right now is <a href="http://oreilly.com/catalog/9780596515171/">Masterminds of Programming</a>. I want to share something that Tom Love wrote on page 248:</p>
<blockquote><p>
I just handed out to some of my friends this week a big pile of buttons with the word REQUIREMENTS and a red slash through it like a European road sign. On the back of the button are 14 acceptable alternatives to that word. Lots of discussions go on between individuals or between groups of the form of &#8220;I couldn&#8217;t do this work because you didn&#8217;t give me the requirements yet,&#8221; or &#8220;We need to have a group of people that goes out and gathers the requirements for this new system.&#8221;</p>
<p>The term is simply too imprecise. You need to have more precise terms as an alternative. On a big project that I&#8217;ve been involved in we have imposed a requirements tax. If anybody uses the word &#8220;requirements&#8221; standalone, they have to add $2.00 to the entertainment fund. If they want to talk about use cases, or if they want to talk about story cards, or they want to talk about performance metrics, or they want to talk about business cases or business process models, those are all acceptable terms. They don&#8217;t incur a tax, because now if you say, &#8220;I need to have the use cases or the functional specification, or a mockup of the application that needs to be developed,&#8221; that&#8217;s a precise request.
</p></blockquote>
<p>Let it be known that I will no longer use the word &#8220;requirements&#8221; standalone. If you catch me, I&#8217;ll buy you a beer. Now if <em>you</em> use the word &#8220;requirements&#8221; standalone, I&#8217;m likely to just get angry. Dear reader, you have been warned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2009/08/time-to-impose-a-requirements-tax-on-your-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What Is That Smell?</title>
		<link>http://www.valuablecode.com/2009/08/what-is-that-smell/</link>
		<comments>http://www.valuablecode.com/2009/08/what-is-that-smell/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 08:37:00 +0000</pubDate>
		<dc:creator>Alistair McKinnell</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.valuablecode.com/2009/08/what-is-that-smell/</guid>
		<description><![CDATA[Do not add an equals() method to a class to make test writing easier. I did just that a few months ago and have only just discovered the consequences. I quite like JUnit assertThat() syntax. I wanted to write this test assertion: However, the test assertion failed to work when I first executed my test [...]]]></description>
			<content:encoded><![CDATA[<p>Do not add an <code>equals()</code> method to a class to make test writing easier. I did just that a few months ago and have only just discovered the consequences.</p>
<p>I quite like <a href="http://www.junit.org/">JUnit</a> <code>assertThat()</code> syntax. I wanted to write this test assertion:</p>
<pre class="brush: java; title: ; notranslate">
assertThat(sut.collapse(rawResults),
    hasItems(expectedBloodPressure_1, expectedBloodPressure_2));
</pre>
<p>However, the test assertion failed to work when I first executed my test because I needed an <code>equals()</code> method on the <code>Result</code> class that treated <code>Result</code> like a value object. That is, I wanted to test for equality based on the values of all the <code>Result</code> fields. Without thinking through the consequences, I added this method:</p>
<pre class="brush: java; title: ; notranslate">
public boolean equals(Object obj) {
  return EqualsBuilder.reflectionEquals(this, obj);
}
</pre>
<p>Nice. Using the <a href="http://commons.apache.org/lang/api-release/index.html">Apache Commons</a> <code>EqualsBuilder.reflectionEquals()</code> method was simple and clear.</p>
<p>End of story. New code tested with an expressive and easy to write unit test. Not quite.</p>
<p>In the same application, during an overnight process that synchronizes changes from a data warehouse, new results are extracted, transformed, and loaded into the application.</p>
<p>I was doing some performance analysis to try to speed up this process and I noticed that most of the time was spent talking to the data warehouse. No surprise there. I scanned down to locate the first method that was not in the JDBC driver or in the JDBC library and found the equals() method on <code>Result</code>. It was being called over 700,000 times. What had previously been a super fast address comparison was now a reflection based equals. Yikes.</p>
<p>Clearly, adding an <code>equals()</code> method to make test writing easier was a bad idea. Gerard Meszaros categorizes this <a href="http://xunitpatterns.com/Test%20Logic%20in%20Production.html">smell</a> as a special case of <em>Test Logic in Production</em> that he has named <em>Equality Pollution</em>.</p>
<p>So, what did I learn? One, no test logic in production  code. Two, never do performance tuning without a <a href="http://www.ej-technologies.com/products/jprofiler/overview.html">tool</a> that lets you see what is actually going on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.valuablecode.com/2009/08/what-is-that-smell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

