<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:georss="http://www.georss.org/georss" xmlns:media="http://search.yahoo.com/mrss/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0">

<channel>
	<title>One man's mission to become a better developer</title>
	<atom:link href="https://pramatr.wordpress.com/feed/" rel="self" type="application/rss+xml"/>
	<link>https://pramatr.wordpress.com</link>
	<description>A development oriented blog, containing anything I've been developing, reading about or thinking about.</description>
	<lastBuildDate>Tue, 28 Jun 2011 15:40:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain="pramatr.wordpress.com" path="/?rsscloud=notify" port="80" protocol="http-post" registerProcedure=""/>
<image>
		<url>https://s0.wp.com/i/buttonw-com.png</url>
		<title>karldmoore development</title>
		<link>https://pramatr.wordpress.com</link>
	</image>
	<atom:link href="https://pramatr.wordpress.com/osd.xml" rel="search" title="karldmoore development" type="application/opensearchdescription+xml"/>
	<atom:link href="https://pramatr.wordpress.com/?pushpress=hub" rel="hub"/>
	<xhtml:meta content="noindex" name="robots" xmlns:xhtml="http://www.w3.org/1999/xhtml"/><item>
		<title>I’m Sick of Restarting My Server!</title>
		<link>https://pramatr.wordpress.com/2009/08/03/im-sick-of-restarting-my-server/</link>
					<comments>https://pramatr.wordpress.com/2009/08/03/im-sick-of-restarting-my-server/#comments</comments>
		
		<dc:creator><![CDATA[karldmoore]]></dc:creator>
		<pubDate>Mon, 03 Aug 2009 21:10:41 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Opinion]]></category>
		<guid isPermaLink="false">http://pramatr.com/?p=948</guid>

					<description><![CDATA[Anyone that has been following @karldmoore on Twitter will have seen a recent tweet in which I stated that &#8220;I&#8217;m Sick of Restarting My Server!&#8221;. This was borne out of extreme frustration on a particularly bad day after several hours unproductive development AND multiple server restarts. From that moment on I&#8217;ve continued to realise just [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Anyone that has been following <a href="http://twitter.com/karldmoore">@karldmoore</a> on Twitter will have seen a recent tweet in which I stated that &#8220;I&#8217;m Sick of Restarting My Server!&#8221;. This was borne out of extreme frustration on a particularly bad day after several hours unproductive development AND multiple server restarts. From that moment on I&#8217;ve continued to realise just how sick I&#8217;ve become of restarting my server.</p>
<p>I&#8217;ve been developing using Java for around ten years now and during that time it&#8217;s been a pretty happy relationship. I&#8217;ve got used to the fact that some changes I make require a server restart whilst others can be seamlessly hot-swapped leaving me free to carry on with my work. I&#8217;ve accepted this for a long time, but for some reason I&#8217;ve really started to get sick of restarting my server. As discussed <a href="http://pramatr.com/2009/07/08/testing-times-part-i-how-do-team-introduce-automated-testing/">previously</a>:</p>
<blockquote><p>The longer a build-deploy cycle takes, the more compelling testing becomes. On many occasions I’ve seen people finally give in and start to write unit tests not when shouted at and told to by the lead developer, but instead, when they are sick of waiting for their application to load for the 100th time and just want to get their work finished.</p></blockquote>
<p>These frustrating server restarts have led many people, to rely on testing much more than ever before and to shift the focus away from debugging and logging. By moving the focus away from compile-build-deploy-test and forcing testing earlier into development, productivity can be greatly improved helping the developer to say in the <a href="http://en.wikipedia.org/wiki/Flow_(psychology)">zone</a>. Although testing helps, it&#8217;s still not enough and sometimes it feels like there needs to be more support.</p>
<p>After searching for <em>more</em> I stumbled across <a href="http://www.zeroturnaround.com/javarebel/">JavaRebel</a> which boasted some very impressive features in <a href="http://www.zeroturnaround.com/javarebel/comparison/">comparison</a> to the standard hot swap technology. After using their ROI calculator it claims the cost of JavaRebel could be repaid within six days which would seems like a pretty convincing argument to even the most frugal of managers. This all sounds great and confirms exactly how I&#8217;ve been feeling lately. There has to be a better way to do things, it has to be easier and simpler to be more productive. Maybe JavaRebel is the answer, but after recently spending some time using <a href="http://www.grails.org/">Grails</a>, I wonder if I&#8217;ve found another potential solution to my problem.</p>
<p>In one evening of coding with Grails, I recently managed to clock up several hours without a single server restart (this was only cut short by the need to sleep). This is made possible by a feature within Grails known as <a href="http://grails.org/Auto+Reloading">auto reloading</a>. As the documentation states this isn&#8217;t without it&#8217;s quirks, but when using this with Grails I really <strong>do</strong> feel productive. By removing the necessity to restart my server when I make changes, I&#8217;ve removed that frustrating minute between stopping and starting which not only seem to take an age but also distract you from your train of thought and send you over to have a quick browse on <a href="http://www.dzone.com">DZone</a>. Grails has so far provided a really impressive and effortless development experience and most of all it&#8217;s confirmed something to me, &#8220;I&#8217;m Sick of Restarting My Server!&#8221;.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pramatr.wordpress.com/2009/08/03/im-sick-of-restarting-my-server/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		
		<media:content medium="image" url="https://0.gravatar.com/avatar/f7788be3df97928c5fe97e3ad3a2215209ff6216ee90f194b394dc0742e433d7?s=96&amp;d=identicon">
			<media:title type="html">karldmoore</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing Times Concluded: There’s always tomorrow, isn’t there?</title>
		<link>https://pramatr.wordpress.com/2009/07/29/testing-times-concluded-theres-always-tomorrow-isnt-there/</link>
					<comments>https://pramatr.wordpress.com/2009/07/29/testing-times-concluded-theres-always-tomorrow-isnt-there/#comments</comments>
		
		<dc:creator><![CDATA[karldmoore]]></dc:creator>
		<pubDate>Wed, 29 Jul 2009 06:00:29 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Coverage]]></category>
		<category><![CDATA[Refactoring]]></category>
		<guid isPermaLink="false">http://pramatr.com/?p=861</guid>

					<description><![CDATA[In the previous three articles we discussed the difficulties that can be encountered when introducing automated testing into a team and how to try and address these when they occur. Although the principles are very straight forward, many teams have great difficulty adapting to an automated testing approach. In the final part of this series, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the previous three articles we discussed the difficulties that can be encountered when introducing automated testing into a team and how to try and address these when they occur. Although the principles are very straight forward, many teams have great difficulty adapting to an automated testing approach. In the final part of this series, we take a look at why the testing shouldn&#8217;t wait for another day.</p>
<p><strong>How can we get teams to write tests as they write code?</strong></p>
<p>For many developers the biggest challenge to writing tests as they write the code is a behavioral one. They are not use to writing tests alongside the code and usually <a href="http://xunitpatterns.com/test%20last%20development.html">test-last</a> once all the code has been written. Some developers do exactly the same thing when writing JavaDoc, with <strong>very</strong> similar results. If developers don&#8217;t like writing tests, they <strong>really</strong> don&#8217;t like writing lots of tests right at the end of a project. Typically when jobs like this are left right until the end of a project, they either don&#8217;t get done, or don&#8217;t get done very well.</p>
<p>The main problem with this approach is that the developer doesn&#8217;t really benefit from the tests during development. When the code is developed, there is a reliance on logging, debugging and manual testing to ensure the code works as expected. When changes are made to the code, the whole cycle must be repeated again. This feedback cycle can very quickly decrease the <a href="http://www.extremeprogramming.org/rules/velocity.html">velocity</a> of development.</p>
<p>By writing the tests at the same time as the functionality, it not only saves a marathon session of writing tests at the end of a project, it also means the tests are <strong>used</strong> to help develop the code. There is confidence in the changes being made, and if tests are continually run it&#8217;s easy to know which code change broke the tests. This leads to a much shorter feedback cycle when developing and subsequently over time, developers are more productive.</p>
<blockquote>
<pre><span style="font-size:small;">@<span style="color:#2040a0;">Test</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#2040a0;">expected</span><span style="color:#4444ff;">=</span><span style="color:#2040a0;">IllegalArgumentException</span>.<strong>class</strong><span style="color:#4444ff;"><strong>)</strong></span>
<strong>public</strong> <strong>void</strong> <span style="color:#2040a0;">nameCannotBeNull</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#4444ff;"><strong>)</strong></span> <span style="color:#4444ff;"><strong>{</strong></span>
    <span style="color:#444444;">// now we've finished coding</span>
<span style="color:#4444ff;"><strong>}</strong></span>

@<span style="color:#2040a0;">Test</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#2040a0;">expected</span><span style="color:#4444ff;">=</span><span style="color:#2040a0;">IllegalArgumentException</span>.<strong>class</strong><span style="color:#4444ff;"><strong>)</strong></span>
<strong>public</strong> <strong>void</strong> <span style="color:#2040a0;">nameMustNotBeEmpty</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#4444ff;"><strong>)</strong></span> <span style="color:#4444ff;"><strong>{</strong></span>
    <span style="color:#444444;">// it's time to write some tests</span>
<span style="color:#4444ff;"><strong>}</strong></span>

