<?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>maxheapsize.com &#187; Development</title>
	<atom:link href="http://maxheapsize.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://maxheapsize.com</link>
	<description>Oliver Wehrens on Programming and Agile</description>
	<lastBuildDate>Tue, 14 Jun 2011 20:41:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>One assert per test, really.</title>
		<link>http://maxheapsize.com/2011/06/14/one-assert-per-test-really/</link>
		<comments>http://maxheapsize.com/2011/06/14/one-assert-per-test-really/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 20:41:41 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[assert]]></category>
		<category><![CDATA[assertion]]></category>
		<category><![CDATA[fest]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=622</guid>
		<description><![CDATA[Recently I was debugging my code and I could not see why my test was failing. It took me about 20 minutes to see that I violated one rule I try to follow. One assert per test. After tweeting it I got some reaction ranging from &#8216;this is a very silly guideline&#8217; to &#8216;Tests should [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2011%2F06%2F14%2Fone-assert-per-test-really%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2011%2F06%2F14%2Fone-assert-per-test-really%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Recently I was debugging my code and I could not see why my test was failing. It took me about 20 minutes to see that I violated one rule I try to follow. <strong>One assert per test</strong>. </p>
<p>After <a href="http://twitter.com/#!/owehrens/status/78809340437467136">tweeting</a> it I got some reaction ranging from &#8216;this is a very silly guideline&#8217; to &#8216;Tests should test one thing. Often one assertion, but not always.&#8217;. I, of course, tend to agree the latter one. </p>
<p>So <strong>what&#8217;s in for you</strong> when you use one assert per test? What are the problems?</p>
<p>One the plus side:</p>
<ol>
<li>If a tests fails, you <strong>know what is wrong</strong>.</li>
<li>You know <strong>how to name</strong> your test method, since you are just testing one thing.</li>
<li>It plays very nicely along with <strong>Test Driven Development</strong>, test and implement one feature at a time and make it work.</li>
<li>If you change one thing in your code, at best <strong>only one unit test will fail</strong> (ok, this one is hard but possible).</li>
<li>With multiple asserts you fix one assert which is broken and only then you see that the<strong> next one is broken too</strong>.</li>
</ol>
<p>The other side:</p>
<ol>
<li>You need to<strong> think more</strong> about the test setup, it should be possible to really just test one thing and mock the rest. Think, design for testability.</li>
<li><strong>More (test) code</strong>.</li>
<li>It looks like it is easier to have multiple asserts.</li>
</ol>
<p>I try to do one assert per test. Once in a while my code reviewer catches one of the multiple asserts per test. Some times this is ok, some times I fix it. </p>
<p><strong>My rule is to have one assert per test almost every time.</strong> But try it at least.</p>
<p>And while on it, use a better assert lib. Both JUnit and TestNG Assert confuse the heck out of me. <a href="http://passion.forco.de/">Ansgar</a> introduced <a href="http://docs.codehaus.org/display/FEST/Fluent+Assertions+Module">  FEST Fluent Assertions Module</a> to our team. Now my tests look something like:</p>
<pre class="brush: java; title: ;">
  @Test
  public void testAddSubscriber() {
    TestEventSubscriber eventSubscriber = new TestEventSubscriber();
    eventPublisher.registerSubscriber(eventSubscriber);
    assertThat(eventPublisher.getEventSubscribers()).
       containsOnly(eventSubscriber);
  }
</pre>
<p>If you don&#8217;t know it, try it. I do like it.</p>
<p>Which thoughts do you have ?</p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2011/06/14/one-assert-per-test-really/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/&amp;title=One+assert+per+test%2C+really." rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/&amp;title=One+assert+per+test%2C+really." rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=One+assert+per+test%2C+really.&amp;url=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/&amp;title=One+assert+per+test%2C+really." rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/&amp;title=One+assert+per+test%2C+really." rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/&amp;bm_description=One+assert+per+test%2C+really." rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/&amp;title=One+assert+per+test%2C+really." rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/&amp;title=One+assert+per+test%2C+really." rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2011/06/14/one-assert-per-test-really/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/&amp;title=One+assert+per+test%2C+really." rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2011/06/14/one-assert-per-test-really/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+One+assert+per+test%2C+really.+@+http://maxheapsize.com/2011/06/14/one-assert-per-test-really/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2011/06/14/one-assert-per-test-really/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Busy Programmers Guide on where to buy eBooks</title>
		<link>http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/</link>
		<comments>http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 21:00:20 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ebook]]></category>
		<category><![CDATA[epub]]></category>
		<category><![CDATA[kindle]]></category>
		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=557</guid>
		<description><![CDATA[Every Programmer needs to read books. Usually you would get some packages from Amazon (or your favorite retailer) and read through them. Now with devices like the Kindle and iPad (and Nook and&#8230;) things will change. No more carrying around a couple of hundred pages of paper. Only some Megabytes on Gigabytes of storage. The [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F06%2F05%2Fbusy-programmers-guide-on-where-to-buy-ebooks%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F06%2F05%2Fbusy-programmers-guide-on-where-to-buy-ebooks%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Every Programmer needs to read books. Usually you would get some packages from Amazon (or your favorite retailer) and read through them.<br />
Now with devices like the Kindle and iPad (and Nook and&#8230;) things will change. No more carrying around a couple of hundred pages of paper. Only some Megabytes on Gigabytes of storage. The displays nowadays are good enough and the battery is not a problem for the most part.</p>
<p>Now the tricky part, you want your books in a format which you can read on many devices. The obvious candidates are:</p>
<ul>
<li><strong>PDF</strong> : Lots of books are available in pdf, be sure not to get DRM PDF. Not all reader software can show this.</li>
<li><strong>Kindle (.azw)</strong> : The Kindle Software is available for many devices (iPad, PC, Mac and of course Kindle devices).</li>
<li><strong>mobi</strong> : Some stuff is available in .mobi as well.</li>
<li><strong>ePub</strong> : This is also wide spread. A DRM&#8217;d version is also available. So make sure your reader is able to handle that.</li>
</ul>
<p>The best choice is of course to get non protected (read non-drm) books. To me pdf, epub and azw (I know, drm) all look nice. It is just a question of your reading device. </p>
<p>Formats are important but and the end, where do I get my books?</p>
<p>I picked a few publisher and looked on what they provide. Amazon is a different thing anyway. I compare the prices to their Kindle format.</p>
<style>
td { width: 80px; background #ccc; text-align: center }
th { text-align: center }
table { border: 1px dotted black; padding: 10px; }
</style>
<p><b><a href="http://manning.com/catalog/mobile/">Manning</a></b> &#8211; <a href="http://www.manning.com/bibeault/">jQuery in Action</a></p>
<table>
<tr>
<th></th>
<th>Print Book</th>
<th>eBook</th>
<th>Amazon</th>
<th>Kindle</th>
</tr>
<tr>
<td><img src="http://ecx.images-amazon.com/images/I/51srSzNztpL._SL160_PIsitb-sticker-arrow-dp,TopRight,12,-18_SH30_OU01_AA115_.jpg"></td>
<td>$39.99 (+ PDF)</td>
<td style="background: #8BC95A">$24.55 (.epub, pdf, .mobi)</td>
<td >$29.69</td>
<td >Could not find Manning titles for Kindle</td>
</table>
<p><b><a href="http://www.wrox.com/WileyCDA/Section/All-Titles-Books-Ebooks-for-Programmers-ASP-NET-C-Javascript-More.id-105077.html">Wrox</a></b> &#8211; <a href="http://www.wrox.com/WileyCDA/WroxTitle/Professional-XMPP-Programming-with-JavaScript-and-jQuery.productCd-0470540710.html">Professional XMPP Programming with JavaScript and jQuery</a></p>
<table>
<tr>
<th></th>
<th>Print Book</th>
<th>eBook</th>
<th>Amazon</th>
<th>Kindle</th>
</tr>
<tr>
<td><img src="http://ecx.images-amazon.com/images/I/51zBSAaHI8L._SL160_AA115_.jpg"></td>
<td>$49.99</td>
<td>$49.99 (pdf, could be DRM)</td>
<td >$31.49</td>
<td style="background: #8BC95A">$19.54</td>
</table>
<p><b><a href="http://oreilly.com/ebooks/">OReilly</a></b> &#8211; <a href="http://oreilly.com/catalog/9780596809485/">97 Things Every Programmer Should Know</a></p>
<table>
<tr>
<th></th>
<th>Print Book</th>
<th>eBook</th>
<th>Amazon</th>
<th>Kindle</th>
</tr>
<tr>
<td><img src="http://ecx.images-amazon.com/images/I/51uSFVY7zjL._SL160_PIsitb-sticker-arrow-dp,TopRight,12,-18_SH30_OU01_AA115_.jpg"></td>
<td>$29.99 ($32.99 Book + eBook)</td>
<td>$23.99 (Android, Mobi, PDF, ePub) </td>
<td >$19.79</td>
<td style="background: #8BC95A">$18.85</td>
</table>
<p><b><a href="http://apress.com/ecommerce/ebookshop">APress</a></b> &#8211; <a href="http://apress.com/book/view/1430219483">Coders at Work</a></p>
<table>
<tr>
<th></th>
<th>Print Book</th>
<th>eBook</th>
<th>Amazon</th>
<th>Kindle</th>
</tr>
<tr>
<td><img src="http://ecx.images-amazon.com/images/I/51DEnAtKzBL._SL160_PIsitb-sticker-arrow-dp,TopRight,12,-18_SH30_OU01_AA115_.jpg"></td>
<td>$29.99</td>
<td>$20.99 (pdf) </td>
<td style="background: #8BC95A">$18.85</td>
<td>$19.79</td>
</table>
<p><b><a href="https://www.packtpub.com/">Packt Publishing</a></b> &#8211; <a href="https://www.packtpub.com/solr-1-4-enterprise-search-server/book">Solr 1.4 Enterprise Search Server</a></p>
<table>
<tr>
<th></th>
<th>Print Book</th>
<th>eBook</th>
<th>Amazon</th>
<th>Kindle</th>
</tr>
<tr>
<td><img src="http://ecx.images-amazon.com/images/I/5141rH49WML._SL160_AA115_.jpg"></td>
<td>$40.49</td>
<td style="background: #8BC95A">$30.59 (pdf)</td>
<td >$35.39</td>
<td> Could not find any Packt titles for Kindle</td>
</table>
<p><b><a href="http://pragprog.com/">Pragmatic Bookshelf</a></b> &#8211; <a href="http://pragprog.com/titles/vsscala/programming-scala">Programming Scala: Tackle Multi-Core Complexity on the JVM</a></p>
<table>
<tr>
<th></th>
<th>Print Book</th>
<th>eBook</th>
<th>Amazon</th>
<th>Kindle</th>
</tr>
<tr>
<td><img src="http://ecx.images-amazon.com/images/I/51hfd66G1pL._SL160_AA115_.jpg"></td>
<td>$34.95 ($43.75 book + pdf,mobi,epub)</td>
<td style="background: #8BC95A">$22.00 (pdf,mobi,epub)</td>
<td >$23.07</td>
<td> Could not find any titles for Kindle</td>
</table>
<h3>Conclusion:</h3>
<p>Amazon shines, if they can offer eBooks there are priced very low, sometimes even the printed book is cheaper then the publisher eBook. If you can cope with Amazons format, a Kindle (or a Kindle app) is the way to go. Instant download, sharing between devices, very nice. I can now carry around dozens of books which I get for very cheap.<br />
<a href="http://twitter.com/manningbooks">Mannings</a> and <a href="http://twitter.com/wrox">Wrox</a> have Twitter accounts where they announce good discounts on printed and electronic books. Worth to checkout. APress eBooks are always 30% cheaper as the cover price of the printed one.<br />
Most of the publishers do have an extensive part of their books available as eBoooks.</p>
<p>Getting the eBooks is especially nice for folks living outside the US, e.g. &#8217;97 Things Every Programmer Should Know&#8217; is listed for about $27 at Amazon Germany. So I save about 40%. I will buy more books now since they are now much cheaper and more accessible to me.</p>
<p>My reader is an iPad with iBooks for epubs, the Kindle app for Amazon&#8217;s selection and GoodReader for Pdf&#8217;s. </p>
<p>Does anybody have good or bad experience with eBooks? </p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/&amp;title=Busy+Programmers+Guide+on+where+to+buy+eBooks" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/&amp;title=Busy+Programmers+Guide+on+where+to+buy+eBooks" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=Busy+Programmers+Guide+on+where+to+buy+eBooks&amp;url=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/&amp;title=Busy+Programmers+Guide+on+where+to+buy+eBooks" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/&amp;title=Busy+Programmers+Guide+on+where+to+buy+eBooks" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/&amp;bm_description=Busy+Programmers+Guide+on+where+to+buy+eBooks" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/&amp;title=Busy+Programmers+Guide+on+where+to+buy+eBooks" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/&amp;title=Busy+Programmers+Guide+on+where+to+buy+eBooks" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/&amp;title=Busy+Programmers+Guide+on+where+to+buy+eBooks" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Busy+Programmers+Guide+on+where+to+buy+eBooks+@+http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/06/05/busy-programmers-guide-on-where-to-buy-ebooks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Lightweight Web Prototyping for the Framework loving (Java) Developer</title>
		<link>http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/</link>
		<comments>http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 13:00:53 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=532</guid>
		<description><![CDATA[A couple of month ago I had an idea for a small web app. But what does it take to do it ? Do you start with the back end or the front end (read server or client side) ? Typically I would start at the back end, get the domain right and then see [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F04%2F20%2Flightweight-web-prototyping-for-the-framework-loving-java-developer%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F04%2F20%2Flightweight-web-prototyping-for-the-framework-loving-java-developer%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.flickr.com/photos/istylr/3777635804/sizes/s/"><img class="alignleft" src="http://farm3.static.flickr.com/2562/3777635804_babcd16f90_m.jpg" title="Â¬Â© iStylr @ flickr"  /></a>A couple of month ago I had an idea for a small web app. But what does it take to do it ? Do you start with the back end or the front end (read server or client side) ? Typically I would start at the back end, get the domain right and then see how I can fit the UI in. If a programmer starts this way you end with the typical &#8216;the programmer did the GUI&#8217; scenario. That&#8217;s not really what I wanted. Don&#8217;t think too much about the domain, just see what the needs of the end user are and get the UI done (right). </p>
<h3>Trying frameworks &#8230;</h3>
<p>But there you go, being a framework loving web developer, how do you do the UI, or better, in what technology? Among other I tried  <a href="https://javaserverfaces.dev.java.net/">JSF 2</a> and I thought it&#8217;s cool. After a couple of hours I realized that this will slow me down. Fiddling with different ideas and concepts I just could not do that with JSF right away. I would have to write my own components. This is supposed to be very easy but still too much waste when I&#8217;m not sure if I even will use this.</p>
<h3> Trying paper&#8230; </h3>
<p>Next I started very basic and did some drawings. While this is all nice (I did it on my white board, I strongly recommend to do this on something you can erase) it turns out I had no idea on how to realize that in Html. I knew this must be possible somehow today but I had no idea what does it take to implement things like drag and drop, box scrolling, reordering and more. Nice thing I build on <a href="http://www.raincreativelab.com/paperbrowser/">paper</a>&#8230;but can I do it ?</p>
<h3>The solution</h3>
<p>What if I now combine those two approaches ? I needed some lightweight web framework, easy to learn (maybe one I already know) with  quick turn around. After looking around for a couple of hours I came up with <a href="http://www.w3.org/TR/html5/">Html</a> and <a href="http://jquery.com/">jQuery</a>. </p>
<p>I have some knowledge in Html and Css but I never did anything in Javascript or jQuery. So there is something new to learn. Since this was on my agenda anyway and I already bought Mannings <a href="http://www.manning.com/bibeault/">jQuery in Action</a> book in December I went this route. I hoped that adding jQuery into the page would give me some interactivity to the otherwise static Html page.</p>
<p> It turns out, it was the best choice. I came up with at least three completely different designs in a matter of evenings, got them to a working stage and could &#8216;feel&#8217; how they would work (or not). After experiencing this I decided to do some substantial changes to the UI. Dragging and dropping is all nice and dandy, but it&#8217;s too much clicking and dragging for the app. On paper this really looked cool but in practice it was not. </p>
<p>It&#8217;s amazing what you can do with jQuery. You can save state on elements using Html 5 attribute, can load other Html snippets as Ajax responses and use a dozen jQuery plugins for menus, zooming, dragging and so on. Not to mention the power of jQuery itself. You can append action, animations or anything to any element. Without programming one line server side I got a fully working prototype running including adding and removing items, saving, loading and dynamic generated forms.</p>
<p>Some more iterations later (still not 100% happy) I started to implement it for real. Since I wanted to stay with that design (and very much Ajax oriented) I went the route of <a href="http://directwebremoting.org/dwr/index.html">Direct Web Remoting</a> and <a href="http://freemarker.sourceforge.net/">Freemarker</a>. Freemarker will render my templates and DWR talks to my Spring beans. Whenever I needed to design another page I first did the standalone Html version, got it to a working state and then integrated it in the app.</p>
<h3>Conclusion</h3>
<p>Even if I would not have decided to use jQuery and pure Html for the final implementation (totally depends on the use case) I would strongly consider going the same route for doing the prototype again. It was so easy and the feedback was right there. I could throw away not working ideas  and make new ones very easily. There was a learning curve using jQuery (and I needed to refresh my CSS) but it was time well invested.</p>
<p>How do you your prototypes? Fully integrated with your existing frameworks or on paper? </p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/&amp;title=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/&amp;title=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer&amp;url=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/&amp;title=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/&amp;title=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/&amp;bm_description=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/&amp;title=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/&amp;title=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/&amp;title=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer+@+http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How we switched from Subversion to Git</title>
		<link>http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/</link>
		<comments>http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 13:00:11 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[git subversion]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=497</guid>
		<description><![CDATA[So I heard about these strange distributed version control systems like over a year ago. I used it in my own little projects and everything went smoothly and I really liked it. The idea also caught on at work and my team started a using Git in a fresh project last summer. We did not [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F03%2F22%2Fhow-we-switched-from-subversion-to-git%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F03%2F22%2Fhow-we-switched-from-subversion-to-git%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img class="alignleft" src="http://git.wiki.kernel.org/images-git/2/24/Gitlogo.svg_from_msysGit.png" title="Â¬Â© GitLogo @ mssysgit"  /><br />
So I heard about these strange <strong>distributed version control system</strong>s like over a year ago. I used it in my own little projects and everything went smoothly and I really liked it.<br />
The idea also caught on at work and my team started a using Git in a fresh project last summer. We did not had so much problems since you can use Git very much like a central vcs like Subversion if you want to.</p>
<p>Still, for all other code, we <strong>used Subversion</strong>.<br />
We believe in agile and feature branches, so that&#8217;s what we do a lot. Every story has its own branch. If one story touches multiple code bases, that means multiple <a href="http://www.infoq.com/articles/agile-version-control">merge down/copy up&#8217;s</a>.<br />
At some point, in preparation for a sprint review, we found that code had disappeared from the trunk. Everything seems to work perfectly, just this feature was missing. Usually you would think if code was deleted, there would be at least one test failing and telling you that something is missing. But no, typing <strong>one wrong version number</strong> during merge down/copy up <strong>cut out the story</strong> very cleanly. Once we found the problem we could merged it back in from the not yet deleted feature branch.<br />
Overall we managed to work with Subversion but it was a growing pain since we knew there was something better. </p>
<p>There are several advantages of distributed version control system which you all might have heard of already so I won&#8217;t go in to detail of this (of course there is also one major disadvantage: complexity). The <strong>main advantages</strong> for me are:</p>
<ul>
<li>Everything is local &#8211; very fast</li>
<li>Merging is much much easier (or updating from another repo)</li>
<li>Because merging is easier I tend to branch more often to try out ideas</li>
</ul>
<p>Now, what does it take for my team to get Git going in all major code bases?</p>
<h1>Technology</h1>
<p>Here is our setup what we use at work:</p>
<ul>
<li>Windows PC, some Mac OS X</li>
<li>IntelliJ Idea 9.0.x</li>
<li>Teamcity 5.0.x</li>
<li>Maven</li>
</ul>
<h3>The OS: Windows and Mac</h3>
<p>Basically no surprise here. <strong>Works</strong> on both machines.</p>
<h3>The IDE: IntelliJ Idea 9</h3>
<p>Idea does support Git. I do like the approach which they took to simply use the git binary of your operating system. With the version control console you can see what Idea is doing. This way you can watch and learn. Back with subversion we had sometimes trouble using two different tools for handling subversion problems, like Idea and Tortoise SVN. Using the same tool for everything will make it easier.<br />
The Git integration is not perfect but it <strong>does work well</strong>.</p>
<h3>Continuous Integration: Teamcity</h3>
<p>Teamcity does support Git the same way as Subversion. There is one drawback however: <strong>Pre-Tested checkins are not supported yet</strong>. This cool features allows you to run all tests before checking in. You will never have a broken branch/trunk if you use it! Basically it will take your changes to the code base, runs all tests and only commits them if everything passes. Sadly, it does not work with Git (yet, but you can <a href="http://youtrack.jetbrains.net/issue/TW-11344">vote for this feature</a>).<br />
Teamcity does allow you however to do a remote run with the changes you committed locally. So you check in everything locally and while Teamcity runs all the tests you can keep on coding. Running all tests with your current changes in the change list is also supported.<br />
Teamcity uses JGit and has some limitations (like no tagging support). In Teamcity 5.1 they want to use the Git binary as well.</p>
<p>Another problem, which I will talk about in the next section, is agent side checkout.</p>
<h3>Build Tool: Maven</h3>
<p><strong>Maven supports git as scm</strong>. Nothing more to say. </p>
<p>Since we are releasing our software every other week we automated the build process to two stages. Building the release and packaging different build artifacts. We used to have a button in Teamcity, push it and 30 minutes later we had a release. Unfortunately the way Teamcity supports Git is that the code which will get checkout does not have a .git directory (and for maven it is not under source control). I still wonder what the heck they are doing there. Without that, maven can not advance the version numbers in your pom and you are stuck. Please go and <a href="http://youtrack.jetbrains.net/issue/TW-10741">vote for this feature now</a>. Thanks.<br />
Until then we just do it like in the good old times and do a maven release from the command line.</p>
<h1>People</h1>
<p>While everything so far was technical, the biggest challenge might be mindset of the people and support from your friendly manager. </p>
<p>I&#8217;m lucky that my boss is very hands on and really liked that idea (also, since he was the one we usually asked if we yet again had problems with Subversion properties being messed up somehow). Otherwise you might need to do some ROI calculation why this really is a good idea.</p>
<p>What I encourage is that <strong>every team needs to have 1 or 2 people interested in git</strong>. The others in the team should see the benefit of it, even though they don&#8217;t know how git works. My advice would be that one person would give a  <strong>20 minutes presentation of what you can do</strong> with it to all interested co workers. We did not do it,  but looking back, we should have done it. Make sure that you bring across the message that switching scm&#8217;s will not be that easy. If possible make everyone <strong>read the first 3 chapters</strong> of the freely available <strong><a href="http://progit.org/book">Pro Git</a></strong> book (and also  buy a copy or two for the library). This will give them a much better understanding.<br />
It is change and <strong>change usually causes some trouble</strong>. We got a <strong>team commitment</strong> for it so at least nobody was opposed to it. If a couple of people are not happy with the way how the new things are around here, they will have an easy time to make a loud and clear statement that switching to Git was a bad idea. Git is more complex but also more powerful. </p>
<p>I did a  <strong>plan</strong> on how to <strong>migrate</strong>. This took me just a couple of hours. </p>
<ul>
<li>Which code bases to migrate</li>
<li>Where to put the git repositories? Use the filesystem, SSH, <a href="http://gitorious.org/">Gitorius</a>, <a href="http://eagain.net/gitweb/?p=gitosis.git">Gitosis</a>, <a href="http://fi.github.com/">Github:fi</a> </li>
<li>You might need more infrastructure, everybody needs ssh keys</li>
<li>Any depended processes</li>
<li>External collaborators</li>
<li>When does operations have time to implement it</li>
<li>Does the release process still work</li>
<li>Continuous Integration System</li>
<li>Test conversion of the subversion repository</li>
<li>Access rights</li>
<li>&#8230; there might be more I forgot about</li>
</ul>
<p>Plan and test these as much as you can. We started to use git just to discover that we missed some use cases like our automated runs to check the external web service dependencies. Two people doing the planning certainly helps.</p>
<p>After start using it, we had  <strong>one guy</strong> (me) who went around for the first 2-3 days and <strong>helped people with their git related problems</strong>. There will be problems, I promise!</p>
<p>We did migrate all of our code at once since we did not want to be stuck between two vcs&#8217;s. We will go with Gitorius and ssh based authentication. Since we do not have a server for that (yet) we use a shared drive for the time being as a repository. Being distributed it will be no problem for Git to change it&#8217;s location later on.</p>
<p>The first two of days were a bit tricky but it got much smoother after we all got used to it. </p>
<p>The<strong> work flow is different</strong> and it will take some time until everybody takes advantages of all the features like commit your files more often or make more private branches to try out ideas.<br />
We <strong>started with a similar work flow</strong> we are used to  and plan to introduce one feature of git at a time. This could have been better. <strong>Iron out the known commit habits with Git</strong> and make sure this works in your favorite IDE before hand. It is very important to make the transition a better experience. </p>
<p>We started just this month but we already had some nice effects like merging two branches with renamed files. On guy changed file and somebody else renamed the same file in his repository.  As he merged in the changes, the change appeared in the renamed file. Really great. </p>
<p>Do you use a distributed version control system? How did your transition go ?</p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/&amp;title=How+we+switched+from+Subversion+to+Git" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/&amp;title=How+we+switched+from+Subversion+to+Git" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=How+we+switched+from+Subversion+to+Git&amp;url=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/&amp;title=How+we+switched+from+Subversion+to+Git" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/&amp;title=How+we+switched+from+Subversion+to+Git" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/&amp;bm_description=How+we+switched+from+Subversion+to+Git" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/&amp;title=How+we+switched+from+Subversion+to+Git" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/&amp;title=How+we+switched+from+Subversion+to+Git" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/&amp;title=How+we+switched+from+Subversion+to+Git" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+we+switched+from+Subversion+to+Git+@+http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/03/22/how-we-switched-from-subversion-to-git/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>5 code metrics you need to watch</title>
		<link>http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/</link>
		<comments>http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 14:00:27 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[coverage]]></category>
		<category><![CDATA[metric]]></category>
		<category><![CDATA[quality]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=459</guid>
		<description><![CDATA[Developing software ain&#8217;t easy. How do you know how you are doing ? You could start collecting metrics about your code. These can give you some indication how maintainable andÂ¬â€  reliableÂ¬â€  it is. The metric which come to mind to the most people is code coverage. Some people say it must be near 100%, other [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F02%2F23%2F5-code-metrics-you-need-to-watch%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F02%2F23%2F5-code-metrics-you-need-to-watch%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.flickr.com/photos/iliahi/2606644514/sizes/s/" title="Â¬Â© Biking Nikon PDX@flickr" ><img class="alignleft" src="http://farm4.static.flickr.com/3241/2606644514_b6f294fb2e_m.jpg" title="Â¬Â© Biking Nikon PDX@flickr" width="240" height="167" /></a></p>
<p>Developing software ain&#8217;t easy.</p>
<p>How do you know how you are doing ?</p>
<p>You could start <strong>collecting metrics</strong> about your code. These can give you some indication how maintainable andÂ¬â€  reliableÂ¬â€  it is.</p>
<p>The metric which come to mind to the most people is <strong>code coverage</strong>. Some people say it must be near 100%, other say 80% is a good number. At the end it can&#8217;t tell you if you are doing great or good. The only thing you might read from it is that a <strong>low number</strong> indicates a <strong>potential problem</strong>.</p>
<p>Duplication is another one you should look out for. A high number of <strong>duplicated code</strong> might bring up the problem that a bug was fixed in one place but lives on in other. If you are doing code generation (e.g. from WSDL&#8217;s) you might have a lot of duplicated code reported to you. A closer inspection is needed to really make sure this is a problem in the code you have written and is not auto generated.</p>
<p><strong>Test success</strong> is not a metric you should be worried to much about. It just needs to be <strong>100% </strong>at every checking in a shared repository. <strong>No discussion</strong>.</p>
<p><a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity"><strong>Cyclomatic complexity</strong></a> let&#8217;s you measure the number of linearly independent paths through your code. A high number means a more complex code. A complex code base is hard to maintain and involves a lot of work to adopt it to new requirements.</p>
<p>Dependencies between packages is another important value to check on (see <a href="http://www.objectmentor.com/resources/articles/granularity.pdf">Uncle Bob&#8217;s paper on Acyclic Dependency Principle</a>). Basically it revolves around that packages should not have <strong>cyclic dependencies</strong> between them since this does have an impact on releasing and testing (and therefore coding).  A change in one package could trigger a whole system build to make sure everything works together.</p>
<p>Tools like Findbugs let you define rules to which your code should comply to. This is great because it is tailored to your code/company and ensures you control and fine tune the measures. Or so. It requires some time to define these rules. They need to be refined over time and you have to understand them to make use of it. Of course you can leave out some of these and reduce complexity. Do not underestimate the effort to implement these.</p>
<p>This rounds up the metrics you can get from your code base.</p>
<p>But wait, there is <strong>more</strong>.</p>
<p>A valuable metric is the <strong>meantime between reporting</strong> a feature or bug <strong>and fixing</strong>. This gives your team (and management of course) a rough estimate how fast you can react to market changes.</p>
<p>To get an estimate of the mean time before a failure happens you can <strong>measure the time between two bugs</strong>. The higher the number the better. Current reported bugs per lines of code can also be measured. These metrics will give you some confidence in your code base.</p>
<p>At the end of the day the <strong>ultimate measure</strong> is the money on the company&#8217;s bank account. If this is not working out you are in trouble.</p>
<h2>How to get all of these ?</h2>
<p>There are some static code analysis tools to get you started. I only can talk about Java related tools but there <a href="http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis">are others</a> as well.</p>
<ul>
<li><a href="http://checkstyle.sourceforge.net/">Checkstyle</a></li>
<li><a href="http://findbugs.sourceforge.net/">FindBugs</a></li>
<li><a href="http://pmd.sourceforge.net/">PMD</a></li>
<li><a href="http://cobertura.sourceforge.net/">Cobertura</a></li>
<li><a href="http://www.headwaysoftware.com/products/structure101/index.php">Structure 101</a></li>
<li><a href="http://sonar.codehaus.org/">Sonar</a></li>
</ul>
<p>To get more information about your bugs should query your bug tracking system like <a href="http://www.atlassian.com/software/jira/">Jira</a> or <a href="http://www.bugzilla.org/">Bugzilla</a>.</p>
<h2>Summary</h2>
<p>There are much more numbers out there but I think these are the ones you should always keep an eye on.</p>
<p>Look out for</p>
<ul>
<li>Code Coverage</li>
<li>Duplication</li>
<li>Cyclomatic complexity</li>
<li>Cyclic dependencies</li>
<li>Test success</li>
<li>Time to market</li>
<li>Mean time between failure</li>
</ul>
<p>What metrics do you look out for ? <strong>Let me know </strong> in in the comments and why.</p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/&amp;title=5+code+metrics+you+need+to+watch" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/&amp;title=5+code+metrics+you+need+to+watch" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=5+code+metrics+you+need+to+watch&amp;url=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/&amp;title=5+code+metrics+you+need+to+watch" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/&amp;title=5+code+metrics+you+need+to+watch" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/&amp;bm_description=5+code+metrics+you+need+to+watch" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/&amp;title=5+code+metrics+you+need+to+watch" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/&amp;title=5+code+metrics+you+need+to+watch" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/&amp;title=5+code+metrics+you+need+to+watch" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+5+code+metrics+you+need+to+watch+@+http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Name your objects right</title>
		<link>http://maxheapsize.com/2010/02/09/name-your-objects-right/</link>
		<comments>http://maxheapsize.com/2010/02/09/name-your-objects-right/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 15:00:21 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[naming]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=447</guid>
		<description><![CDATA[Whenever you create an object you have to find a meaningful name. While renaming later in modern IDE&#8217;s is no problem at all you should not pick the first name which comes to your mind. Imagine you have an external fraud detection web service and it will return a &#8216;hit&#8217; or &#8216;miss&#8217;. How do you [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F02%2F09%2Fname-your-objects-right%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F02%2F09%2Fname-your-objects-right%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.flickr.com/photos/nataliemaynor/2988366432/sizes/s/"><img alt="No Name" src="http://farm4.static.flickr.com/3220/2988366432_8f39394055_m.jpg" title="&copy; NatalieMaynor @ flickr" width="180" height="240" /></a><br />
Whenever you create an object you have to find a meaningful name.</p>
<p>While renaming later in modern IDE&#8217;s is no problem at all you should not pick the first name which comes to your mind. </p>
<p>Imagine you have an external fraud detection web service and it will return a &#8216;hit&#8217; or &#8216;miss&#8217;. How do you name this object? HitOrMiss maybe (since this is the representation you get from the webservice) ? It might describe the problem at hand. If you go with this name it will dripple down through all layers. The domain model, the dto&#8217;s, services and more will now reference to this object (and create their own derivates for it). Your colleagues which code up other parts of the system will refer to it and create their own variants of the name (like structure for web pages). The wrong name is now all over your code.</p>
<p>So much for refactoring in your IDE. You will never catch all the places automatically where the wrong name was used.</p>
<p>While it <strong>seemed lost time</strong> discussing the &#8216;right&#8217; name for 5 minutes in the beginning it <strong>saves</strong> you much more <strong>time</strong> afterwards. Of course you might get also confused a couple of weeks later remembering what this thing really does and what it is used for.</p>
<p>Make sure you take time in naming your objects. A <strong>wrong decision</strong> can do some <strong>harm</strong> to your code. The later it turns out that the name was not correct the much more <strong>expensive</strong> it becomes <strong>to correct</strong> this mistake. If you are not really sure how to name it, talk to your colleagues and discuss the name. A second opinion can not hurt.	</p>
<p>Maybe FraudDetectionResult would have been a better choice. </p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2010/02/09/name-your-objects-right/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2010/02/09/name-your-objects-right/&amp;title=Name+your+objects+right" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2010/02/09/name-your-objects-right/&amp;title=Name+your+objects+right" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=Name+your+objects+right&amp;url=http://maxheapsize.com/2010/02/09/name-your-objects-right/&amp;title=Name+your+objects+right" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2010/02/09/name-your-objects-right/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2010/02/09/name-your-objects-right/&amp;title=Name+your+objects+right" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2010/02/09/name-your-objects-right/&amp;bm_description=Name+your+objects+right" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2010/02/09/name-your-objects-right/&amp;title=Name+your+objects+right" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2010/02/09/name-your-objects-right/&amp;title=Name+your+objects+right" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2010/02/09/name-your-objects-right/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2010/02/09/name-your-objects-right/&amp;title=Name+your+objects+right" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2010/02/09/name-your-objects-right/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Name+your+objects+right+@+http://maxheapsize.com/2010/02/09/name-your-objects-right/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/02/09/name-your-objects-right/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>What&#8217;s your preferred development infrastructure stack?</title>
		<link>http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/</link>
		<comments>http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 14:25:42 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[infrastructure]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=435</guid>
		<description><![CDATA[In Response to Matt Raible&#8217;s question about my preferred development stack. Source control In my own development project I switched to Git some time ago. I was using svn and before that cvs for a couple of years. Git just makes it easy to try out small ideas very quickly without reverting the code. We [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F01%2F13%2Fwhats-your-preferred-development-infrastructure-stack%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F01%2F13%2Fwhats-your-preferred-development-infrastructure-stack%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>In Response to <a href="http://raibledesigns.com/rd/entry/what_s_your_preferred_development">Matt Raible&#8217;s</a> question about my preferred development stack.</p>
<h3>Source control</h3>
<p>In my own development project I switched to <a href="http://git-scm.com">Git</a> some time ago. I was using svn and before that cvs for a couple of years. Git just makes it easy to try out small ideas very quickly without reverting the code. We will introduce Git at work pretty soon (I hope).</p>
<h3>The Atlassian cloud</h3>
<p>I was using <a href="http://www.atlassian.com/software/confluence/">Confluence</a> as a Wiki in my open source project and my current employer <a href="http://www.hypoport.de">Hypoport</a> uses it as well.  Bug tracking is pretty much a task of <a href="http://www.atlassian.com/software/jira/">Jira</a>. Those two integrate very nicely. You can have ping backs in your Jira Ticket from Confluence, so you see all related files. I would love to use <a href="http://www.atlassian.com/software/fisheye/">FishEye</a> but I&#8217;m not sure how to justify the costs and what the added value is in our case.</p>
<h3>The Code</h3>
<p>I&#8217;m pretty much sold to <a href="http://www.jetbrains.com/idea/index.html">Jetbrains IntelliJ Idea</a>. I&#8217;m using it for 5 years now. With it comes <a href="http://www.jetbrains.com/teamcity/">Teamcity</a>. It&#8217;s a very nice continuous integration tool where the biggest plus (among other things) is the delayed (and pre tested) checkin. No more late night checkins which break the master. We just rolled out the latest version which has a much nicer Git integration (so we can make the switch).</p>
<p>So it comes down to:</p>
<h3>The List</h3>
<ul>
<li>Source control: <b>Git</b></li>
<li>Wiki: <b>Atlassian Confluence</b></li>
<li>Continuous Integration: <b>Jetbrains Teamcity</b></li>
<li>Bugtracker: <b>Atlassian Jira</b></li>
</ul>
<p>We are about to use <a href="http://sonar.codehaus.org/">Sonar</a> for code analysis and development over time, but this is just in the beginning.</p>
<p>What&#8217;s yours ?</p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/&amp;title=What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/&amp;title=What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F&amp;url=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/&amp;title=What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/&amp;title=What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/&amp;bm_description=What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/&amp;title=What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/&amp;title=What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/&amp;title=What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+What%26%238217%3Bs+your+preferred+development+infrastructure+stack%3F+@+http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/01/13/whats-your-preferred-development-infrastructure-stack/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Concordion vs. Cucumber and Java based Acceptance Testing</title>
		<link>http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/</link>
		<comments>http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 05:57:03 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[acceptance]]></category>
		<category><![CDATA[concordion]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[cuke4duke]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=349</guid>
		<description><![CDATA[If you want your Business Analyst to provide some acceptance tests for your implementation it would be best to make sure you get it in some form your tests can read. That way you can make sure your code does really do that what the customers wants. Two tools to achieve that are Concordion and [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F10%2F13%2Fconcordion-vs-cucumber-and-java-based-acceptance-testing%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F10%2F13%2Fconcordion-vs-cucumber-and-java-based-acceptance-testing%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>If you want your Business Analyst to provide some acceptance tests for your implementation it would be best to make sure you get it in some form your tests can read. That way you can make sure your code does really do that what the customers wants. </p>
<p>Two tools to achieve that are <a href="http://www.concordion.org">Concordion</a> and <a href="http://cukes.info">Cucumber</a> (and cuke4duke).  Both taking the approach of <a href="http://c2.fit.com">Fit</a> a step further. You can find very good documentation for the tools on their web pages or as examples along with the code.</p>
<h2>Concordion</h2>
<p>Concordion let&#8217;s you write the specifications in html. You can  instrument them with some Concordion code. Since the instrumentation code is in html, it is hidden when you render it.</p>
<pre class="brush: xml; title: ;">
&lt;html xmlns:concordion=&quot;http://www.concordion.org/2007/concordion&quot;
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://www.concordion.org/2007/concordion &quot;&gt;
&lt;body&gt;
&lt;p&gt;
  &lt;span concordion:execute=&quot;setCurrentTime(#TEXT)&quot;&gt;09:00AM&lt;/span&gt;
  The greeting for user &lt;span concordion:set=&quot;#firstName&quot;&gt;Bob&lt;/span&gt;
  will be:
  &lt;span concordion:assertEquals=&quot;greetingFor(#firstName)&quot;&gt;Hello Bob!&lt;/span&gt;
&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Concordion can instrument free text as well as tables to have some sort of data provider for tests. It  integrates directly with JUnit (no TestNG support yet).</p>
<div class="wp-caption aligncenter" style="width: 417px"><img alt="Concordion Specification/Fixture/System" src="http://maxheapsize.com/static/ConcordionFixture.png" title="Concordion Specification/Fixture/System" width="407" height="114" /><p class="wp-caption-text">Concordion Specification/Fixture/System</p></div>
<p>The idea is that your specifications is stable. This will not change as much as maybe your code to fulfill the requirements of the customer. Your fixture bridges these two together. </p>
<pre class="brush: java; title: ;">
package com.maxheapsize.concordion;
import org.concordion.integration.junit3.ConcordionTestCase;
public class DemoTest extends ConcordionTestCase {

    public String greetingFor(String firstName) {
        return &quot;Hello &quot; + firstName + &quot;!&quot;;
    }

    public void setCurrentTime(String time) {
        System.out.println(time);
    }
}
</pre>
<p>Your java code provides the methods which are called from the specification. At that point you are most likely to use a DSL to build up your business logic. Concordion will assert the expected values. </p>
<p>After you run the unit test you will get a nice looking html page. </p>
<div class="wp-caption aligncenter" style="width: 640px"><img alt="Concordion output" src="http://maxheapsize.com/static/ConcordionResult.png" title="Concordion output" width="630" height="122" /><p class="wp-caption-text">Concordion output</p></div>
<p>Passed tests will be green, failed red, pretty easy.</p>
<p>Pro Concordion:</p>
<ul>
<li>Instrumention of  free text</li>
<li>The final report is nice looking</li>
<li>JUnit support</li>
<li>Easy setup</li>
<li>Pure Java</li>
</ul>
<p>Con Concordion:</p>
<ul>
<li>The business analyst needs to know a little bit of html</li>
<li>Usually the programmer needs to change the specification to instrument it</li>
<li>You program parts in html, refactoring support is missing</li>
<li>No TestNG support</li>
</ul>
<h2>Cucumber</h2>
<p>Cucumber is a ruby based behaviour driven development tool. Since you can run Ruby code inside the JVM with the help of JRuby it is possible to use it for your Java code. The usually way so far is that you use maven or ant to startup JRuby and the Cucumber ruby code.</p>
<p>In Cucumber you write your specification (or feature) in plain english (or russian, german,<a href="http://en.wikipedia.org/wiki/LOLCODE">lolcode</a> or 36 or so more supported languages). No instrumentation is necessary but your customer has to stick to a certain layout (or better: structure). It follows the well known given-when-then pattern.</p>
<pre class="brush: plain; title: ;">
Feature: Demo

  Scenario: A Car with 4 wheels
    Given I have a car
    When I add 4 wheels
    Then I should be able to drive the car
</pre>
<p>You can write your step definitions (like the fixture in Concordion) with the help of annotations.</p>
<pre class="brush: java; title: ;">
package com.maxheapsize.cucumber;

import cuke4duke.Given;
import cuke4duke.Then;
import cuke4duke.When;
import org.junit.Assert;

public class CarFeature {
  private Car car;
  @Given(&quot;I have a car&quot;)
  public void iHaveACar() {
    car = new Car();
  }

  @When(&quot;I add (\\d+) wheels&quot;)
  public void iAddWheels(int numberOfWheels) {
    car.setWheels(numberOfWheels);
  }

  @Then(&quot;I should be able to drive the car&quot;)
  public void iShouldBeAbleToDriveTheCar() {
    Assert.assertTrue(car.canDrive());
  }
}
</pre>
<p>The regular expressions defined in the annotations must match the feature definitions.</p>
<div class="wp-caption aligncenter" style="width: 490px"><img alt="Cucumber results" src="http://maxheapsize.com/static/cucumber.png" title="Cucumber results" width="480" height="159" /><p class="wp-caption-text">Cucumber results</p></div>
<p>You can define information in a table like structure as well to provide more data in an easy way. The given when then structure can be used to have multiple when&#8217;s or then&#8217;s. So it is very flexible that way.</p>
<p>Pro Cucumber</p>
<ul>
<li>Feature can be described in plain language</li>
<li>No extra programmer work on he feature required</li>
<li>Instrumentation is directly on the Java code via annotations</li>
</ul>
<p>Con Cucumber</p>
<ul>
<li>More complex due to the Ruby/JRuby/Java chain</li>
<li>Business analyst needs to stick to predefined format</li>
<li>The only way (without extra work to write a runner)  to run it seems to be within ant or maven, for rapid turn around and TDD I would like to have JUnit/TestNG support of some kind</li>
</ul>
<h2>Verdict</h2>
<p>It is easy to get started with both tools. I spent about a couple of hours with each of them and was able to get simple and a bit more complex examples running. They get you going with BDD and acceptance based testing.</p>
<p>I like parts of both concepts. I want to be able to write a feature like in Cucumber. The instrumentation should be directly on my code and not in the part of the customer. The easy setup and integration of Concordion with JUnit (need TestNG here) and the output of it is very nice. So where is the tool which has these features <img src='http://maxheapsize.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<p>So which tools will I use?</p>
<p>I have yet to see the use case where the business analyst writes the (and updates) the acceptance tests.  I don&#8217;t mind add some extra code to the specification and I know html. I might get started with Concordion for now.</p>
<p>You might also check my post about <a href="http://maxheapsize.com/2009/02/10/behavior-driven-development-with-easyb-and-vs-testng/">Behavior driven development with EasyB (and vs. TestNG)</a>.</p>
<p>Do you use any of these tools? Or a different one? What&#8217;s your expierence?</p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing&amp;url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;bm_description=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/&amp;title=Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Concordion+vs.+Cucumber+and+Java+based+Acceptance+Testing+@+http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Test JBoss Rules 5 (or Drools) with TestNG</title>
		<link>http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/</link>
		<comments>http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 20:25:55 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[drools]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[fit]]></category>
		<category><![CDATA[for for rules]]></category>
		<category><![CDATA[jboss rules]]></category>
		<category><![CDATA[testng]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=330</guid>
		<description><![CDATA[We have been using our own flavor of Fit for Rules (which is build on top of fit) for about 1 1/2 years now to test our business logic written in JBoss Rules 5. It&#8217;s relatively easy to get the Business Analyst on board since he is using his tool (which is Microsoft Excel) to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F09%2F23%2Ftest-jboss-rules-5-with-testng%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F09%2F23%2Ftest-jboss-rules-5-with-testng%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>We have been using our own flavor of <a href="http://fit-for-rules.sourceforge.net/">Fit for Rules</a> (which is build on top of <a href="http://fit.c2.com">fit</a>) for about 1 1/2 years now to test our business logic written in <a href="http://jboss.org/drools/">JBoss Rules 5</a>.  It&#8217;s relatively  easy to get the<strong> Business Analyst</strong> on board since he is using his tool (which is Microsoft Excel) to communicate test cases for the rules. So in theory, he writes the tests in <strong>Excel</strong>, we do the rules coding and voila, all <strong>tests turn green</strong>.</p>
<p>Reality is, we have to<strong> tweak the Excel sheets</strong>. We need to put in imports of our fact model, insert facts and create objects within that not so programmer friendly table environment. A couple of days ago we got the request to tweak some rules and we all had to start doing rules again (and we used to use Eclipse for writing rules because that&#8217;s the only IDE having a plugin for that). </p>
<p>After half a day of coding Java syntax in Excel sheets we decided that the <strong>ramp up time</strong> for the not so knowledgeable rules/fit programmers like me is<strong> too much</strong>. With debugging, copy and paste we spent easily 5-10 times more time on making the tests work than writing the code itself. Test driven design is not really an option here, since you need to know the imports of the rules file to get the sheet even to compile.</p>
<p>So what did we do ? Well why not try to get things working the way we used to do it ? TestNG anyone ?</p>
<p>There are <strong>many pros</strong> to use unit testing but also some cons. <strong>The biggest issue is that we will loose the direct communication to the business analyst</strong>. It&#8217;s always better if someone else writes the test and I just have to implement the solution. Maybe we can find another solution involving Active Spec or DSL. For now we stick to unit tests and the task the we have to make sure we convert every Excel test case to java code (but hey, that&#8217;s what our code reviews are for).</p>
<p>Checkout our current base class for testing our rules:</p>
<pre class="brush: java; title: ;">
public abstract class AbstractRulesTest {
   public abstract String[] getRulesFileNames();
   private final String GET_FINDINGS = &quot;import com.maxheapsize.RulesFinding;&quot; +
                                                                           &quot;query \&quot;getAllRulesFindings\&quot;\n&quot; +
                                                                           &quot;   finding : FRulesFinding()\n&quot; +
                                                                           &quot;end&quot;;

   private static Logger LOG = Logger.getLogger(AbstractRulesTest.class);

   public final List&lt;FRulesFinding&gt; fireRules(Set factsForWorkingMemory) {
       KnowledgeBase ruleBase = setUpKnowledgeBase();
       return fireRules(ruleBase, factsForWorkingMemory);
   }

   public KnowledgeBase setUpKnowledgeBase() {
       KnowledgeBaseConfiguration configuration = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
       KnowledgeBase ruleBase = KnowledgeBaseFactory.newKnowledgeBase(configuration);

       KnowledgeBuilder build = KnowledgeBuilderFactory.newKnowledgeBuilder();
       build.add(ResourceFactory.newReaderResource(new StringReader(GET_FINDINGS)), ResourceType.DRL);
       String[] fileNames = getRulesFileNames();
       for (String fileName : fileNames) {
           File userDefinedFile = new File(fileName);
           build.add(ResourceFactory.newFileResource(userDefinedFile), ResourceType.DRL);
       }

       handleBuilderErrors(build);

       ruleBase.addKnowledgePackages(build.getKnowledgePackages());
       return ruleBase;
   }

   private void handleBuilderErrors(KnowledgeBuilder build) {
       if (build.hasErrors()) {
           KnowledgeBuilderErrors knowledgeBuilderErrors = build.getErrors();
           for (KnowledgeBuilderError knowledgeBuilderError : knowledgeBuilderErrors) {
               int[] ints = knowledgeBuilderError.getErrorLines();
               LOG.error(&quot;Error at : &quot;+ints[0]+&quot; : &quot;+ints[1]);
               LOG.error(knowledgeBuilderError.getMessage());
           }
       }
   }

   private List&lt;FRulesFinding&gt; fireRules(KnowledgeBase ruleBase, Set facts) {
       List&lt;FRulesFinding&gt; result = new ArrayList&lt;FRulesFinding&gt;();
       StatefulKnowledgeSession statefulSession = ruleBase.newStatefulKnowledgeSession();
       for (Object fact : facts) {
           statefulSession.insert(fact);
       }
       statefulSession.fireAllRules();

       QueryResults results = statefulSession.getQueryResults(&quot;getAllRulesFindings&quot;);
       try {
           FRulesFinding finding = (FRulesFinding) results.iterator().next().get(&quot;finding&quot;);
           result.add(finding);
       }
       catch (NoSuchElementException e) {
           result = new ArrayList&lt;FRulesFinding&gt;();
       }
      return result;
   }
}
</pre>
<p>All my rules insert a RulesFinding (and only one at the moment) into the working memory when triggered.  The rest is pretty easy. You subclass it, overwrite getRulesFileNames and call fireRules with a set of objects (your tests) which need be insert into the working memory. To get the finding back you need to execute an already inserted  query which needs to have an identifier (line 3, 20, 52, 54). It will contain the result of your rule execution.</p>
<p>Sample code would look like this:</p>
<pre class="brush: java; title: ;">
public class RulesTest extends AbstractRulesTest {

   private Set facts;

   @BeforeMethod
   public void setUp() {
       facts = new HashSet();
   }

   @Override
   public String[] getRulesFileNames() {
       return new String[]{
               &quot;src/main/rules/myrules.drl&quot;,
               &quot;src/main/rules/generealRules.drl&quot;
           };
  }

   @Test
   public void testDemoRule() {

       FMyFact myFact = new FMyFact();
    myFact.setColor(&quot;green&quot;);
       facts.add(myFact); // add all your facts here

       List&lt;FRulesFinding&gt; findings = fireRules(facts);
       Assert.assertTrue(findings.size() == 1);
       FRulesFinding finding = findings.get(0);
       Assert.assertTrue(finding.getStatus() == FStatus.OK);
   }
 }
</pre>
<p>Depending on how you cut your rules you can extract the assertion of the status. </p>
<p>Each test case in Excel now takes about 5-10 lines of java code. Considering we are covering each rule with about 5-15 test cases and boundary conditions this amounts to 75-150 lines of test code. I take that <strong>any day over programming in Excel</strong>.</p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/&amp;title=Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/&amp;title=Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG&amp;url=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/&amp;title=Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/&amp;title=Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/&amp;bm_description=Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/&amp;title=Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/&amp;title=Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/&amp;title=Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Test+JBoss+Rules+5+%28or+Drools%29+with+TestNG+@+http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2009/09/23/test-jboss-rules-5-with-testng/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How pair programming can help you to get into Test Driven Development</title>
		<link>http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/</link>
		<comments>http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 20:43:11 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[test driven]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=323</guid>
		<description><![CDATA[At my current job management buys into Test driven development. It slowly starts to become our primary development style. Some advantages of TDD for me are: Focus on problem solution No unnecessary development for use cases dreamed up by the developer Always make sure your code fulfills the requirements (tests) If you have tests you [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F09%2F13%2Fhow-pair-programming-can-help-you-to-get-into-test-driven-development%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F09%2F13%2Fhow-pair-programming-can-help-you-to-get-into-test-driven-development%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>At my current job management buys into Test driven development. It slowly starts to become our primary development style.</p>
<p>Some <strong>advantages</strong> of TDD for me are:</p>
<ul>
<li>Focus on problem solution</li>
<li>No unnecessary development for use cases dreamed up by the developer</li>
<li>Always make sure your code fulfills the requirements (tests)</li>
<li>If you have tests you can safely refactor your code at any time</li>
</ul>
<p>Even though we all knew about the advantages of TDD, we figured out that we do <strong>not always write tests first</strong>. While this might me acceptable in some situations like UI tests, most of the time it is not desired.<br />
After seeing that problem for a couple of weeks (and always wondering how I did not write test first) all of the sudden I realized why sometimes it was easier to develop code with writing tests first and sometimes I just simply did not thought about it and had to write the tests later.</p>
<p><strong>It&#8217;s simply because of pair programming</strong>.</p>
<p>What certainly happens to me  when coding alone, is that  sometimes I get into &#8216;crunch&#8217; mode too fast. With a second person to slow me down, we are discussing the problem and make sure we both have the same understanding of  what we are trying to achieve. During this process it is much clearer what needs to be done and what the goals are. This is a very important step. If I&#8217;m all by myself, I start writing down some classes, look at methods and I&#8217;m already thinking in code and not about the problem. Once you <strong>know what the real problem is</strong>, it is very easy to start writing your tests first. It helped me a lot. </p>
<p>Where pairing also helps is to <strong>focus</strong> both programmers <strong>to stay in TDD mode</strong>. Once the driver of the pair programming couple starts to hack away code, the other will remind him to write the tests first. This is a very valuable. </p>
<p>After a while I got better at test driven development, even programming alone. </p>
<p>So if you recognize that you do not write tests first (but you want to) and you yet again don&#8217;t know how that happened, try pair programming. You learn how to start  with TDD (and get used to it)  and get all the benefits of pair programming as well. </p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/&amp;title=How+pair+programming+can+help+you+to+get+into+Test+Driven+Development" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/&amp;title=How+pair+programming+can+help+you+to+get+into+Test+Driven+Development" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=How+pair+programming+can+help+you+to+get+into+Test+Driven+Development&amp;url=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/&amp;title=How+pair+programming+can+help+you+to+get+into+Test+Driven+Development" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/&amp;title=How+pair+programming+can+help+you+to+get+into+Test+Driven+Development" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/&amp;bm_description=How+pair+programming+can+help+you+to+get+into+Test+Driven+Development" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/&amp;title=How+pair+programming+can+help+you+to+get+into+Test+Driven+Development" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/&amp;title=How+pair+programming+can+help+you+to+get+into+Test+Driven+Development" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/&amp;title=How+pair+programming+can+help+you+to+get+into+Test+Driven+Development" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+pair+programming+can+help+you+to+get+into+Test+Driven+Development+@+http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2009/09/13/how-pair-programming-can-help-you-to-get-into-test-driven-development/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

