<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Object Mentor Blog: Why you have time for TDD (but may not know it yet...)</title>
    <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Why you have time for TDD (but may not know it yet...)</title>
      <description>&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Updated 9/30/2007 to improve the graphs and to clarify the content.&lt;/p&gt;


	&lt;p&gt;A common objection to &lt;span class="caps"&gt;TDD&lt;/span&gt; is this; &amp;#8220;We don&amp;#8217;t have time to write so many tests. We don&amp;#8217;t even have enough time to write features!&amp;#8221;&lt;/p&gt;


	&lt;p&gt;Here&amp;#8217;s why people who say this probably already have enough time in the (real) schedule, they just don&amp;#8217;t know it yet.&lt;/p&gt;


	&lt;p&gt;Let&amp;#8217;s start with an idealized &lt;a href="http://www.controlchaos.com/about/burndown.php"&gt;Scrum-style &amp;#8220;burn-down chart&amp;#8221;&lt;/a&gt; for a fictional project run in a &amp;#8220;traditional&amp;#8221; way (even though traditional projects don&amp;#8217;t use burn-down charts&amp;#8230;).&lt;/p&gt;


&lt;p&gt;
&lt;img src="http://blog.objectmentor.com/files/ideal_timeline2.png" border="0" height="352" width="575" alt="ideal_timeline2.png" align="center" /&gt;
&lt;/p&gt;

	&lt;p&gt;We have time increasing on the x axis and the number of &amp;#8220;features&amp;#8221; &lt;em&gt;remaining to implement&lt;/em&gt; on the y axis (it could also be hours or &amp;#8220;story points&amp;#8221; remaining). During a project, a nice feature of burn-down charts is that you can extend the line to see where it intersects the x axis, which is a rough indicator of when you&amp;#8217;ll actually finish.&lt;/p&gt;


	&lt;p&gt;The optimistic planners for our fictional project plan to give the software to QA near the end of the project. They expect QA to find nothing serious, so the release will occur soon thereafter on date &lt;strong&gt;T0&lt;/strong&gt;.&lt;/p&gt;


	&lt;p&gt;Of course, it never works out that way:&lt;/p&gt;


&lt;p&gt;
&lt;img src="http://blog.objectmentor.com/files/actual_timeline2.png" border="0" height="352" width="575" alt="actual_timeline2.png" align="center" /&gt;
&lt;/p&gt;

	&lt;p&gt;The red line is the actual effort for our fictional project. It&amp;#8217;s quite natural for the planned list of features to change as the team reacts to market changes, &lt;em&gt;etc.&lt;/em&gt;. This is why the line goes up sometimes (in &amp;#8220;good&amp;#8221; projects, too!). Since this is a &amp;#8220;traditional&amp;#8221; project, I&amp;#8217;m assuming that there are no automated tests that actually &lt;em&gt;prove&lt;/em&gt; that a given feature is really done. We&amp;#8217;re effectively running &amp;#8220;open loop&amp;#8221;, without the feedback of tests.&lt;/p&gt;


	&lt;p&gt;Inevitably, the project goes over budget and th planned QA drop comes late. Then things get ugly. Without our automated &lt;strong&gt;unit&lt;/strong&gt; tests, there are lots of little bugs in the code. Without our automated &lt;strong&gt;integration&lt;/strong&gt; tests, there are problems when the subsystems are run together. Without our &lt;strong&gt;acceptance&lt;/strong&gt; tests, the implemented features don&amp;#8217;t quite match the actual requirements for them.&lt;/p&gt;


	&lt;p&gt;Hence, a chaotic, end-of-project &amp;#8220;birthing&amp;#8221; period ensues, where QA reports a list of big and small problems, followed by a frantic effort (usually involving weekends&amp;#8230;) by the developers to address the problems, followed by another QA drop, followed by&amp;#8230;, and so forth.&lt;/p&gt;


	&lt;p&gt;Finally, out of exhaustion and because everyone else is angry at the painful schedule slip, the team declares &amp;#8220;victory&amp;#8221; and ships it, at time &lt;strong&gt;T1&lt;/strong&gt;.&lt;/p&gt;


	&lt;p&gt;We&amp;#8217;ve all lived through projects like this one.&lt;/p&gt;


	&lt;p&gt;Now, if you remember your calculus classes (sorry to bring up painful memories), you will recall that the area under the curve is the total quantity of whatever the curve represents. So, the actual &lt;em&gt;total&lt;/em&gt; feature work required for our project corresponds to the area under the red line, while the planned work corresponds to the area under the black line. So, we really &lt;em&gt;did&lt;/em&gt; have more time than we originally thought.&lt;/p&gt;


	&lt;p&gt;Now consider a Test-Driven Development (TDD) project &lt;a href="#note1"&gt;[1]&lt;/a&gt;:&lt;/p&gt;


