<?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</title>
	<atom:link href="http://maxheapsize.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://maxheapsize.com</link>
	<description>Oliver Wehrens on Programming and Agile</description>
	<lastBuildDate>Thu, 12 Apr 2012 19:41:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Cucumber-jvm for Java</title>
		<link>http://maxheapsize.com/2012/04/12/cucumber-jvm-for-java/</link>
		<comments>http://maxheapsize.com/2012/04/12/cucumber-jvm-for-java/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 19:25:58 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[cucumber-jvm]]></category>
		<category><![CDATA[cuke4duke]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=649</guid>
		<description><![CDATA[In an earlier article I compared cucumber (with Cuke4Duke) and Concordion. It was very cumbersome due to the ruby/jruby jvm chain. Behold &#8211; the new cucumber-jvm was released. So how did it improve? Cucumber-jvm has support for many languages, e.g. Scala, Groovy, Closure and of course Java. I will focus on Java and Maven. To [...]]]></description>
			<content:encoded><![CDATA[<p>In an <a href="http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/">earlier</a> article I compared cucumber (with Cuke4Duke) and Concordion. It was very cumbersome due to the ruby/jruby jvm chain. Behold &#8211; the new <a href='https://github.com/cucumber/cucumber-jvm'><strong>cucumber-jvm</strong></a> was released. So how did it <strong>improve</strong>?</p>
<p>Cucumber-jvm has support for many languages, e.g. Scala, Groovy, Closure and of course Java. I will focus on <strong>Java</strong> and <strong>Maven</strong>.</p>
<p>To get you maven project going you just need to include the following dependencies:</p>
<pre class="brush: xml; title: ;">
&lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;info.cukes&lt;/groupId&gt;
      &lt;artifactId&gt;cucumber-java&lt;/artifactId&gt;
      &lt;version&gt;1.0.2&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;info.cukes&lt;/groupId&gt;
      &lt;artifactId&gt;cucumber-junit&lt;/artifactId&gt;
      &lt;version&gt;1.0.2&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;4.10&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
</pre>
<p>First thing you (or your Business Analyst or something) is doing, is <strong>describing your feature</strong>. It would look something like:</p>
<pre>
Feature: Hello Car

  Scenario: Car can drive
    Given I have a car
    When I add 4 wheels
    Then It can drive
</pre>
<p>You need to put that into a file called Car.feature. The <strong>.feature</strong> extension is important.</p>
<p>To get all Cucumber-jvm tests off the ground we need one <strong>test runner</strong>. I often see it being called RunCukesTest.</p>
<pre class="brush: java; title: ;">
package com.maxheapsize.cucumberdemo;

import cucumber.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@Cucumber.Options(format = {&quot;pretty&quot;, &quot;html:target/cucumber&quot;})
public class RunCukesTest {
}
</pre>
<p>You note the Cucumber.Options annotation. It will also produce a nice html in the given directory.</p>
<p>Writing the test now itself is no different than with Cuke4Duke.</p>
<pre class="brush: java; title: ;">
package com.maxheapsize.cucumberdemo;

import cucumber.annotation.en.Given;
import cucumber.annotation.en.Then;
import cucumber.annotation.en.When;
import org.junit.Assert;

public class CarTest {

  private Car car;

  @Given(&quot;I have a car&quot;)
  public void I_have_a_car() {
    car = new Car();
  }

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

  @Then(&quot;^It can drive$&quot;)
  public void iShouldBeAbleToDriveTheCar() {
    Assert.assertTrue(car.canDrive());
  }

}
</pre>
<p>You need to match the <strong>.feature</strong> description with <strong>@Given</strong>, <strong>@When</strong>, <strong>@Then</strong> Annotation (regexp that is). Each usage of any of the annotations is called a step definition. Each one must be unique among all .feature files (as far as I can tell). The code will be executed accordingly. </p>
<p>A maven test will get you:</p>
<p><img src="http://maxheapsize.com/static/cucumber-jvm-console.png" alt="Maven Cucumber-jvm test output" /></p>
<p>Make sure you put your .feature file in the <strong>right location</strong>. It needs right next to tests. I tend to put it into the resources folder in maven so it does not &#8216;pollute&#8217; my Java source files.</p>
<p><img src="http://maxheapsize.com/static/cucumber-jvm-source-tree.png" alt="Cucumber-jvm Test source tree" /></p>
<p>Finally your Html report is rendered (somewhat nicely and collapsable).</p>
<p><img src="http://maxheapsize.com/static/cucumber-jvm-html.png" alt="Cucumber-jvm test output" /></p>
<p>And yes, this applies to cucumber-jvm version 1.0.2.</p>
<p>I hope you found that useful as very short intro into cucumber-jvm. If you are wondering if you would want to use concordion check out my older <a href="http://maxheapsize.com/2009/10/13/concordion-vs-cucumber-and-java-based-acceptance-testing/">blog post</a>.</p>
<p>If I would have a choice again.<strong> I would choose</strong> cucumber-jvm for using a BDD tool. The plain text format makes it <strong>easy</strong> to read for a non programmer and it produces somewhat <strong>good documentation</strong> (if used well of course <img src='http://maxheapsize.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ). The tool chain is much smoother now and faster as well.</p>
<p>What I found <strong>missing</strong> is support for my favorite unit test tool <strong>TestNG</strong>. I also don&#8217;t know yet how to <strong>execute a single feature</strong>/scenario when having multiple ones (which will be almost certain always the case). </p>
<p>The learn more about cucumber checkout their <a href="http://cukes.info/">website</a>.</p>
<p>The code used above is available on <a href="https://github.com/oliverwehrens/cucumber-jvm-demo">GitHub</a>
<div class="tweetmeme_button" style="float: left; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2012%2F04%2F12%2Fcucumber-jvm-for-java%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2012%2F04%2F12%2Fcucumber-jvm-for-java%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2012/04/12/cucumber-jvm-for-java/" size="medium"></g:plusone></div> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=649&amp;md5=c72296d8331bbeac2ad17b1076dc4114" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2012/04/12/cucumber-jvm-for-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2012%2F04%2F12%2Fcucumber-jvm-for-java%2F&amp;language=en_GB&amp;category=text&amp;title=Cucumber-jvm+for+Java&amp;description=In+an+earlier+article+I+compared+cucumber+%28with+Cuke4Duke%29+and+Concordion.+It+was+very+cumbersome+due+to+the+ruby%2Fjruby+jvm+chain.+Behold+%26%238211%3B+the+new+cucumber-jvm+was+released.+So+how...&amp;tags=bdd%2Ccucumber%2Ccucumber-jvm%2Ccuke4duke%2CJava%2Cjvm%2Ctest%2Cblog" type="text/html" />
	</item>
		<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[<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="tweetmeme_button" style="float: left; 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>
<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> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=622&amp;md5=43ebf5b48c52e0e8fc260fe9057ad22d" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2011/06/14/one-assert-per-test-really/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2011%2F06%2F14%2Fone-assert-per-test-really%2F&amp;language=en_GB&amp;category=text&amp;title=One+assert+per+test%2C+really.&amp;description=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...&amp;tags=assert%2Cassertion%2Cfest%2CJava%2Ctest%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Hello again.</title>
		<link>http://maxheapsize.com/2011/05/09/hello-again/</link>
		<comments>http://maxheapsize.com/2011/05/09/hello-again/#comments</comments>
		<pubDate>Mon, 09 May 2011 21:12:13 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=614</guid>
		<description><![CDATA[My former hoster had a system crash and it took a while to get an older backup working. Some posts are lost. Here I am. Thanks for the patience. Things still might be a little messy but I&#8217;m working on it.]]></description>
			<content:encoded><![CDATA[<p>My former hoster had a system crash and it took a while to get an older backup working. Some posts are lost.</p>
<p>Here I am.</p>
<p>Thanks for the patience. </p>
<p>Things still might be a little messy but I&#8217;m working on it.
<div class="tweetmeme_button" style="float: left; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2011%2F05%2F09%2Fhello-again%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2011%2F05%2F09%2Fhello-again%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2011/05/09/hello-again/" size="medium"></g:plusone></div> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=614&amp;md5=847d0f0e1e0e65024f7a413233617a2a" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2011/05/09/hello-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2011%2F05%2F09%2Fhello-again%2F&amp;language=en_GB&amp;category=text&amp;title=Hello+again.&amp;description=My+former+hoster+had+a+system+crash+and+it+took+a+while+to+get+an+older+backup+working.+Some+posts+are+lost.+Here+I+am.+Thanks+for+the+patience.+Things...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>Spring 3 MVC, Ajax and jQuery Magic (or better: simplicity)</title>
		<link>http://maxheapsize.com/2010/07/20/spring-3-mvc-ajax-and-jquery-magic-or-better-simplicity/</link>
		<comments>http://maxheapsize.com/2010/07/20/spring-3-mvc-ajax-and-jquery-magic-or-better-simplicity/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 04:00:09 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[spring 3]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=595</guid>
		<description><![CDATA[I&#8217;m playing around with some web frameworks lately and to see what&#8217;s in store with Spring 3 MVC (never did too much with it) I gave it a try to see how it handles Ajax. According to ajax simplification announcement it should be possible to get up and running in (almost) no time. We will [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m playing around with some web frameworks lately and to see what&#8217;s in store with Spring 3 MVC (never did too much with it) I gave it a try to see how it handles Ajax. According to <a href="http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/">ajax simplification announcement</a> it should be possible to get up and running in (almost) no time.</p>
<p>We will do a simple web application which will show the current time via Ajax. </p>
<p>The directory layout (using maven) should look like this:</p>
<div class="wp-caption aligncenter" style="width: 339px"><img alt="Directory Layout" src="http://maxheapsize.com/static/Spring3MVCFiles.png" title="Ajax result" width="329" height="308" /><p class="wp-caption-text">Directory Layout</p></div>
<pre class="brush: xml; title: ;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;web-app xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;
	xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;
	xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;
	id=&quot;WebApp_ID&quot; version=&quot;2.5&quot;&gt;
	&lt;display-name&gt;Spring3MVC&lt;/display-name&gt;
	&lt;welcome-file-list&gt;
		&lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
	&lt;/welcome-file-list&gt;

	&lt;servlet&gt;
		&lt;servlet-name&gt;spring&lt;/servlet-name&gt;
		&lt;servlet-class&gt;
			org.springframework.web.servlet.DispatcherServlet
		&lt;/servlet-class&gt;
		&lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
	&lt;/servlet&gt;
	&lt;servlet-mapping&gt;
		&lt;servlet-name&gt;spring&lt;/servlet-name&gt;
		&lt;url-pattern&gt;*.html&lt;/url-pattern&gt;
	&lt;/servlet-mapping&gt;
&lt;/web-app&gt;
</pre>
<p>The web.xml holds no secrets. The Dispatcher servlet is defined and it should react on everything *.html.</p>
<p>Since we named our Servlet &#8216;spring&#8217; we need to add a servlet configuration for that. It goes in WEB-INF as well.</p>
<pre class="brush: xml; title: ;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xmlns:p=&quot;http://www.springframework.org/schema/p&quot;
	xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
	xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://www.springframework.org/schema/context

http://www.springframework.org/schema/context/spring-context-3.0.xsd&quot;&gt;

	&lt;context:component-scan base-package=&quot;com.maxheapsize.springmvc3.controller&quot; /&gt;

	&lt;bean id=&quot;viewResolver&quot;
		class=&quot;org.springframework.web.servlet.view.UrlBasedViewResolver&quot;&gt;
		&lt;property name=&quot;viewClass&quot; value=&quot;org.springframework.web.servlet.view.JstlView&quot; /&gt;
		&lt;property name=&quot;prefix&quot; value=&quot;/WEB-INF/jsp/&quot; /&gt;
		&lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot; /&gt;
	&lt;/bean&gt;
&lt;/beans&gt;
</pre>
<p>It uses the component scanning feature of spring and instructs spring to check the package &#8216;com.maxheapsize.springmvc3.controller&#8217; for controllers. Furthermore a url based view resolver is defined which uses Jstl and looks into /WEB-INF/jsp for jsp with the ending &#8216;.jsp&#8217;. </p>
<p>In  WEB-INF/jsp/hello.jsp we define a jQuery snippet for the Ajax request and provide a button which we should push if we want to know the time.</p>
<pre class="brush: xml; title: ;">
&lt;jsp:useBean id=&quot;message&quot; scope=&quot;request&quot; type=&quot;java.lang.String&quot;/&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Spring MVC Ajax Demo&lt;/title&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;scripts/jquery.js&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
    function doAjax() {
      $.ajax({
        url: 'time.html',
        data: ({name : &quot;me&quot;}),
        success: function(data) {
          $('#time').html(data);
        }
      });
    }
  &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
${message}
&lt;button id=&quot;demo&quot; onclick=&quot;doAjax()&quot; title=&quot;Button&quot;&gt;Get the time!&lt;/button&gt;
&lt;div id=&quot;time&quot;&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>How does Spring now know which classes or methods to call? Here comes the nice part about it.</p>
<pre class="brush: java; title: ;">
package com.maxheapsize.springmvc3.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import java.util.Date;

@Controller
public class HelloWorldController {

  @RequestMapping(&quot;/hello&quot;)
  public ModelAndView helloWorld() {
    return new ModelAndView(&quot;hello&quot;, &quot;message&quot;, &quot;Spring MVC Demo&quot;);
  }

  @RequestMapping(value = &quot;/time&quot;, method = RequestMethod.GET)
  public @ResponseBody String getTime(@RequestParam String name) {
    String result = &quot;Time for &quot; + name + &quot; is &quot; + new Date().toString();
    return result;
  }
}
</pre>
<p>The RequestMappings define the Url&#8217;s which can be called to reach that code. So the helloWorld method is available with &#8216;hello.html&#8217; in the web app. Why hello.html and not just hello ? Because we said so in the web.xml. I included a sample message which will be shown at the web  page when this method is called.</p>
<p> If you now push the button on the webpage, &#8216;time.html&#8217; with a parameter &#8216;name&#8217; is called. This will go directly to the second method. Spring will also check if a string parameter &#8216;name&#8217; (@RequestParam) is present in the original request. The @ResponseBody annotation  indicates that a method return value should be bound to the web response body.</p>
<p>The result will be returned and shown in the webpage.</p>
<div class="wp-caption aligncenter" style="width: 564px"><img alt="Ajax Result" src="http://maxheapsize.com/static/Spring3MVCAjax.png" title="Ajax result" width="554" height="83" /><p class="wp-caption-text">Ajax Result</p></div>
<p>Overall this is a pretty nice integration. I tend to use Spring for many projects and this makes it even easier to write some nice web apps in it. If you have a single page application and all you do is sending ajax request back and forth this might be a solution. </p>
<p><strong>JSON response Update</strong></p>
<p>To get a JSON response from your Controller you need to:</p>
<ol>
<li>Make sure the jackson mapper is present in your classpath. Maven users use:
<pre class="brush: xml; title: ;">
    &lt;dependency&gt;
      &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
      &lt;version&gt;1.5.3&lt;/version&gt;
    &lt;/dependency&gt;
</pre>
<p>in their pom.xml.
</li>
<li>MySimpleDataObject is a Pojo</li>
<li>The method you are calling has a signature like:
<pre class="brush: java; title: ;">
@RequestMapping(value = &quot;/demo&quot;, method= RequestMethod.GET)
public @ResponseBody MySimpleDataObject doSomething(@RequestParam name, @RequestParam email)
</pre>
</li>
<li>You are returning MySimpleDataObject at the end</li>
<li>Your calling javascript looks like this:
<pre class="brush: jscript; title: ;">
jQuery.getJSON(&quot;demo.html&quot;, {name: name, email: email}, function (data) {
        alert(data.someValueInMySimpleDataObject);
      });
</pre>
</li>
</ol>
<p>See also <a href="http://rwehner.wordpress.com/2010/06/09/2-ways-to-create-json-response-for-ajax-request-in-spring3/">Ralf&#8217;s post about Json and Spring MVC</a>.
<div class="tweetmeme_button" style="float: left; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F07%2F20%2Fspring-3-mvc-ajax-and-jquery-magic-or-better-simplicity%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F07%2F20%2Fspring-3-mvc-ajax-and-jquery-magic-or-better-simplicity%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2010/07/20/spring-3-mvc-ajax-and-jquery-magic-or-better-simplicity/" size="medium"></g:plusone></div> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=595&amp;md5=804ebdf4a0ac359404458402038948d7" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/07/20/spring-3-mvc-ajax-and-jquery-magic-or-better-simplicity/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F07%2F20%2Fspring-3-mvc-ajax-and-jquery-magic-or-better-simplicity%2F&amp;language=en_GB&amp;category=text&amp;title=Spring+3+MVC%2C+Ajax+and+jQuery+Magic+%28or+better%3A+simplicity%29&amp;description=I%26%238217%3Bm+playing+around+with+some+web+frameworks+lately+and+to+see+what%26%238217%3Bs+in+store+with+Spring+3+MVC+%28never+did+too+much+with+it%29+I+gave+it+a+try+to...&amp;tags=ajax%2Cjquery%2Cmvc%2Cspring+3%2Cblog" type="text/html" />
	</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[<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="tweetmeme_button" style="float: left; 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>
<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> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=557&amp;md5=129999eaf3b3888344ca295a715106d6" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></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>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F06%2F05%2Fbusy-programmers-guide-on-where-to-buy-ebooks%2F&amp;language=en_GB&amp;category=text&amp;title=Busy+Programmers+Guide+on+where+to+buy+eBooks&amp;description=Every+Programmer+needs+to+read+books.+Usually+you+would+get+some+packages+from+Amazon+%28or+your+favorite+retailer%29+and+read+through+them.+Now+with+devices+like+the+Kindle+and+iPad...&amp;tags=ebook%2Cepub%2Ckindle%2Cpdf%2Cblog" type="text/html" />
	</item>
		<item>
		<title>How to detect if your server is down when making jQuery Ajax calls</title>
		<link>http://maxheapsize.com/2010/04/26/how-to-detect-if-your-server-is-down-when-making-jquery-ajax-calls/</link>
		<comments>http://maxheapsize.com/2010/04/26/how-to-detect-if-your-server-is-down-when-making-jquery-ajax-calls/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 19:19:33 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=546</guid>
		<description><![CDATA[If you developed an ajax rich web application, maybe even a single page interface, you want to make sure that the user gets notified if the server is not reachable anymore. This happens either if the it goes down or the client loses its network connection. Depending on your code the application can run for [...]]]></description>
			<content:encoded><![CDATA[<p>If you developed an <strong>ajax rich web application</strong>, maybe even a single page interface, you want to make sure that the user gets <strong>notified</strong> if the server is <strong>not reachable</strong> anymore. This happens either if the it goes down or the client loses its network connection.<br />
Depending on your code the application can run for a while and the <strong>user is confused</strong> about missing interactivity.</p>
<p>So how do you detect this? jQuery offers an error callback if something with the call goes wrong. </p>
<pre class="brush: jscript; title: ;">
window.setInterval(function() {
$.ajax({
   type: 'GET',
Â¬â€  Â¬â€ url: 'http://www.myapp.com/heartbeat',
Â¬â€  Â¬â€ success: function(data, textStatus, XMLHttpRequest) {},
   error: function(XMLHttpRequest, textStatus, errorThrown) {
Â¬â€  Â¬â€    alert('Failure');
Â¬â€  Â¬â€  }
Â¬â€  });
}, 2000);
</pre>
<p>Unfortunately this does not work for a server which is down and if you are using a debugger like Firebug you will see that these calls have the status aborted. It turns out that if the <strong>server goes away</strong> jQuery will still execute the <strong>success callback</strong>. So how do you know that the server died?</p>
<p>I changed the response of the <strong>heartbeat</strong> query to contain some simple string like &#8216;alive&#8217;.  In the success callback I just check if the data contains this string. If it does not, I know that I do have a problem and I need to make sure that the user can&#8217;t do anything anymore.</p>
<p>I use the <a href='http://jquery.malsup.com/block/'>jQuery plugin uiBlock</a> to block every interaction and show a nice little message. Check out the <a href="http://jquery.malsup.com/block/#demos">uiBlock demos</a>.</p>
<pre class="brush: jscript; title: ;">
var uiBlocked = false;

window.setInterval(function() {
    $.ajax({
      cache: false,
      type: 'GET',
      url: '/mywebapp/alive.txt',
      timeout: 1000,
      success: function(data, textStatus, XMLHttpRequest) {
        if (data != 'alive') {
          if (uiBlocked == false) {
            uiBlocked = true;
            $.blockUI({
              message: &quot;I'm trying to connect to the server.&quot;,
              css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
              } });
          }
        } else {
          if (uiBlocked == true) {
            uiBlocked = false;
            $.unblockUI();
          }
        }
      }
    })

  }, 2000);
</pre>
<p>This code will check the server every 2 seconds and will<strong> block the UI</strong> when the server is not reachable and will <strong>come back up</strong> if the connection is <strong>alive</strong> again. Depending on your scenario (intranet/internet) you can change the interval for checking the connection.</p>
<p>This took me a couple of hours to get to this point and I thought it might be worth sharing. It seems a bit hacky but it works. What do you think?</p>
<div class="tweetmeme_button" style="float: left; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F04%2F26%2Fhow-to-detect-if-your-server-is-down-when-making-jquery-ajax-calls%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F04%2F26%2Fhow-to-detect-if-your-server-is-down-when-making-jquery-ajax-calls%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2010/04/26/how-to-detect-if-your-server-is-down-when-making-jquery-ajax-calls/" size="medium"></g:plusone></div> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=546&amp;md5=84c20a5404e4a94fb26ab4cae520336d" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/04/26/how-to-detect-if-your-server-is-down-when-making-jquery-ajax-calls/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F04%2F26%2Fhow-to-detect-if-your-server-is-down-when-making-jquery-ajax-calls%2F&amp;language=en_GB&amp;category=text&amp;title=How+to+detect+if+your+server+is+down+when+making+jQuery+Ajax+calls&amp;description=If+you+developed+an+ajax+rich+web+application%2C+maybe+even+a+single+page+interface%2C+you+want+to+make+sure+that+the+user+gets+notified+if+the+server+is+not+reachable...&amp;tags=ajax%2Cjquery%2Cblog" type="text/html" />
	</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[<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="tweetmeme_button" style="float: left; 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>
<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> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=532&amp;md5=69feb434e41450fc286ffce8286eb3d2" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/04/20/lightweight-web-prototyping-for-the-framework-loving-java-developer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F04%2F20%2Flightweight-web-prototyping-for-the-framework-loving-java-developer%2F&amp;language=en_GB&amp;category=text&amp;title=Lightweight+Web+Prototyping+for+the+Framework+loving+%28Java%29+Developer&amp;description=A+couple+of+month+ago+I+had+an+idea+for+a+small+web+app.+But+what+does+it+take+to+do+it+%3F+Do+you+start+with+the+back+end...&amp;tags=javascript%2Cjquery%2Cprototype%2Cblog" type="text/html" />
	</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[<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="tweetmeme_button" style="float: left; 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>
<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> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=497&amp;md5=7e374facb65dbab6573f3e7dd668f806" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></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>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F03%2F22%2Fhow-we-switched-from-subversion-to-git%2F&amp;language=en_GB&amp;category=text&amp;title=How+we+switched+from+Subversion+to+Git&amp;description=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...&amp;tags=git+subversion%2Cblog" type="text/html" />
	</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[<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.
<div class="tweetmeme_button" style="float: left; 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>
<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> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=459&amp;md5=22b70325f2e3e49a35e564393326155b" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></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>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F02%2F23%2F5-code-metrics-you-need-to-watch%2F&amp;language=en_GB&amp;category=text&amp;title=5+code+metrics+you+need+to+watch&amp;description=Developing+software+ain%26%238217%3Bt+easy.+How+do+you+know+how+you+are+doing+%3F+You+could+start+collecting+metrics+about+your+code.+These+can+give+you+some+indication+how+maintainable+and%C3%82%C2%AC%C3%A2%E2%82%AC%C2%A0...&amp;tags=Agile%2Ccomplexity%2Ccoverage%2Cmetric%2Cquality%2Cblog" type="text/html" />
	</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[<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="tweetmeme_button" style="float: left; 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>
<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> <p><a href="http://maxheapsize.com/?flattrss_redirect&amp;id=447&amp;md5=c537d78c9d0959eeee1068bed1a0f8ff" title="Flattr" target="_blank"><img src="http://maxheapsize.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2010/02/09/name-your-objects-right/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=owehrens&amp;url=http%3A%2F%2Fmaxheapsize.com%2F2010%2F02%2F09%2Fname-your-objects-right%2F&amp;language=en_GB&amp;category=text&amp;title=Name+your+objects+right&amp;description=Whenever+you+create+an+object+you+have+to+find+a+meaningful+name.+While+renaming+later+in+modern+IDE%26%238217%3Bs+is+no+problem+at+all+you+should+not+pick+the+first+name...&amp;tags=naming%2Cblog" type="text/html" />
	</item>
	</channel>
</rss>
