<?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>Steve Freeman</title>
	<atom:link href="http://www.m3p.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.m3p.co.uk</link>
	<description>Working software daily</description>
	<lastBuildDate>Fri, 23 Jul 2010 14:15:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Bad code isn&#8217;t Technical Debt, it&#8217;s an unhedged Call Option</title>
		<link>http://www.m3p.co.uk/blog/2010/07/23/bad-code-isnt-technical-debt-its-an-unhedged-call-option/</link>
		<comments>http://www.m3p.co.uk/blog/2010/07/23/bad-code-isnt-technical-debt-its-an-unhedged-call-option/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 14:15:15 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[Software culture]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=503</guid>
		<description><![CDATA[I&#8217;d been meaning to write this up for a while, and now Nat Pryce has written up the 140 character version.



This is all Chris Matts&#8216; idea. He realised that the problem with the &#8220;Technical Debt&#8221; metaphor is that for managers debt can be a good thing. Executives can be required to take on more debt [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: 0.8em">I&#8217;d been meaning to write this up for a while, and now Nat Pryce has written up the <a href="http://twitter.com/natpryce/status/19286162811">140 character version</a>.</span></p>

<p><span><img style="float:right" src="http://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Short_call_option.svg/200px-Short_call_option.svg.png" alt="Payoff from writing a call." /></span></p>

<p>This is all <a href="http://abc.truemesh.com/">Chris Matts</a>&#8216; idea. He realised that the problem with the &#8220;Technical Debt&#8221; metaphor is that for managers debt can be a good thing. Executives can be required to take on more debt because it makes the finances work better, it might even be encouraged by tax breaks. This is not the same debt as your personal credit card. Chris came up with a better metaphor, the <em>Call Option</em>.</p>

<p>I &#8220;write&#8221; a <a href="http://en.wikipedia.org/wiki/Call_option">Call Option</a> when I sell someone the right, but not the obligation, to buy in the future an agreed quantity of something at an price that is fixed now. So, for a payment now, I agree to sell you 10,000 chocolate santas<sup class="footnote"><a href="#fn1">1</a></sup> at 56 pence each, at any time up to 10th December. You&#8217;re prepared to pay the premium because you want to know that you&#8217;ll have santas in your stores at a price you can sell.</p>

<p>From my side, if the price of the santas stays low, I get to keep your payment and I&#8217;m ahead. But, I also run the risk of having to provide these santas when the price has rocketed to 72 pence. I can protect myself by making arrangements with another party to acquire them at 56 pence or less, or by actually having them in stock. <em>Or</em>, I can take a chance and just collect the premium. This is called an unhedged, or <a href="http://en.wikipedia.org/wiki/Naked_call">&#8220;Naked&#8221;</a>, Call. In the financial world this is risky because it has unlimited downside, I have to supply the santas <em>whatever</em> they cost me to provide.</p>

<p>Call options are a better model than debt for cruddy code (without tests) because they capture the unpredictability of what we do. If I slap in an a feature without cleaning up then I get the benefit immediately, I collect the premium. If I never see that code again, then I&#8217;m ahead and, in retrospect, it would have been foolish to have spent time cleaning it up.</p>

<p>On the other hand, if a radical new feature comes in that I have to do, all those quick fixes suddenly become very expensive to work with. Examples I&#8217;ve seen are a big new client that requires a port to a different platform, or a new regulatory requirement that needs a new report. I get equivalent problems if there&#8217;s a failure I have to interpret and fix just before a deadline, or the team members turn over completely and no-one remembers the tacit knowledge that helps the code make sense. The market has moved away from where I thought it was going to be and my option has been called.</p>

<p>Even if it is more expensive to do things cleanly (and I&#8217;m not convinced of that beyond a two-week horizon), it&#8217;s also less risky. A messy system is full of unhedged calls, each of which can cost an unpredictable amount should they ever be exercised. We&#8217;ve all seen what this can do in the financial markets, and the scary thing is that failure, if it comes, can be sudden&mdash;everything is fine until it isn&#8217;t. I&#8217;ve seen a few systems which are just too hard to change to keep up with the competition and the owners are in real trouble.</p>

<p>So that makes refactoring like buying an option too. I pay a premium now so that I have more choices about where I might take the code later. This is a mundane and obvious activity in many aspects of business&mdash;although not, it seems, software development. I don&#8217;t need to spend this money if I know exactly what will happen, if I have perfect knowledge of the relevant parts of the future, but I don&#8217;t recall when I last saw this happen.</p>

<p>So, the next time you have to deal with implausible delivery dates, don&#8217;t talk about Technical Debt. Debt is predictable and can be managed, it&#8217;s just another tool. Try talking about an Unhedged Call. Now all we need is a way to price Code Smells.</p>

<p><hr/><br />
1) There is an apocryphal story about a trader buying chocolate santa futures and forgetting to sell them on. Eventually a truckload turned up at the Wall Street headquarters.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2010/07/23/bad-code-isnt-technical-debt-its-an-unhedged-call-option/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Machiavelli on code quality</title>
		<link>http://www.m3p.co.uk/blog/2010/04/25/machiavelli-on-code-quality/</link>
		<comments>http://www.m3p.co.uk/blog/2010/04/25/machiavelli-on-code-quality/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 08:04:22 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Software culture]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=488</guid>
		<description><![CDATA[As the doctors say of a wasting disease, to start with, it is easy to cure but difficult to diagnose. After a time, unless it has been diagnosed and treated at the outset, it becomes easy to diagnose but difficult to cure.
&#8212;&#160;Nicolo Machiavelli, The Prince
via Dee Hock, Birth of the Chaordic Age]]></description>
			<content:encoded><![CDATA[<blockquote>As the doctors say of a wasting disease, to start with, it is easy to cure but difficult to diagnose. After a time, unless it has been diagnosed and treated at the outset, it becomes easy to diagnose but difficult to cure.</blockquote>
<p style="text-align:right;">&mdash;&nbsp;Nicolo Machiavelli, <em>The Prince</em></p>
<em>via</em> Dee Hock, <i>Birth of the Chaordic Age</i>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2010/04/25/machiavelli-on-code-quality/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Not a charter for hackers</title>
		<link>http://www.m3p.co.uk/blog/2010/04/25/not-a-charter-for-hackers/</link>
		<comments>http://www.m3p.co.uk/blog/2010/04/25/not-a-charter-for-hackers/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 07:55:05 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Organisations]]></category>
		<category><![CDATA[Software culture]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=468</guid>
		<description><![CDATA[Just had to turn off comments since this post has become a spam target. Sorry. 

Update: Kent since tweeted this nice one-liner:
a complete engineer can code for latency or throughput and knows when and how to switch

Kent Beck&#8217;s excellent keynote at the Startup Lessons Learned Conference has been attracting some attention on The Interweb. In [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: 0.8em; font-style:italic">Just had to turn off comments since this post has become a spam target. Sorry. </span></p>

Update: Kent since tweeted this nice one-liner:<br />
<blockquote>a complete engineer can code for latency or throughput and knows when and how to switch</blockquote>
<hr/><br />
Kent Beck&#8217;s <a href="http://www.justin.tv/startuplessonslearned/b/262656520">excellent keynote</a> at the <a href="http://www.sllconf.com/">Startup Lessons Learned Conference</a> has been attracting some attention on The Interweb. In particular, it seems like he&#8217;s now saying that careful engineering is wasteful&mdash;just copy and tweak those files to get a result <em>now</em>. I can already hear how this will be cited by frustrated proprietors and managers around the world (more on this in a moment).

<p>What I think he actually said is that we should make engineering trade-offs. When we&#8217;re concerned with learning, then we want the fastest turnaround possible. It&#8217;s like a physics apparatus, it&#8217;s over-engineered if it lasts beyond the experiment. <em>But</em>, if we&#8217;re delivering stuff that people will actually use, that we want them to rely on, then the trade-off is different and we should do all that testing, refactoring, and so on that he&#8217;s been talking about for the last ten years. Kent brushes over that engineering stuff in his talk, but it&#8217;s easy to forget how rare timely, quality delivery is in the field.</p>

<p>My favourite part is Kent&#8217;s answer to the last question. A stressed manager or owner asks how to get his developers to stop being so careful and <em>just ship something</em>. Kent&#8217;s reply is to present the developers with the real problem, not the manager&#8217;s solution, and let them find a way. What the manager really wants is cheap feedback on some different options. The developers, given a chance, might find a better solution altogether, without being forced into arbitrarily dropping quality.</p>

<p>Good developers insist on maintaining quality, partly to maintain pride in their work (as Deming proposed), but also because we&#8217;ve all learned that it&#8217;s the best route to sustained delivery. </p>

<p>As Brian Marick <a href="http://www.exampler.com/blog/2010/04/04/about-business-value/">pointed out recently</a>, it&#8217;s about achieving more (much more) through relationships, not one side or another achieving dominance. </p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2010/04/25/not-a-charter-for-hackers/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Mark Twain again</title>
		<link>http://www.m3p.co.uk/blog/2010/03/10/mark-twain-again/</link>
		<comments>http://www.m3p.co.uk/blog/2010/03/10/mark-twain-again/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 14:24:11 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Organisations]]></category>
		<category><![CDATA[Software culture]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=456</guid>
		<description><![CDATA[We should be careful to get out of an experience only the wisdom that is in it&#8212;and stop there&#8212;lest we be like the cat that sits down on a hot stove-lid. She will never sit down on a hot stove-lid again, and that is well; but also she will never sit down on a cold [...]]]></description>
			<content:encoded><![CDATA[<blockquote>We should be careful to get out of an experience only the wisdom that is in it&mdash;and stop there&mdash;lest we be like the cat that sits down on a hot stove-lid. She will never sit down on a hot stove-lid again, and that is well; but also she will never sit down on a cold one any more.</blockquote>

<p>via <a href="http://www.gembapantarei.com/2010/02/the_wisdom_within_the_experience_1.html">Gemba Panta Rei</a></p>

<p style="font-size:0.9em">Twain also wrote of opera, &#8220;that sort of intense but incoherent noise which always so reminds me of the time the orphan asylum burned down.&#8221;</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2010/03/10/mark-twain-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calling an Oracle stored procedure with a Table parameter with Spring&#8217;s StoredProcedure class</title>
		<link>http://www.m3p.co.uk/blog/2010/02/11/calling-an-oracle-stored-procedure-with-a-table-parameter-with-springs-storedprocedure-class/</link>
		<comments>http://www.m3p.co.uk/blog/2010/02/11/calling-an-oracle-stored-procedure-with-a-table-parameter-with-springs-storedprocedure-class/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 23:08:00 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=427</guid>
		<description><![CDATA[I don&#8217;t normally do this sort of thing, but this took my colleague Tony Lawrence and me a while to figure out and we didn&#8217;t find a good explanation on the web. This will be a very dull posting unless you need to fix this particular problem. Sorry about that.

We happen to be using the [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t normally do this sort of thing, but this took my colleague Tony Lawrence and me a while to figure out and we didn&#8217;t find a good explanation on the web. This will be a very dull posting unless you need to fix this particular problem. Sorry about that.</p>

<p>We happen to be using the Spring database helper classes to talk to Oracle with stored procedures. It turns out that there&#8217;s a bug in the driver that means that you have to jump through a few hoops to pass values in when the input parameter type is a table. This should be equivalent to an array, but apparently it isn&#8217;t, so you have to set up the callable statement correctly. Where to do this was not obvious (to us) in the Spring framework.</p>

<p>Here&#8217;s an example stored procedure declaration:</p>



<pre>CREATE TYPE VARCHARTAB IS TABLE OF VARCHAR2(255);

CREATE PACKAGE db_package {
  TYPE list_type IS TABLE OF VARCHAR2(50) INDEX BY BINARY_INTEGER;
PROCEDURE a_stored_procedure(
  table_in IN list_type
)</pre>



<p>The <code>table_in</code> parameter type <code>list_type</code> is declared within a package, which means we can&#8217;t declare the parameter as an <code>OracleTypes.ARRAY</code> when setting up the statement.  Instead we declare it as the type of the table contents <code>OracleTypes.VARCHAR</code>

</p>



<pre>class MyProcedure extends StoredProcedure {
  public MyProcedure(DataSource dataSource) {
    super(dataSource, &quot;db_package.a_stored_procedure&quot;);
    declareParameter(new SqlParameter(&quot;table_in&quot;, 
                                      OracleTypes.VARCHAR));
    compile();
  }
  
  void call(String... values) {
    execute(withParameters(values));
  }</pre>



<p>Here&#8217;s the money quote. When setting up the parameter, you need to provide it with a <code>SqlTypeValue</code>.
Don&#8217;t use one of the helper base classes that come out of the box, but create an implementation directly. That gives you access to the <code>statement</code>, which you can cast and set appropriately.<br />
</p>
  


<pre>   private Map&lt;String, Object&gt; withParameters(String... values) {
      return ImmutableMap.of(&quot;table_in&quot;,
                             oracleIndexTableWith(50, values));
   }

   private  &lt;T&gt; SqlTypeValue 
   oracleIndexTableWith(final int elemMaxLen, final T... values) {
     return new SqlTypeValue() {
       @Override
       public void setTypeValue(
         PreparedStatement statement, int paramIndex, 
         int sqlType, String typeName) throws SQLException 
      {
         ((OracleCallableStatement)statement).setPlsqlIndexTable(
            paramIndex, values, values.length, values.length,  
            sqlType, elemMaxLen);
       }
     };
   }
}</pre>



<p>That&#8217;s it. Happy copy and paste.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2010/02/11/calling-an-oracle-stored-procedure-with-a-table-parameter-with-springs-storedprocedure-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Responding to Brian Marick</title>
		<link>http://www.m3p.co.uk/blog/2010/01/17/responding-to-brian-marick/</link>
		<comments>http://www.m3p.co.uk/blog/2010/01/17/responding-to-brian-marick/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 22:10:39 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[Book]]></category>
		<category><![CDATA[Test-Driven]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=385</guid>
		<description><![CDATA[Brian&#8217;s been paying us the compliment of taking our book seriously and working through our extended example, translating it to Ruby. 

He has a point of contention in that he&#8217;s doubtful about the value of our end-to-end tests. To be more precise, he&#8217;s doubtful about the value of our automated end-to-end tests, a view shared [...]]]></description>
			<content:encoded><![CDATA[<p>Brian&#8217;s been paying us the compliment of taking <a href="http://www.growing-object-oriented-software.com/">our book</a> seriously and working through our extended example, translating it to Ruby. </p>

<p>He has a <a href="http://www.exampler.com/blog/2010/01/08/some-preliminary-thoughts-on-end-to-end-testing-in-growing-object-oriented-software/">point of contention</a> in that he&#8217;s doubtful about the value of our end-to-end tests. To be more precise, he&#8217;s doubtful about the value of our <em>automated</em> end-to-end tests, a view shared by <a href="http://www.jbrains.ca/integration_tests_are_a_scam"><span class="caps">J.B.R</span>ainsberger</a>, and <a href="http://agile2009.agilealliance.org/node/1010">Arlo Belshee and Jim Shore</a>. That&#8217;s a pretty serious group. I think the answer, as always, is &ldquo;it depends&rdquo;. </p>

<p>There are real advantages to writing automated end-to-end tests. As Nat pointed out in <a href="http://groups.google.com/group/growing-object-oriented-software/browse_thread/thread/5525c6acdd143be6">an extended message</a> to the mailing list for the book, </p>

<blockquote>Most significantly to me, however, is the difference between &#8220;testing&#8221; end-to-end or through the <span class="caps">GUI </span>and &#8220;test-driving&#8221;. A lot of people who are evangelical about <span class="caps">TDD </span>for coding do not use end-to-end tests for driving design at the system scale. I have found that writing tests gives useful design feedback, no matter what the scale.</blockquote>

<p>For example, during Arlo and Jim&#8217;s session, I was struck by how many of the &ldquo;failure stories&rdquo; described situations where the acceptance tests were actually doing their job: revealing problems (such as deployment difficulties) that needed to be fixed.</p>

<p>Automating an end-to-end test helps me think more carefully about what <em>exactly</em> I care about in the next feature.  Automating tests for many features encourages me to work out a language to describe them, which clarifies how I describe the system and makes new features easier to test.</p>

<p>And then there&#8217;s scale. Pretty much anything will work for a small system (although Alan Shalloway <a href="http://www.netobjectives.com/blogs/smart-people-xp-scrum-is-there-a-pattern">has a story</a> about how even a quick demonstrator project can get out of hand). For larger systems, things get complicated, people come and go, and the team isn&#8217;t quite as confident as it needs to be about where things are connected. Perhaps these are symptoms of weaknesses in the team culture, but it seems wasteful to me to take the design experience we gained while writing the features not encode it somewhere.</p>

<p>Of course this comes at a price. Effective end-to-end tests take skill, experience, and (most important) commitment. Not every system I&#8217;ve seen has been programmed by people who are as rigorous as Nat about making the test code expressive or allowing testing to drive the design. Worse, a large collection of badly written end-to-end tests (a pattern I&#8217;ve seen a few times) is a huge drag on development. Is that price worth paying? It (ahem) depends, and part of the skill is in finding the right places to test.</p>

<p>So, let me turn Brian&#8217;s final question around. What would it take to make automated end-to-end tests less scary?</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2010/01/17/responding-to-brian-marick/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>London XpDay 7th &amp; 8th December</title>
		<link>http://www.m3p.co.uk/blog/2009/11/30/london-xpday-7th-8th-december/</link>
		<comments>http://www.m3p.co.uk/blog/2009/11/30/london-xpday-7th-8th-december/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 11:50:02 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=359</guid>
		<description><![CDATA[
There are still a few places left for the London XpDay, an event designed by practitioners for practitioners.

We&#8217;re trying the half-Open Space format again, with a day of prepared sessions (some promising experience reports this year) leading to a day of ad-hoc sessions. This means we can have a conference that&#8217;s more responsive to the [...]]]></description>
			<content:encoded><![CDATA[<span style="float:right;"><img src="/images/xpday-logo.png" width="140" alt="XP Day"/></span>
<p>There are still a few places left for the <a href="http://www.xpday.org/">London XpDay</a>, an event designed by practitioners for practitioners.</p>

<p>We&#8217;re trying the half-Open Space format again, with a day of prepared sessions (some promising experience reports this year) leading to a day of ad-hoc sessions. This means we can have a conference that&#8217;s more responsive to the needs of the attendees in the room&mdash;if I want to cover a topic I can propose a session.</p>

<p>And we have some interesting keynotes. Apart from Mark Striebeck, talking about scaling up some agile techniques as only Google can, we&#8217;re continuing our tradition of bringing in &rdquo;outside&ldquo; speakers to trigger discussion. We have Doron Swade (who built the calculating engine in the Science Museum) talking about Babbage, and storyteller Terry Saunders.</p>

<p>Nat and I will also be using the opportunity to launch <a href="http://www.growing-object-oriented-software.com/">our book</a> in the <span class="caps">UK.</span></p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2009/11/30/london-xpday-7th-8th-december/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Friday 13th, Talking at Skills Matter</title>
		<link>http://www.m3p.co.uk/blog/2009/10/30/friday-13th-talking-at-skills-matter/</link>
		<comments>http://www.m3p.co.uk/blog/2009/10/30/friday-13th-talking-at-skills-matter/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 15:13:19 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Test-Driven]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=349</guid>
		<description><![CDATA[Prove you&#8217;re not superstitious! I&#8217;ll be giving my talk on Sustainable TDD at Skills Matter on Friday, 13th November. Sign up here (if you dare). 

This talk is about the qualities we look for in test code that keep the development &#8220;habitable.&#8221; We want to make sure the tests pull their weight by making them [...]]]></description>
			<content:encoded><![CDATA[<p>Prove you&#8217;re not superstitious! I&#8217;ll be giving my talk on Sustainable <span class="caps">TDD </span>at Skills Matter on Friday, 13th November. <a href="http://skillsmatter.com/podcast/agile-testing/sustainable-test-driven-development">Sign up here</a> (if you dare). </p>

<blockquote>This talk is about the qualities we look for in test code that keep the development &#8220;habitable.&#8221; We want to make sure the tests pull their weight by making them expressive, so that we can tell what&#8217;s important when we read them and when they fail, and by making sure they don&#8217;t become a maintenance drag themselves. We need to apply as much care and attention to the tests as we do to the production code, although the coding styles may differ. Difficulty in testing might imply that we need to change our test code, but often it&#8217;s a hint that our design ideas are wrong and that we ought to change the production code. In practice, these qualities are all related to and support each other. Test-driven development combines testing, specification, and design into one holistic activity.</blockquote>

<p>I just ran it at the <span class="caps">BBC </span>and people seemed to like it.</p>

<p>If you miss this opportunity, you can always see it at <a href="http://www.m3p.co.uk/blog/2009/10/30/qcon-san-francisco/">QCon San Francisco</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2009/10/30/friday-13th-talking-at-skills-matter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QCon San Francisco</title>
		<link>http://www.m3p.co.uk/blog/2009/10/30/qcon-san-francisco/</link>
		<comments>http://www.m3p.co.uk/blog/2009/10/30/qcon-san-francisco/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 15:02:22 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Test-Driven]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=327</guid>
		<description><![CDATA[I&#8217;m running a track at QCon in San Francisco on Friday 20th November. The topic is Technical Skills for Agile Development, and it&#8217;s about some of the technical essentials that Agile teams need to keep moving. 

I&#8217;ll be presenting a session, based on material from our book, on how to live with your tests over [...]]]></description>
			<content:encoded><![CDATA[<img src="/images/qcon-logo-basic.jpeg" alt="QCon" width="120px" style="float: right; border: none; padding: 5px;"/><p style="text-align: justify;">I&#8217;m running a track at <a href="http://qconsf.com/sf2009/">QCon in San Francisco</a> on Friday 20th November. The topic is <a href="http://qconsf.com/sf2009/tracks/show_track.jsp?trackOID=299">Technical Skills for Agile Development</a>, and it&#8217;s about some of the technical essentials that Agile teams need to keep moving. </p>

<p>I&#8217;ll be presenting <a href="http://qconsf.com/sf2009/presentation/Sustainable+Test-Driven+Development">a session</a>, based on material from <a href="http://www.growing-object-oriented-software.com/">our book</a>, on how to live with your tests over the long term.</p>

<p>See you there?</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2009/10/30/qcon-san-francisco/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test-Driven Development is not an elite technique.</title>
		<link>http://www.m3p.co.uk/blog/2009/10/21/tdd-is-not-elite/</link>
		<comments>http://www.m3p.co.uk/blog/2009/10/21/tdd-is-not-elite/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 11:11:46 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Software culture]]></category>
		<category><![CDATA[Test-Driven]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=312</guid>
		<description><![CDATA[This &#8220;Darwinian&#8221; post that TDD Is Not For the Weak says that not everyone can cope with TDD, it&#8217;s for &#8220;the Alpha, the strong, the experienced&#8221;. I don&#8217;t want to believe this, because I think that developers who can&#8217;t cope with any level of TDD shouldn&#8217;t be coding at all, so I won&#8217;t. 

This claim [...]]]></description>
			<content:encoded><![CDATA[<p>This &#8220;Darwinian&#8221; post that <a href="http://blog.typemock.com/2009/10/tdd-is-not-for-weak.html"><span class="caps">TDD</span> Is Not For the Weak</a> says that not everyone can cope with <span class="caps">TDD, </span>it&#8217;s for &#8220;the Alpha, the strong, the experienced&#8221;. I don&#8217;t <em>want</em> to believe this, because I think that developers who can&#8217;t cope with any level of <span class="caps">TDD </span>shouldn&#8217;t be coding at all, so I won&#8217;t. </p>

<p>This claim has been made for every technical innovation I&#8217;ve seen so far (objects, event-driven programming, etc, etc). Sometimes it&#8217;s true, but most of the time it&#8217;s about what people are used to. Michael Feathers pointed out <a href="http://blog.objectmentor.com/articles/2009/07/13/ending-the-era-of-patronizing-language-design">a while ago</a> that the Ruby community is happily exploiting techniques such as meta-programming that were traditionally regarded as needing a safe pair of hands. What&#8217;s changed is that a generation has grown up with meta-programming and doesn&#8217;t regard it as problematic. Of course, there will be a degradation in understanding as an idea rolls out beyond its originators, but there&#8217;s still some value that gets through.</p>

<p>Sure there&#8217;s a role for people to help the generation that is struggling to pick up a new technique, but that doesn&#8217;t mean that <span class="caps">TDD </span>itself will always be beyond the range of mortal developers.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2009/10/21/tdd-is-not-elite/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A Mugged Liberal</title>
		<link>http://www.m3p.co.uk/blog/2009/10/14/a-mugged-liberal/</link>
		<comments>http://www.m3p.co.uk/blog/2009/10/14/a-mugged-liberal/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 10:01:44 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Book]]></category>
		<category><![CDATA[Grumpy Old Man]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=307</guid>
		<description><![CDATA[A Liberal is a Conservative Who Hasn&#8217;t Been Mugged

I discover that our book Growing Object-Oriented Software, Guided by Tests is already up with the file sharers. This is before Nat and I have even seen a printed copy. I don&#8217;t know whether to be flattered that someone thinks our effort is worth pinching or annoyed [...]]]></description>
			<content:encoded><![CDATA[<blockquote>A Liberal is a Conservative Who Hasn&#8217;t Been Mugged</blockquote>

<p>I discover that our book <a href="http://www.growing-object-oriented-software.com/">Growing Object-Oriented Software, Guided by Tests</a> is already up with the file sharers. This is before Nat and I have even seen a printed copy. I don&#8217;t know whether to be flattered that someone thinks our effort is worth pinching or annoyed that the production process has not protected our interests.</p>

<p>If you&#8217;ve downloaded a copy, remember that it took us three years to write, which includes a great deal of lost income. The least you can do is tell the world how good it is so that maybe we sell a few more copies.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2009/10/14/a-mugged-liberal/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Do do XP</title>
		<link>http://www.m3p.co.uk/blog/2009/10/13/do-do-xp/</link>
		<comments>http://www.m3p.co.uk/blog/2009/10/13/do-do-xp/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 10:58:07 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[Software culture]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=290</guid>
		<description><![CDATA[In this post, Tobias Mayer argues against doing Extreme Programming (XP). I have a lot of time for Tobias, but I think he&#8217;s wrong on this one. I don&#8217;t know who he&#8217;s been talking to, but some of this is &#8220;strawman&#8221; argument, and I&#8217;d be more likely to be convinced if Tobias had tried XP [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://agileanarchy.wordpress.com/2009/10/12/dont-do-xp/">this post</a>, Tobias Mayer argues against doing Extreme Programming (XP). I have a lot of time for Tobias, but I think he&#8217;s wrong on this one. I don&#8217;t know who he&#8217;s been talking to, but some of this is &#8220;strawman&#8221; argument, and I&#8217;d be more likely to be convinced if Tobias had tried XP just the once. XP is not a universal solution, but it is one  possible choice and we know how to make it work.</p>

<p>As an occasional XP advocate, I don&#8217;t &#8220;blame Scrum for the lack of good development practices in the software industry&#8221;, I blame the software industry. If we worked in an effective industry, we wouldn&#8217;t be having methodology wars because things would just work. Now this same industry is messing up Scrum too by just taking on its ceremonial aspects.  On the other hand, to blame XP for blocking good practice is just bizarre. </p>

<p>XP is a tiny movement that attracted some attention. What XP (version 1) <em>did</em> achieve was to show that it is possible to break through the logjam of cautious procrastination that still cripples many development teams, but without resorting to hackery. It gave teams a reliable package of practices that just worked. <em>Of course</em> XP didn&#8217;t take over the world because it&#8217;s not suitable for everyone&#8211;not least because it requires a degree of focus and skill that is not appropriate for many teams. Kent Beck&#8217;s presentation of XP version 1 was extreme on purpose: it was designed to inspire us huddled masses, and to stretch the boundaries of what was considered possible in software development, to reframe the discussion.</p>

<p>I think Tobias has forgotten just how far we&#8217;ve come in the last decade. That we have a craft movement at all is because XP put the actual writing of code back into the centre of the discussion&#8211;just look at who&#8217;s involved, it&#8217;s the same people. He also forgets just how counter-intuitive many of the XP practices are, especially compared to the direction the industry was moving at the time.</p>

<p>Tobias writes that the good development practices were spreading slowly at the time, but I&#8217;d argue that without XP we&#8217;d still be waiting. Test-Driven Development is still not that widely accepted and even the original C3 team didn&#8217;t adopt it fully until Kent was writing his book. Refactoring had a small academic following, but it&#8217;s not very safe without the compensating practice of <span class="caps">TDD.</span> I suspect most teams still ban changing code unless it&#8217;s to change a feature. Pair programming is still a very hard sell and, again, works much better in the context of <span class="caps">TDD.</span> I&#8217;ve seen enough Scrum teams that have <em>not</em> found a coherent set of technical practices. To say that they just need to improve their Scrum implementation begs the question of how Scrum is adopted and the limits of self-organisation.</p>

<p>Some final nit-picks. There are two editions of the XP book, the second is more recent than 12 years and has a &#8220;softer&#8221; approach to the methodology. As for the relevancy of the practices, the C3 project worked in an environment (Smalltalk/Gemstone) that still outclasses what most of us use today. Much of the work in the XP community has been to try to recreate that flexibility in inadequate current technical environments. What&#8217;s <em>really</em> scary is how slowly this industry moves.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2009/10/13/do-do-xp/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Software Nightmares (2)</title>
		<link>http://www.m3p.co.uk/blog/2009/10/04/software-nightmares-2/</link>
		<comments>http://www.m3p.co.uk/blog/2009/10/04/software-nightmares-2/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 22:32:28 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Organisations]]></category>
		<category><![CDATA[Software culture]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=263</guid>
		<description><![CDATA[About a month ago, Michael Feathers wrote another post that cited Gordon Ramsey. That reminded me to follow up my earlier post with observations from a couple of episodes from UK series 4 that make the point (thanks Channel 4).
First up is a curry restaurant in Nottingham (which has no shortage of competition) opened by [...]]]></description>
			<content:encoded><![CDATA[<p>About a month ago, Michael Feathers wrote <a href="http://michaelfeathers.typepad.com/michael_feathers_blog/2009/09/thoughts-on-the-future-of-the-boutique-software-shop.html">another post</a> that cited Gordon Ramsey. That reminded me to follow up <a href="http://www.m3p.co.uk/blog/2009/06/09/software-nightmares/">my earlier post</a> with observations from a couple of episodes from UK series 4 that make the point (thanks <a href="http://www.channel4.com/programmes/ramsays-kitchen-nightmares/4od">Channel 4</a>).</p>
<p>First up is a curry restaurant in Nottingham (which has no shortage of competition) opened by an ex-sales manager and glossed up to look like an &#8217;80s night club. Being from sales, his view is that the customers gets what they ask for, so he&#8217;s offering design-your-own curries&mdash;whatever combination you want. The result is that the kitchen brigade (who are good) can&#8217;t cope with the variety and turn everything to mush. When Ramsey has them cook all hundred-odd dishes on the menu, the waiting staff can&#8217;t tell which is which.</p>
<p>The owner sees the process as simple order-taking. Offer the customers whatever they ask for, regardless of the effects on the demoralised staff and low quality. It turns out that the customers aren&#8217;t curry experts and don&#8217;t like what they&#8217;re getting, so the restaurant is losing money. Ramsey&#8217;s solution is to cut the menu back to something the brigade can do well, and to offer what the customers what they actually <em>want</em>.</p>
<p>Second up is a carvery outside London that&#8217;s been bought by Scott, an ex-IT consultant. It&#8217;s losing money so, in an attempt to fill the place, he&#8217;s offering two-for-ones at below cost price; the only people who put up with the dreadful food are pensioners.  He&#8217;s hired a cheap brigade who can&#8217;t even cope with the grill idea that Ramsey proposes, and the kitchen is so decrepit that Ramsey has it condemned. Scott is discovering that reducing costs isn&#8217;t working and risks poisoning the clientele.</p>
<p>Scott seems most comfortable in the office behind a computer, presumably planning the work that everyone will do. He appears to be the only owner in any of the series that has no interest in food or customers&mdash;the value part of the equation. He has no idea if his people are competent or what constitutes good service.</p>

<p>Back-to-back, the episodes make a nice pair. To belabour the point, we can&#8217;t do good, <em>valuable</em> work when the process is one-sided: when requirements are forced through an organisation without thought for the consequences, or when work is driven from behind the scenes without enough attention to a paying customer.</p>

<p>It should be obvious, but we need reminding. Hands up if you work in one of these places.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2009/10/04/software-nightmares-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Keep tests concrete</title>
		<link>http://www.m3p.co.uk/blog/2009/09/07/keep-tests-concrete/</link>
		<comments>http://www.m3p.co.uk/blog/2009/09/07/keep-tests-concrete/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 12:01:07 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Test-Driven]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/?p=244</guid>
		<description><![CDATA[This popped up on a technical discussion site recently. The original question was how to write tests for code that invokes a method on particular values in a list. The problem was that the tests were messy, and the author was looking for a cleaner alternative. Here&#8217;s the example test, it asserts that the even-positioned [...]]]></description>
			<content:encoded><![CDATA[<p>This popped up on a technical discussion site recently. The original question was how to write tests for code that invokes a method on particular values in a list. The problem was that the tests were messy, and the author was looking for a cleaner alternative. Here&#8217;s the example test, it asserts that the even-positioned elements in the parameters are passed to <code>bar</code> in the appropriate sequence.</p>


<pre>public void testExecuteEven() {
  Mockery mockery = new Mockery();

  final Bar bar = mockery.mock(Bar.class);
  final Sequence sequence = new NamedSequence(&quot;sequence&quot;);

  final List&lt;String&gt; allParameters = new ArrayList&lt;String&gt;();
  final List&lt;String&gt; expectedParameters = new ArrayList&lt;String&gt;();

  for (int i = 0; i &lt; 3; i++) {
    allParameters.add(&quot;param&quot; + i);
    if (i % 2 == 0) {
      expectedParameters.add(&quot;param&quot; + i);
    }
  }
  final Iterator&lt;String&gt; iter = expectedParameters.iterator();

  mockery.checking(new Expectations() {
   {
     while (iter.hasNext()) {
       one(bar).doIt(iter.next());
        inSequence(sequence);
      }
    }
  });

  Foo subject = new Foo();
  subject.setBar(bar);
  subject.executeEven(allParameters);
  mockery.assertIsSatisfied();
}</pre>


<p>The intentions of the test are good, but its most striking feature is that there&#8217;s so much computation going on. This doesn&#8217;t need a new technique to make it more readable, it just needs to be simplified.</p>
<p>A unit test should be small and focussed enough that we don&#8217;t need any general behaviour. It just has to deal with one example, so we can make it as concrete as we like. With that in mind, we can collapse the test to this:</p>


<pre>public void testCallsDoItOnEvenIndexedElementsInList() {
  final Mockery mockery = new Mockery();
  final Bar bar = mockery.mock(Bar.class);
  final Sequence evens = mockery.sequence(&quot;evens&quot;);

  final  List&lt;String&gt; params = 
    Arrays.asList(&quot;param0&quot;, &quot;param1&quot;, &quot;param2&quot;, &quot;param3&quot;);

  mockery.checking(new Expectations() {{
    oneOf(bar).doIt(params.get(0)); inSequence(evens);
    oneOf(bar).doIt(params.get(2)); inSequence(evens);
  }});

  Foo subject = new Foo();
  subject.setBar(bar);
  subject.executeEven(params);
  mockery.assertIsSatisfied();
}</pre>


<p>To me, this is more direct, a simpler statement of the example&mdash;if nothing else, there&#8217;s just less code to understand. I don&#8217;t need any loops because there aren&#8217;t enough values to justify them. The expectations are clearer because they show the indices of the elements I want from the list (an alternative would have been to put in the expected values directly). And if I pulled the common features, such as the mockery and the target object, into the test class, the test would be even shorter.</p>
<p>The short version of this post is: be wary of any general behaviour written into a unit test. The scope should be small enough that values can be coded directly. Be especially wary of anything with an <code>if</code> statement. If the data setup is more complicated, then consider using a <a href="http://nat.truemesh.com/archives/000714.html">Test Data Builder</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2009/09/07/keep-tests-concrete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apologies for the downtime</title>
		<link>http://www.m3p.co.uk/blog/2009/09/07/apologies-for-the-downtime/</link>
		<comments>http://www.m3p.co.uk/blog/2009/09/07/apologies-for-the-downtime/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 09:41:36 +0000</pubDate>
		<dc:creator>steve.freeman</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.m3p.co.uk/blog/?p=234</guid>
		<description><![CDATA[I&#8217;ve just upgraded WordPress in response to this security alert. I should have done it ages ago. 

The alert says
Update your WordPress blog before you continue reading this post. That&#8217;s how critical this issue is.
so it seemed like a good idea to bring the site down until I had time to deal with it.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just upgraded WordPress in response to <a href="http://lorelle.wordpress.com/2009/09/04/old-wordpress-versions-under-attack/">this security alert</a>. I should have done it ages ago. </p>

The alert says<br />
<blockquote>Update your WordPress blog before you continue reading this post. That&#8217;s how critical this issue is.</blockquote>
so it seemed like a good idea to bring the site down until I had time to deal with it.]]></content:encoded>
			<wfw:commentRss>http://www.m3p.co.uk/blog/2009/09/07/apologies-for-the-downtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