&lt;p&gt;
&lt;img src="http://blog.objectmentor.com/files/tdd_timeline2.png" border="0" height="348" width="564" alt="tdd_timeline2.png" align="center" /&gt;
&lt;/p&gt;

	&lt;p&gt;Here, the blue line is similar to the red line, at least early in the project. Now we have frequent &amp;#8220;milestones&amp;#8221; where we &lt;em&gt;verify the state&lt;/em&gt; of the project with the three kinds of automated tests mentioned above. Each milestone is the end of an iteration (usually 1-4 weeks apart). Not shown are the 5-minute &lt;span class="caps"&gt;TDD&lt;/span&gt; cycles and the feedback from the &lt;a href="http://martinfowler.com/articles/continuousIntegration.html"&gt;continuous integration&lt;/a&gt; process that does our builds and runs all our tests after every block of commits to version control (many times a day).&lt;/p&gt;


	&lt;p&gt;The graph suggests that the total amount of effort will be higher than the &lt;em&gt;expected&lt;/em&gt; effort without tests, which may be true &lt;a href="#note2"&gt;[2]&lt;/a&gt;. However, because of the constant feedback during the whole life of the project, we &lt;em&gt;really&lt;/em&gt; know where we actually are at any time. By measuring our progress in this way, we will know early whether or not we can meet the target date with the planned feature set. With early warnings, we can adjust accordingly, either dropping features or moving the target date, with relatively little pain. Whereas, without this feedback, we really don&amp;#8217;t &lt;em&gt;know&lt;/em&gt; what&amp;#8217;s done until something, &lt;em&gt;e.g.,&lt;/em&gt; the QA process, gives us that feedback. Hence, at time &lt;strong&gt;T0&lt;/strong&gt;, just before the big QA drop, the traditional project has little certainty about what features are really completed.&lt;/p&gt;


	&lt;p&gt;So, we&amp;#8217;ll experience less of the traditional end-of-project chaos, because there will be fewer surprises. Without the feedback from automated tests, QA is find lots of problems, causing the chaotic and painful end-of-project experience. Finding and trying to fix major problems late in the game can even kill a project.&lt;/p&gt;


	&lt;p&gt;So, &lt;span class="caps"&gt;TDD&lt;/span&gt; converts that unknown schedule time at the end into known time early in the project. You really &lt;strong&gt;do&lt;/strong&gt; have time for automated tests and your tests will make your projects more predictable and less painful at the end.&lt;/p&gt;


	&lt;p&gt;Note: I appreciate the early comments and questions that helped me clarify this post.&lt;/p&gt;


	&lt;p&gt;&lt;a name="note1"&gt;&lt;/a&gt;
[1] As one commenter remarked, this post doesn&amp;#8217;t actually make the case for &lt;span class="caps"&gt;TDD&lt;/span&gt; itself &lt;em&gt;vs.&lt;/em&gt; alternative &amp;#8220;test-heavy&amp;#8221; strategies, but I think it&amp;#8217;s pretty clear that &lt;span class="caps"&gt;TDD&lt;/span&gt; is the best of the known test-heavy strategies, as argued elsewhere.&lt;/p&gt;


	&lt;p&gt;&lt;a name="note2"&gt;&lt;/a&gt;
