<?xml version="1.0" encoding="iso-8859-1"?>

<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns:cc="http://web.resource.org/cc/"
  xmlns="http://purl.org/rss/1.0/">

<channel rdf:about="http://blogs.codehaus.org/people/rinkrank//archives/java.html">
<title>Aslak Hellesoy&apos;s uncommon sense - Java</title>
<link>http://blogs.codehaus.org/people/rinkrank//archives/java.html</link>
<description></description>
<dc:language>en-us</dc:language>
<dc:creator></dc:creator>
<dc:date>2005-02-02T02:08:47+00:00</dc:date>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=2.661" />

<items>
<rdf:Seq><rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000971_what_every_java_programmer_should_know_about_ruby.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000844_poor_test_coverage_send_your_code_to_guantanamo.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000754_the_story_of_the_picocontainer.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000565_static_or_dynamic_mock_a_brief_comparison.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000150_qdox_attributes.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000149_ideamock.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000136_picocontainer_logo_contest.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000093_i_moved_to_codehaus.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000091_new_job.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/rinkrank/archives/000090_simian_refactoring_detector.html" />
</rdf:Seq>
</items>

</channel>

<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000971_what_every_java_programmer_should_know_about_ruby.html">
<title>What Every Java Programmer Should Know About Ruby</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000971_what_every_java_programmer_should_know_about_ruby.html</link>
<description><![CDATA[<p>Jim Weirich has written up an <a href="http://jimweirich.tadalist.com/lists/public/14055">excellent compilation</a> of what Javaheads should know about Ruby. I wish he had written up 2 years ago when I started to play with Ruby.</p>

<p>Java has been my language of choice for many years. Learning Ruby has opened up my eyes about what OO, agile development and extreme productivity should be like.</p>

<p>I'm not "converting" from Ruby to Java - I always try to use the best tool for the job at hand. Sometimes it's Java, sometimes it's .NET, sometimes it's Excel or PHP. More often than anything else it's not even about programming. But when it is, Ruby turns out to be the best choice for me more often than any other language. Probably because I'm an XP head. (And because I still don't know Objective-C or Smalltalk - it's on this year's TODO list).</p>

<p>Ruby - because I can get the job done fast and end up with super readable and maintainable code. And I'm worth it.</p>

<p>Now if those big corps that I tend to consult for would dare to do more things in Ruby... I reckon it will take a few years before we see them changing.</p>]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2005-02-02T02:08:47+00:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000844_poor_test_coverage_send_your_code_to_guantanamo.html">
<title>Poor test coverage? Send your code to Guantanamo!</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000844_poor_test_coverage_send_your_code_to_guantanamo.html</link>
<description><![CDATA[<p>Last year, right after joining <a href="http://www.thoughtworks.com/">ThoughtWorks</a>, my colleague <a href="http://www.skizz.biz/">Chris Stevenson</a> bounced off an idea to me during a <a href="http://geeknight.thoughtworks.com/index.php/GeekNightLondon">Geek Night</a>:</p>

<p>"How about a tool that deletes all code that isn't tested?". </p>

<p>I am still not sure whether Chris was entirely serious or not, but it was an intriguing idea that I have been thinking about quite often since then.</p>

<p>Now, the idea has been materialised in a new little tool in the <a href="http://docs.codehaus.org/display/ASH/Extreme+XP+Tools">Extreme XP Tools</a> family: <a href="http://docs.codehaus.org/display/ASH/Guantanamo">Guantanamo</a>!</p>

<p>Guantanamo is eating its own dog food, and as a result, it has 100% coverage. I still haven't tried to run it over any other codebases, so it remains to see whether it is useful or not. -And whether it is something anyone would actually want to use.</p>

<p>I'll give it a try at work :-)</p>]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2004-10-02T08:46:13+00:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000754_the_story_of_the_picocontainer.html">
<title>The story of the PicoContainer</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000754_the_story_of_the_picocontainer.html</link>
<description><![CDATA[<img src="http://www.picocontainer.org/pico-logo.png"/>
<p>
After a longish session pairing with <a href="http://paulhammant.com/blog/">Paul</a> we finally <a href="http://blogs.codehaus.org/archives/000753_picocontainer_10_final_has_been_released.html">released </a> <a href="http://www.picocontainer.org/">PicoContainer</a> 1.0 today.
</p>
<p>
This has been a great journey so far. Paul and I started it right after I moved to London to start working for ThoughtWorks. It all started when I asked Paul one night whether he had heard of Inversion of Control. He got this weird expression on his face when I asked, and I couldn't quite figure out whether he was excited or depressed.
</p>
<p>
<i>"It's my favourite pattern dood."</i> (Dood pronounced in his native British)
</p>
<p>
So he got all excited and told me everything about IoC (I didn't have that much of a clue), and about Avalon - a project Paul had been with for a while, but was drifting away from.
</p>
<p>
My initial reaction (a couple of hours later when Paul didn't have any more breath) was:
</p>
<p>
<i>"Why does it have to be that complicated?"</i>
</p>
<p>
We quickly decided to do a spike on a simple piece of code that could do IoC style dependency management via constructors rather than via setters and ugly container lookups from within the components. 

It's kind of blurry to me how we decided to go for constructors, as we were both drunk when we started TDDing the first lines. I think it was some kind of eureka moment where Paul was thinking about a comment made by Rachel Davies while she was reviewing our colleague Joe Walnes et al's Java Open Source Programming, and I was just being new to this and thought about simplicity. The way I remeber it we unisonely burst out:
</p>
<p>
<div style="text-align: center;">
<img src="http://fotap.org/gallery/2003/october/hausparty/.cache/320x240-IMG_0052.jpg"/>
<br/>
<b><i>"Let's do it with constructors!"</i> (Me left, Paul right)</b>
</div>
</p>
<p>
This was also my first real journey into TDD land. I had known about TDD for a couple of years, but hadn't yet had that epiphany where it fundamentally changed the way I think about code - and religiously follow the practice. I think the first test looked something like this:
</p>
<code language="java">
public class ContainerTestCase extends junit.framework.TestCase {
    public static class Fred {
        private final Wilma wilma;

        public Fred(Wilma wilma) {
            this.wilma = wilma;
        }

        public Wilma getWilma() {
            return wilma;
        }
    }

    public static class Wilma {}
    
    public void testShouldInstantiateClassesAndPassDependencies() {
        Container container = new Container();
        container.registerComponent(Wilma.class);
        container.registerComponent(Fred.class);
        Fred fred = (Fred) container.getComponent(Fred.class);
        assertNotNull(fred.getWilma());
    }
}
</code>
<p>
This was our first requirement - a container that can instantiate classes and understand what arguments to pass to the constructors. We alternated the keyboard rapidly and made the test pass. This involved some simple reflection logic and was implemented in a couple of classes.
</p>
<p>
The following days we added more features. Occasionally I would happily try to implement code without writing the test (requirement) first. It always resulted in a slap from Paul and a
</p>
<p>
<i>"You're doing up-front design again. How do you know whether that is needed or even if it's going to work?"</i>
</p>
<p>
So I gradually got the hang of TDD, thanks to Paul. (A couple of months later I was greatful for that. I was ruthelessly refactoring the entire codebase to improve the design. That would have been absolutely impossible without the extensive test suite we had built up by then.)
</p>
<p>
This was back in the days when Codehaus was a small place only hosting a handful of projects. About a week after we started Bob was kind enough to lend us a space for our new little baby, and that's when we named it PicoContainer.
</p>
<p>
PicoContainer quickly got <a href="http://blogs.codehaus.org/people/jutopia/">Jon Tirsén</a>'s attention (who I didn't know back then - he has later become a good friend and also a colleague). Jon quickly joined the project and has since been an important contributor. Much of the nice modular design we have today is owed to him. Several other people (<a href="http://joe.truemesh.com/blog/">Joe Walnes</a>, <a href="http://www.skizz.biz/">Chris Stevenson</a> and <a href="http://www.softwarecraftsmen.com/">Mike Hogan</a> to name a few) also helped us in the early days, and Rickard Öberg <a href="http://jroller.com/page/rickard/20030626">blogged</a> about it. PicoContainer was now a well-established project. This was late June 2003.
</p>
<p>
Half a year later my colleague <a href="http://www.martinfowler.com/">Martin Fowler</a> wrote an <a href="http://www.martinfowler.com/articles/injection.html">article</a> about the concepts behind IoC and PicoContainer, and this is how the term "Dependency Injection" was introduced. (Martin initially coined it "Service Injection", but <a href="http://www.springframework.org/">Rod Johnson</a> refined the term during a Geek Night in the ThoughtWorks offices in London).
</p>
<p>
Lately we have invited some carefully selected contributors, and we will hopefully invite more in the future.
</p>
<p>
PicoContainer now has pretty good documentation, we have fixed some <a href="http://jira.codehaus.org/secure/BrowseProject.jspa?id=10120&report=changelog">180</a> feature requests and bugs. It's simple to use, and the jar is no more than 50kb with no external dependencies.

There is a .NET and a Ruby port, and more in the pipe. NanoContainer is also an interesting sister project that adds scripted configuration using a multitude of script languages, as well as integration with WebWork, Hibernate and much more. (It's not that well documented yet, but we'll get there). 
</p>
<p>
The best part of this story isn't PicoContainer itself. It is how many people have learned about dependency injection as a way to decouple their code (both internally and from the container itself) and make it testable and mockable. At the end of the day that will bring us code that is easier to maintain. It's your code that counts, and you should be able to choose what container you want to deploy it in - if you need a container at all!
</p>]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2004-06-06T03:12:59+00:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000565_static_or_dynamic_mock_a_brief_comparison.html">
<title>Static or Dynamic Mock: A brief comparison.</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000565_static_or_dynamic_mock_a_brief_comparison.html</link>
<description><![CDATA[<a href="http://crazybob.org/roller/page/crazybob/20040120">Crazybob is Mocking</a>.

It struck me that his tests could have been even shorter and IMO more readable had he used a mock library based on dynamic proxies (like <a href="http://www.jmock.org/">JMock</a>).


The static way (Bob's example with minor corrections):

<code language="java">
    // Lines of code in the body: 10
    // Number of characters in the body (minus leading indentation whitespace): 274
    // (Not counting the MockServletConfig baseclass, which also has to be coded).
    public void testGetInitParameterWithStaticcMock() {
        final String expectedName = "foo";
        final boolean[] called = new boolean[1];
        new MyServlet().init(new MockServletConfig() {
            public String getInitParameter(String name) {
                called[0] = true;
                assertEquals(expectedName, name);
                return null;
            }
        });
        assertTrue(called[0]);
    }
</code>


The dynamic way:

<code language="java">
    // Lines of code in the body: 4
    // Number of characters in the body (minus leading indentation whitespace): 235
    public void testGetInitParameterWithDynamicMock() {
        Mock mockServletConfig = new Mock(ServletConfig.class);
        mockServletConfig.expectAndReturn("getInitParameter", C.args(C.eq("foo")), null);
        new MyServlet().init((ServletConfig) mockServletConfig.proxy());
        mockServletConfig.verify();
    }
</code>


(Some of you might argue that size isn't everything - I disagree of course - but if you have opinions about other drawbacks/benefits of each approach, let's hear it!)]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2004-01-21T01:49:27+00:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000150_qdox_attributes.html">
<title>QDox Attributes</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000150_qdox_attributes.html</link>
<description><![CDATA[<p>Can't wait for attributes? Need them now? Check out QDox Attributes! http://cvs.codehaus.org/viewcvs.cgi/qdox-attributes/?root=qdox</p>

<p>Piotr JFDI'ed the long-awaited thing. An easy to use and powerful attributes package for the Java platofrm.</p>

<p>It draws the best from Ara's XRAI, Mark's Attrib4J, Jon's Nanning and Jakarta's Commons-Attributes. All of which failed to deliver a usable product, but (tribute) all contributed to Piotr's new brainchild via their ideas and code.</p>

<p>And if you don't care about attributes - just read the code and doco. It's nice. Very nice. The package scope is even com.thoughtworks even if Piotr is not a Thoughtworker.</p>

<p>This begs for an interview :-)<br />
</p>]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2003-09-12T00:55:17+00:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000149_ideamock.html">
<title>IdeaMock</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000149_ideamock.html</link>
<description><![CDATA[<p>I'm writing an IDEA plugin. Ignorant of any other way to test it (yes, I have JUnit) than closing IDEA, reinstalling the plugin, reopening. Then HumanTesting.</p>

<p>IntelliBrains: Can you write an IdeaMock for us? So we can mock IDEA in IDEA? Or is there a way to launch IDEA from IDEA?</p>

<p>Puleeese!</p>

<p>:-)</p>]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2003-09-12T00:12:38+00:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000136_picocontainer_logo_contest.html">
<title>PicoContainer Logo Contest</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000136_picocontainer_logo_contest.html</link>
<description><![CDATA[<p>PicoContainer needs a better logo. Get your brushes and submit your art! <a href="http://wiki.codehaus.org/picocontainer/LogoContest">http://wiki.codehaus.org/picocontainer/LogoContest</a><br />
</p>]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2003-08-29T17:16:17+00:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000093_i_moved_to_codehaus.html">
<title>I moved to Codehaus</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000093_i_moved_to_codehaus.html</link>
<description><![CDATA[<p>I have been a <a href="http://wiki.codehaus.org/general/TheHausmates">hausmate</a> for<br />
a while now, so I am moving as much as possible of my OSS projects to<br />
<a href="http://codehaus.org/">Codehaus</a>. Then what's more natural than moving the blog too?</p>

<p>My old blogs were at <a href="href="http://www.freeroller.net/page/rinkrank">freeroller</a> and <a href="http://rinkrank.blog-city.com/">blog-city</a>. Rest in peace.</p>]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2003-07-10T01:27:37+00:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000091_new_job.html">
<title>New job</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000091_new_job.html</link>
<description><![CDATA[<p>I needed a more challenging job. So I started in ThoughtWorks UK a month ago. I'm glad I did.</p>]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2003-07-10T01:02:42+00:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/rinkrank/archives/000090_simian_refactoring_detector.html">
<title>Simian : Refactoring detector</title>
<link>http://blogs.codehaus.org/people/rinkrank/archives/000090_simian_refactoring_detector.html</link>
<description><![CDATA[<p>A couple of weeks ago a colleague at work pointed me to a tool called <a href="http://www.redhillconsulting.com.au/products/simian/index.html">Simian</a> (Similarity Analyser). It works very much in the same way as PMD's subproject <a href="http://pmd.sourceforge.net/cpd.html">CPD</a> (Copy Paste Detector).</p>

<p>I've written a <a href="http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-516">Maven plugin</a> for it. Have a look at a <a href="http://www.picocontainer.org/simian-report.html">sample report</a>.</p>

<p>With a tool like this, you quickly see candidates for refactoring.</p>]]></description>
<dc:subject>Java</dc:subject>
<dc:creator>rinkrank</dc:creator>
<dc:date>2003-07-10T00:48:25+00:00</dc:date>
</item>


</rdf:RDF>