@<span style="color:#2040a0;">Test</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#2040a0;">expected</span><span style="color:#4444ff;">=</span><span style="color:#2040a0;">IllegalArgumentException</span>.<strong>class</strong><span style="color:#4444ff;"><strong>)</strong></span>
<strong>public</strong> <strong>void</strong> <span style="color:#2040a0;">nameIsTooLong</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#4444ff;"><strong>)</strong></span> <span style="color:#4444ff;"><strong>{</strong></span>
    <span style="color:#444444;">// I really wish I'd started sooner</span>
<span style="color:#4444ff;"><strong>}</strong></span></span></pre>
</blockquote>
<p>Developers <strong>really</strong> don&#8217;t like writing lots of tests for code they&#8217;ve already written.</p>
<p><strong>What about all the existing untested code?</strong></p>
<p>If developers don&#8217;t like writing lots of tests at the end of a project, they <strong>really really</strong> don&#8217;t like writing tests for legacy code. This single task is one of the most hated and time consuming to complete. The typical problem is that the code wasn&#8217;t designed for testing, hence the code must be refactored before tests can be written. The real problem with this approach is that tests are actually supposed to catch changes that might break the code. It really is a <a href="http://en.wikipedia.org/wiki/Catch-22_(logic)">catch-22</a> situation, as performing the refactoring to allow tests, may actually introduce changes which break the code.</p>
<p>Writing tests for legacy code can be extremely time consuming. One of the biggest problems (if it is actually possible to write tests), is that it isn&#8217;t always obvious what the code was <em>supposed</em> to do in the first place. Even if the original author is still working on the project, the code isn&#8217;t fresh in their mind, and as such, there is going to be an initial period of familiarisation. Even if this is successful, it can be extremely time consuming and sometimes very haphazard.</p>
<p>Can the project afford to not refactor the code and have limited test coverage? Can the developers risk making changes and potentially introduce bugs in the short-term thus allowing long-term stability? Ulimately there is a tough decision to make here, but the situation isn&#8217;t going to get any better. Retrospective testing costs more time and money as development progresses, can this be left for the time being or is it wiser to tackle this problem now? Fixing defects later in the process will inevitibly cost more time and money. Is manual testing alone sufficient enough to find enough of the defects?</p>
<p>When modifying or adding to legacy code I personally prefer either writing tests first, or performing the minimum amount of refactoring required to add tests. The sooner the code has tests, and the less code changes I have to make to allow testing, the happier I am.</p>
<blockquote>
<pre><span style="font-size:small;"><strong>public</strong> <strong>class</strong> <span style="color:#2040a0;">TestsForReallyComplicatedCode</span> <span style="color:#4444ff;"><strong>{</strong></span>
    @<span style="color:#2040a0;">Test</span>
    <strong>public</strong> <strong>void</strong> <span style="color:#2040a0;">todo</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#4444ff;"><strong>)</strong></span> <span style="color:#4444ff;"><strong>{</strong></span>
        <span style="color:#444444;">// ok now I'm scared!</span>
    <span style="color:#4444ff;"><strong>}</strong></span>