[2] There is some evidence that &lt;span class="caps"&gt;TDD&lt;/span&gt; and pair programming lead to &lt;em&gt;smaller&lt;/em&gt; applications, because they help avoid unnecessary features. Also, they provide constant feedback to the team, including the stake holders, on what the feature set should really be and which features are most important to complete first.&lt;/p&gt;</description>
      <pubDate>Sun, 30 Sep 2007 20:01:02 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:98c607d8-ce1b-4e35-aabd-8717de80bde6</guid>
      <author>Dean Wampler</author>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet</link>
      <category>Dean's Deprecations</category>
      <category>Agile Methods</category>
      <category>projects</category>
      <category>schedules</category>
      <category>TDD</category>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by Dean Wampler</title>
      <description>&lt;p&gt;@Carfield,&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m not sure what exactly you have in mind about the end of a project. It&amp;#8217;s true that near the end, you have less uncertainty about when you&amp;#8217;ll finish and what work remains, assuming you have done some testing, automated or manual, so that big surprises are less likely. Also, even in a well-run TDD project, you may encounter some volatility near the end of a release cycle as the team works through final integration issues, last minute story changes, etc. Often, being close to a major event like that clarifies your thinking somewhat.&lt;/p&gt;</description>
      <pubDate>Thu, 04 Oct 2007 08:18:17 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:8eee5853-aeb0-459c-b60c-1dd1a6a7d744</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-840</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by Carfield Yim</title>
      <description>&lt;p&gt;Thanks for the nice article and article, it probably true when the project is just start. However, if the project is near &amp;#8220;finish&amp;#8221; ( in term of schedule and function implemented ) , do you think is it still valid?&lt;/p&gt;</description>
      <pubDate>Thu, 04 Oct 2007 02:47:51 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ccbf93e4-09e9-472b-9319-a7de8d08c8bc</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-838</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by Dean Wampler</title>
      <description>&lt;p&gt;@KPSeal,&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve greatly simplified a complex, human process, of course ;)&lt;/p&gt;


	&lt;p&gt;I agree that a comprehensive economic analysis is important. I&amp;#8217;ve read that a significant amount of a project&amp;#8217;s &lt;strong&gt;total&lt;/strong&gt; life-time return on investment is lost when the schedule slips. So, if TDD (including all the different kinds of tests, as Bob said&amp;#8230;) allows you to release a limited subset of the planned features early, your return on investment might be significantly better. Just having the greater schedule predictability, i.e., avoiding the end-of-project chaos, empowers the stakeholders to make good decisions at appropriate times that will benefit everyone.&lt;/p&gt;


	&lt;p&gt;Concerning hiring the best people (which we all want to do, of course), Kent Beck said that XP was designed so that average developers can succeed, not just the best developers.&lt;/p&gt;</description>
      <pubDate>Wed, 03 Oct 2007 11:03:23 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:939e7f44-004d-48af-ad2b-2df61ac2704e</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-837</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by KPSeal</title>
      <description>&lt;p&gt;What about the iron triangle?&lt;/p&gt;


	&lt;p&gt;What you&amp;#8217;ve demonstrated is that the total feature effort is less, most likely by virtue of a higher quality (ie, TDD) implementation. This is, to my mind, as a result of having more money spent either through having more skilled developers or more QA team involvement throughout implementation. You&amp;#8217;ve not shown that the real effort, that all important bottom line, is less.&lt;/p&gt;


	&lt;p&gt;Were I worried solely about a timely delivery I can see that TDD would give me a better chance. But then so might hiring the 6 best developers in the world.&lt;/p&gt;


	&lt;p&gt;Based on personal experience I believe you, by the way, but I can imagine the raised eyebrows if I tried to use this as a justification for a change in methodology!&lt;/p&gt;</description>
      <pubDate>Wed, 03 Oct 2007 10:18:13 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:672e55f0-3fdf-40cc-8bb5-6468a477c3ba</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-836</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by unclebob</title>
      <description>&lt;p&gt;We need to be clear that TDD &lt;em&gt;includes&lt;/em&gt; automated unit tests, &lt;em&gt;and&lt;/em&gt; automated acceptance tests.  Both are written before the code that they specify.  Unit tests are written seconds before, and acceptance tests are written hours or days before.&lt;/p&gt;


	&lt;p&gt;It is &lt;em&gt;possible&lt;/em&gt; to gain the same kinds of benefits using a &amp;#8220;test-after&amp;#8221; approach.  However it is much more difficult.  Tests that are written &lt;em&gt;first&lt;/em&gt; aren&amp;#8217;t as influenced by the implementation as late tests are.  Early acceptance tests are specifications of what &lt;em&gt;should&lt;/em&gt; be.  Late acceptance tests are often specifications of what &lt;em&gt;is&lt;/em&gt;.&lt;/p&gt;</description>
      <pubDate>Wed, 03 Oct 2007 07:27:19 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d61cff92-7aaa-4309-82e3-016947b6e4cb</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-833</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by Johannes Brodwall</title>
      <description>&lt;p&gt;Much clearer. Thank you.&lt;/p&gt;</description>
      <pubDate>Tue, 02 Oct 2007 12:00:50 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:51d4988c-46a5-4bef-9ebd-ce0dd81fc911</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-830</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by Peter Wood</title>
      <description>&lt;p&gt;I was reading about the Law of Big Numbers in &amp;#8216;An Introduction To General Systems Theory&amp;#8217; on the train this morning. Basically, the bigger the sample the more accurate the estimate.&lt;/p&gt;


	&lt;p&gt;Prediction works better with bigger numbers; lots of iterations, technology spikes, tests, milestones, user stories. There will be a point at which the cost of creating these will not outweigh the worth of the new accuracy of estimate. So it&amp;#8217;s not simply as many of the above as possible but as many as is useful in improving your predictions.&lt;/p&gt;</description>
      <pubDate>Mon, 01 Oct 2007 10:24:11 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:545623ab-69ad-4d07-a015-e26c6ce1cfc1</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-823</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by Dean Wampler</title>
      <description>&lt;p&gt;Yea, I see your confusion about the sort-of parabola. It&amp;#8217;s meant to suggest that the &amp;#8220;effort&amp;#8221;, i.e., number of concurrent development tasks starts out low, then climbs as more people get involved, but the meaning of the peak and the end point aren&amp;#8217;t that obvious.&lt;/p&gt;


	&lt;p&gt;I think a simpler Scrum-style &amp;#8220;burn-down chart&amp;#8221; would have been better, where it&amp;#8217;s plotting the number of features that are left to implement versus time. If you&amp;#8217;re not familiar with them, they (should) trend down and hit zero when you&amp;#8217;re down. So, earlier in the project, if you extend the existing line down it gives you a rough measure of when you&amp;#8217;ll finish, i.e., when the line intersects the X axis.  In fact, the graphs to the right of the peaks are basically burn-downs.&lt;/p&gt;


	&lt;p&gt;I think I&amp;#8217;ll edit the blog to use this approach instead.&lt;/p&gt;</description>
      <pubDate>Sun, 30 Sep 2007 16:20:03 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:069de9e8-b2d5-4969-8c0f-61e745a072ed</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-821</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by Johannes Brodwall</title>
      <description>&lt;p&gt;I think that for TDD definition that means more than just automated unit tests, this could work. But it still requires a lot of discipline and understanding. Especially regarding acceptance tests, and in my experience: deployment and (lightweight) configuration management.&lt;/p&gt;


	&lt;p&gt;However, I don&amp;#8217;t understand whats up with the parabola? What is it supposed to represent? The amount of work remaining? Wouldn&amp;#8217;t that be an &amp;#8220;S-curve&amp;#8221;? Or the amount of effort at any point in time? So we&amp;#8217;re staffing up the hypothetical project? Why?&lt;/p&gt;


	&lt;p&gt;So: I might be persuaded by your argument, but I don&amp;#8217;t really understand it. Am I being slow, or should you rething the information design here?&lt;/p&gt;</description>
      <pubDate>Sun, 30 Sep 2007 16:09:34 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:3878d348-ba65-4c48-82ee-a674901b192a</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-820</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by Dean Wampler</title>
      <description>&lt;p&gt;This is a summary of my cumulative experience.&lt;/p&gt;


	&lt;p&gt;I did say that you should use continuous integration. Also, it&amp;#8217;s true that you may get a similar curve with &amp;#8220;Test-After Development&amp;#8221;, but the design won&amp;#8217;t be as good and you&amp;#8217;ll find yourself doing more heavy-duty refactoring to retrofit the tests (e.g., breaking dependencies that make testing hard). Hence, you&amp;#8217;ll be closer to the &amp;#8220;bad&amp;#8221; curve, probably.&lt;/p&gt;</description>
      <pubDate>Sun, 30 Sep 2007 15:33:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ec3263e0-cc97-43d5-a560-e8e32ed40a96</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-819</link>
    </item>
    <item>
      <title>"Why you have time for TDD (but may not know it yet...)" by Arnon Rotem-Gal-Oz</title>
      <description>&lt;p&gt;I am sorry, but you are just a lot of hand waiving  here. There&amp;#8217;s nothing here that explains why TDD will cause this effect
for instance if you do TDD but not integrate often you&amp;#8217;d just have a lot of tested units and you&amp;#8217;d still fail
if you do code first and write unit tests after + continuous integration and system tests you should probably get a similar curve etc.&lt;/p&gt;


	&lt;p&gt;Arnon&lt;/p&gt;</description>
      <pubDate>Sat, 29 Sep 2007 17:58:20 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:21c540a4-0a6d-49ec-83d1-cb1e3ab0082a</guid>
      <link>http://blog.objectmentor.com/articles/2007/09/30/why-you-have-time-for-tdd-but-may-not-know-it-yet#comment-817</link>
    </item>
  </channel>
</rss>
