Tuesday, July 10, 2007

Guice: Java's Missing Features

Do you have trouble testing your Java code? I'm not afraid to admit that I used to. For a long time, I blamed myself and wondered what I was doing wrong. Eventually, I learned that the problems lied with Java the language, not my skills or understanding. You can bet James Gosling didn't have unit testing in mind back when he first designed Java.

Until we fix the language or something better comes along, Guice can work with Java to resolve some of the issues. Jesse Wilson, who you may know as the creator of Glazed Lists, has posted parts one and two of an N part series dedicated to using Guice to fix a vanilla, static-clung Java application. Jesse has a lot of experience refactoring legacy code. I'm glad he's sharing his wisdom.


Blogger Matthew said...

Hello Bob, on page 20 of the Guice User Guide, there is a bug in the example code:

/** Increments the count and returns the new value. */
public synchronized int increment() {
return count++;

this method returns the old value, not the new value as the comment indicates.

Just to show you I'm actually paying attention. :)

11:32 PM  
Blogger Bob said...

Ha ha. Thanks!

8:31 AM  

Post a Comment

<< Home