<span style="color:#4444ff;"><strong>}</strong></span></span></pre>
</blockquote>
<p>Is it a really a good idea to let this problem get any worse?</p>
<p><strong>Conclusion</strong></p>
<p><a href="http://en.wikipedia.org/wiki/Test-driven_development">Test-driven</a> and <a href="http://www.extremeprogramming.org/rules/testfirst.html">test first</a> development have become very fashionable over the past few years. Ensuring code has tests is one of the core <a href="http://www.extremeprogramming.org/">Extreme Programming</a> <a href="http://www.extremeprogramming.org/rules.html">rules</a>, but it can also be one of the most difficult to introduce to a team. Although the principles are very straight forward, many teams have great difficulty adapting to an automated testing approach. Some of these teams don’t have any existing testing strategies in place, meaning that incorporating automated testing into development seems like an unattainable goal. In this series of articles we&#8217;ve covered some of the common problems encountered when trying to incorporate testing into development including:</p>
<ul>
<li>We DON’T do testing</li>
<li>I don’t write tests</li>
<li>I don’t know what I’m supposed to be testing</li>
<li>Nobody knows anything about testing</li>
<li>We aren’t allowed to write tests</li>
<li>How can we get teams to write tests as they write code?</li>
<li>What about all the existing untested code?</li>
</ul>
<p>Developers are willing to write tests, they just need some guidance. Anyone trying to encourage the adoption of automated testing needs to make sure they are approachable and on hand throughout the process to answer any questions and try to quell any frustrations before they occur. Once developers understand how to write tests effectively, it soon becomes second nature to them. These are indeed testing times.</p>
<p><strong>References</strong></p>
<ul>
<li><a href="http://pramatr.com/2009/07/08/testing-times-how-do-team-introduce-automated-testing/">Testing times Part I: How do team introduce automated testing?</a></li>
<li><a href="http://pramatr.com/2009/07/15/testing-times-part-ii-why-arent-people-writing-tests/">Testing times Part II: Why aren’t people writing tests?</a></li>
<li><a href="http://pramatr.com/2009/07/21/testing-times-part-iii-are-developers-able-to-write-tests/">Testing Times Part III: Are developers able to write tests?</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://pramatr.wordpress.com/2009/07/29/testing-times-concluded-theres-always-tomorrow-isnt-there/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		
		<media:content medium="image" url="https://0.gravatar.com/avatar/f7788be3df97928c5fe97e3ad3a2215209ff6216ee90f194b394dc0742e433d7?s=96&amp;d=identicon">
			<media:title type="html">karldmoore</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing Times Part III: Are developers able to write tests?</title>
		<link>https://pramatr.wordpress.com/2009/07/21/testing-times-part-iii-are-developers-able-to-write-tests/</link>
					<comments>https://pramatr.wordpress.com/2009/07/21/testing-times-part-iii-are-developers-able-to-write-tests/#respond</comments>
		
		<dc:creator><![CDATA[karldmoore]]></dc:creator>
		<pubDate>Tue, 21 Jul 2009 06:00:50 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Coverage]]></category>
		<category><![CDATA[Refactoring]]></category>
		<guid isPermaLink="false">http://pramatr.com/?p=859</guid>

					<description><![CDATA[In the previous two posts we discussed the difficulties that can be encountered when introducing automated testing into a team and how to try and address these when they occur. Although the principles are very straight forward, many teams have great difficulty adapting to an automated testing approach. In the third part of this series, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the <a href="http://pramatr.com/2009/07/15/testing-times-part-ii-why-arent-people-writing-tests/">previous</a> <a href="http://pramatr.com/2009/07/08/testing-times-how-do-team-introduce-automated-testing/">two</a> posts we discussed the difficulties that can be encountered when introducing automated testing into a team and how to try and address these when they occur. Although the principles are very straight forward, many teams have great difficulty adapting to an automated testing approach. In the third part of this series, we take a look at some of the reason that developers can&#8217;t write tests.</p>
<p><strong>Nobody knows anything about testing</strong></p>
<p>So many teams I&#8217;ve encountered in the past don&#8217;t automate testing because neither they nor any of their team have used this approach in the past. In the <a href="http://pramatr.com/2009/07/15/testing-times-part-ii-why-arent-people-writing-tests/">previous</a> article one of the <a href="http://pramatr.com/2009/07/15/testing-times-part-ii-why-arent-people-writing-tests/#comment-276">comments</a> from <a href="http://phi.lho.free.fr">PhiLho</a> was about this very subject.</p>
<blockquote><p>Beside the classical problem of time, there is even some base questions. For example, I write a private method in Java doing some algorithm, pattern matching, date computation, etc. How do I test it since it is private?</p></blockquote>
<p>A typical response to a question like this is, What do you think about it? How would you test the method? Have a discussion about it in the team, have a debate about it. Try something out and see how well it works out. Throw it away and try something else completely different.</p>
<blockquote><p>Well we could use reflection but is that really such a good idea, it seems a little hacky and a complete sledge hammer for a simple problem. We could just lower the visibility rules, how about package private? If the test hierarchy mirrors the original source are what issues are we introducing here? Do we really need to test the method directly, won&#8217;t it be tested implicitly by executing the calling code?</p></blockquote>
<p>All of these questions have many answers and I&#8217;m sure a quick search will yield results to prove these debates have and still rage on. The interesting part in all of this is having a go and seeing what works for your team. &#8220;I didn&#8217;t want to do it because I didn&#8217;t want to do it wrong&#8221;, is such a common attitude amongst some teams. I would actively try to convince people that you have to fall down and make some mistakes to learn, most of the time without any previous experience the only way to find out is to try! If you want to jump start this process there are many excellent blogs, discussion groups, mailing lists, forums and books you just need to search for them, ask for recommendations and see what works for other people. But if there is nobody in your team that knows anything about testing, somebody is always going to have to take the first step to encourage the learning process.</p>
<p><strong>We aren&#8217;t allowed to write tests</strong></p>
<p>There are still some teams out there that <em>are not allowed</em> to write unit tests. There seems to be a couple of popular variations on this story; people that are not allowed extra time to add unit tests to their project and managers that don&#8217;t want developers wasting their time writing tests. In either of these situations, people have to understand the positives that come from testing and how this can <a href="http://msdn.microsoft.com/msdnmag/issues/06/01/UnitTesting/">improve</a> both the teams development and it&#8217;s overall <a href="http://www.extremeprogramming.org/rules/velocity.html">velocity</a>.</p>
<p>One of the biggest preconceptions about testing, is that developers who write tests deliver code slower than those who don&#8217;t. Although some developers <em>can</em> release code more quickly without tests, this trend doesn&#8217;t typically last. When new code is developed it requires testing, when it&#8217;s integrated with the rest of the code base it has to be tested again, and each an every time the code is modified it requires further testing. If this testing has to be performed as a manual activity, it either doesn&#8217;t get done, doesn&#8217;t get done very well or doesn&#8217;t get done at all.</p>
<p>It is simply too time consuming to undertake this type of testing on a regular basis. The untested code can be a constant source of recurring bugs or in the best case it just takes longer to maintain than it should. In this situation, automated testing has to be an essential part of the development process. Manually testing can start to become a bottle neck in the process very quickly. Once automated tests are written however, a development team can prevent then wasted effort of excessive manual testing.</p>
<p>Some developers <em>may</em> initially take longer to develop code with tests, but this is a common symptom of any new approach. Once developers understand how to write tests effectively, it becomes second nature to them. Developers then tend to write test-backed code at least as fast as using a logger and debugger to develop the code. The longer a build-deploy cycle takes, the more compelling testing becomes and also the more productivity gains can be achieved.</p>
<blockquote>
<pre><span style="font-size:small;">@<font color="#2040a0">Test</font>
<strong>public</strong> <strong>void</strong> <font color="#2040a0">codeDeliveredOnTime</font><font color="4444FF"><strong>(</strong></font><font color="4444FF"><strong>)</strong></font> <font color="4444FF"><strong>{</strong></font>
    <font color="#2040a0">assertTrue</font><font color="4444FF"><strong>(</strong></font><strong>true</strong><font color="4444FF"><strong>)</strong></font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
 
@<font color="#2040a0">Test</font>
<strong>public</strong> <strong>void</strong> <font color="#2040a0">confidenceInCode</font><font color="4444FF"><strong>(</strong></font><font color="4444FF"><strong>)</strong></font> <font color="4444FF"><strong>{</strong></font>
    <font color="#2040a0">assertTrue</font><font color="4444FF"><strong>(</strong></font><strong>true</strong><font color="4444FF"><strong>)</strong></font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font></span></pre>
</blockquote>
<p>If the code is still delivered as expected, does it matter if automated testing is helping this process along?</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pramatr.wordpress.com/2009/07/21/testing-times-part-iii-are-developers-able-to-write-tests/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:content medium="image" url="https://0.gravatar.com/avatar/f7788be3df97928c5fe97e3ad3a2215209ff6216ee90f194b394dc0742e433d7?s=96&amp;d=identicon">
			<media:title type="html">karldmoore</media:title>
		</media:content>
	</item>
		<item>
		<title>Fun with Grails</title>
		<link>https://pramatr.wordpress.com/2009/07/19/fun-with-grails/</link>
					<comments>https://pramatr.wordpress.com/2009/07/19/fun-with-grails/#respond</comments>
		
		<dc:creator><![CDATA[karldmoore]]></dc:creator>
		<pubDate>Sun, 19 Jul 2009 16:20:04 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Software]]></category>
		<guid isPermaLink="false">http://pramatr.com/?p=905</guid>

					<description><![CDATA[Anyone that has been following @karldmoore on Twitter will have seen the numerous tweets recently about Grails. I first started looking at Grails back in 2006? after a recommendation from a work colleague. It looked quite interesting and I managed to hack together something quite simple but it was a little hard work in places [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Anyone that has been following <a href="http://twitter.com/karldmoore">@karldmoore</a> on Twitter will have seen the numerous <a href="http://twitter.com/#search?q=%23grails">tweets</a> recently about <a href="http://www.grails.org/">Grails</a>. I first started looking at <a href="http://www.grails.org/">Grails</a> back in 2006? after a recommendation from a work colleague. It looked quite interesting and I managed to hack together something quite simple but it was a little hard work in places to get what I wanted out of it. It was early days for the project however and it looked very promising.</p>
<p>I&#8217;ve since recommended it several times to other people who were interested in building applications new applications. Most of the this feedback has been extremely positive so I&#8217;ve managed to get around to having another look at it recently. After <a href="http://twitter.com/snaglepus">@snaglepus</a> suggested I check out <a href="http://www.springsource.com/webinar/building-twitter-with-grails-40-minutes">Build twitter in Grails in 40 minutes</a> (registration is required) I have to say I was very impressed. Since watching that I&#8217;ve gone from knowing absolutely nothing about Grails (three years it too long to keep information in memory) to building a sample application very quickly. After finding plug-ins for many of the tasks I wanted, I&#8217;ve implemented the logic I need and let the tool do the rest of the heavy lifting work which led to a very productive evening of coding.</p>
<p>I really love it when you find technology which just seems to work and does exactly what you expect it to do. There is still much I want to learn about Grails and I&#8217;m sure there are many other tips and tricks I can pick up along the way. At the minute I&#8217;m just looking through the many Grails books to find a winner and I think I have in <a href="http://www.apress.com/book/view/9781590599952">The Definitive Guide to Grails, Second Edition</a>. If you haven&#8217;t looked at Grails before, I really recommend you check it out and see what it can do for you. And if you aren&#8217;t following me on Twitter, I&#8217;m <a href="http://twitter.com/karldmoore">@karldmoore</a> and I&#8217;m sure there will be a few more tweets about Grails ;-).</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pramatr.wordpress.com/2009/07/19/fun-with-grails/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		
		<media:content medium="image" url="https://0.gravatar.com/avatar/f7788be3df97928c5fe97e3ad3a2215209ff6216ee90f194b394dc0742e433d7?s=96&amp;d=identicon">
			<media:title type="html">karldmoore</media:title>
		</media:content>
	</item>
		<item>
		<title>Testing Times Part II: Why aren’t people writing tests?</title>
		<link>https://pramatr.wordpress.com/2009/07/15/testing-times-part-ii-why-arent-people-writing-tests/</link>
					<comments>https://pramatr.wordpress.com/2009/07/15/testing-times-part-ii-why-arent-people-writing-tests/#comments</comments>
		
		<dc:creator><![CDATA[karldmoore]]></dc:creator>
		<pubDate>Wed, 15 Jul 2009 00:30:57 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[Coverage]]></category>
		<category><![CDATA[Refactoring]]></category>
		<guid isPermaLink="false">http://pramatr.com/?p=855</guid>

					<description><![CDATA[In the previous post we discussed the difficulties that can be encountered when introducing automated testing into a team. Although the principles are very straight forward, many teams have great difficulty adapting to an automated testing approach. In the second part of this series, we take a look at some of the initial issues why [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the <a href="http://pramatr.com/2009/07/08/testing-times-how-do-team-introduce-automated-testing/">previous</a> post we discussed the difficulties that can be encountered when introducing automated testing into a team. Although the principles are very straight forward, many teams have great difficulty adapting to an automated testing approach. In the second part of this series, we take a look at some of the initial issues why developers aren&#8217;t writing tests.</p>
<p><strong>I don&#8217;t write tests!</strong></p>
<p>As discussed in a previous <a href="http://pramatr.com/2008/08/17/structured-approaches-to-improving-code-quality/">post</a>, the best approach to improving a teams testing practices, is to work closely with the developers to understand the <strong>real</strong> problems they are facing. Why aren&#8217;t they writing tests? Is anything preventing them from writing tests? What are the problems they are facing when writing tests? Are they receiving enough help to understand approaches to testing?</p>
<p>For the developers who simply refuse to write tests, a <a href="http://www.testing.com/writings/coverage-terminology.html">coverage</a> <a href="http://www.codecoveragetools.com/code_coverage_java.htm">tool</a> <a href="http://www.testing.com/writings/coverage.pdf"><em>can</em></a> sometimes be useful. By simply viewing the <a href="http://emma.sourceforge.net/coverage_sample_a/_files/54.html">coverage reports</a> on a regular basis, the teams testing efforts can be monitored. It <em>can</em> initially help developers to know that their testing efforts are being measured as an encouragement to write tests. If a <a href="http://martinfowler.com/articles/continuousIntegration.html">continuous integration</a> <a href="http://cruisecontrol.sourceforge.net/">tool</a> is in use, it is also possible to take the manual labour out of this task, and simply <a href="http://www.javaworld.com/javaworld/jw-06-2007/jw-06-awci.html">fail</a> the build if code is added without the required tests hence lowering the coverage.</p>
<p>Developers aren&#8217;t stupid and so they can find ways to fake this information by simply writing tests that exercise the code without actually testing anything. Code coverage alone does not guarantee that the <strong><a href="http://www-128.ibm.com/developerworks/java/library/j-cq01316/">right</a></strong> tests are being written, it is simply another tool that can be used. Another approach is to ensure that a member of the test team works with the developer(s) throughout the process. Their job is to make sure they are satisfied that the deliverables passed over to the test team contain the required automated tests. Although the automated tests <a href="http://agilesoftwaredevelopment.com/blog/janusz-gorycki/your-unit-tests-are-useless">aren&#8217;t</a> a replacement for manual testing, by ensuring both teams are working closely together there can be a mutual understanding and appreciation for the required testing effort. This kind of <a href="http://en.wikipedia.org/wiki/Peer_pressure">peer pressure</a> can be a valuable last resort when all else fails.</p>
<p>By combining code coverage with <a href="http://en.wikipedia.org/wiki/Code_review">code reviews</a>, education and targeted <a href="http://www.junit.org/news/article/index.htm">reading</a>, developers testing efforts typically improve. This is the <strong>real</strong> goal that teams should be aiming for, writing <strong>good</strong> quality tests, which overtime naturally lead to better code coverage. There are some <a href="http://docs.codehaus.org/display/ASH/Guantanamo">tools</a> that take this approach a step further, but these really are not for the faint hearted. If developers are expected to write tests, their problems have to be recognised, addressed and resolved!</p>
<p><strong><span style="color:#ff0000;">BUILD FAILED: Test coverage too low&#8230;&#8230; please right some tests!</span></strong></p>
<p><strong>I don&#8217;t know what I&#8217;m supposed to be testing!</strong></p>
<p>One of the biggest hurdles to testing adoption isn&#8217;t that developers don&#8217;t want to write tests, it&#8217;s that they are not sure what they are supposed to be testing. They are not sure what they should be testing or how they should be testing it. They are not sure if they are writing the right tests or are testing the right areas. They aren&#8217;t sure what a <strong>good</strong> unit test should look like and therefore don&#8217;t write good tests.</p>
<p>You can force developers to write tests, but you can&#8217;t force them to write <strong>good</strong> tests. In these circumstances, it&#8217;s fairly easy to put teams back on track (if they are willing to learn). With <strong>good</strong> example tests, lots of guidance and related <a href="http://xunitpatterns.com/">reading</a>, it&#8217;s possible to work with the developers to address the problems they are having. <a href="http://www.extremeprogramming.org/rules/pair.html">Pair programming</a> and <a href="http://en.wikipedia.org/wiki/Code_review">code reviews</a> can also prove extremely useful when developers are learning to write tests. Encourage developers to ask questions and to try different <a href="http://www.martinfowler.com/articles/mocksArentStubs.html">approaches</a> to their testing. It&#8217;s very easy to see what is working and what isn&#8217;t, and this feedback is essential to improving the process. Many developers are willing to write tests, they just need some guidance. Anyone trying to encourage the adoption of automated testing needs to make sure they are approachable and on hand throughout the process to answer the questions and try to quell any frustrations before they occur.</p>
<blockquote>
<pre><span style="font-size:small;">@<span style="color:#2040a0;">Test</span>
<strong>public</strong> <strong>void</strong> <span style="color:#2040a0;">setFirstName</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#4444ff;"><strong>)</strong></span> <span style="color:#4444ff;"><strong>{</strong></span>
    <span style="color:#2040a0;">User</span> <span style="color:#2040a0;">user</span> <span style="color:#4444ff;">=</span> <strong>new</strong> <span style="color:#2040a0;">User</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#008000;">"pramatr"</span>, <span style="color:#008000;">"pramatr@domain.com"</span><span style="color:#4444ff;"><strong>)</strong></span><span style="color:#4444ff;">;</span>
    <span style="color:#2040a0;">user</span>.<span style="color:#2040a0;">setFirstName</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#008000;">"Pramatr"</span><span style="color:#4444ff;"><strong>)</strong></span><span style="color:#4444ff;">;</span>
    <span style="color:#2040a0;">user</span>.<span style="color:#2040a0;">activate</span><span style="color:#4444ff;"><strong>(</strong></span><span style="color:#4444ff;"><strong>)</strong></span><span style="color:#4444ff;">;</span>
<span style="color:#4444ff;"><strong>}</strong></span></span></pre>
</blockquote>
<p>Yes, you are calling methods, but are you actually testing anything?</p>
]]></content:encoded>
					
					<wfw:commentRss>https://pramatr.wordpress.com/2009/07/15/testing-times-part-ii-why-arent-people-writing-tests/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		
		<media:content medium="image" url="https://0.gravatar.com/avatar/f7788be3df97928c5fe97e3ad3a2215209ff6216ee90f194b394dc0742e433d7?s=96&amp;d=identicon">
			<media:title type="html">karldmoore</media:title>
		</media:content>
	</item>
	</channel>
</rss>