Thursday, June 28, 2007

Lies, Damned Lies, and XML

Various skeptics have tried (and failed) to argue that annotation-based dependency injection results in tighter coupling than other approaches. I would argue that reams of proprietary XML code couples you to a framework more than anything, but I digress.

If you're still on the fence, Kevin B. further debunks the myths in Coupling:

Furthermore, the idea of "coupling" implies that "the one cannot function without the other." But with Guice's annotations, this simply isn't the case. It's important to understand that these are only annotations. They are decoration; meta-information. They don't, and can't, actually do anything. They just sit there, innocuously, in case tools will wish to read them, and otherwise have no effect whatsoever. They do absolutely nothing to impede you from testing your code, or from using the classes with Spring.

If you produce 3rd party libraries and you want to help Guice users use your products, but you don't want a compile-time dependency on Guice yourself, provide a separate Guice integration package. This is like providing your users with example Spring XML, except it doesn't suck.

Thursday, June 21, 2007

Guicey Tests

Dick Wall of Java Posse fame wrote an article on testing with Guice for developer.com:
In what I hope will be the first of several articles about Guice, a new lightweight dependency injection container from Bob Lee and Kevin Bourillion from Google, this article examines the simplest and most obvious use case for the Guice container, for mocking or faking objects in unit tests. In future articles I will examine other, more ambitious areas where it can be used, including dependency elimination in large code bases.
According to sources close to the story (a.k.a. Dick), the second installment is on its way.

Thursday, June 07, 2007

Introduction to Guice Video (Redux)

I gave my introductory Guice talk as part of the Google Open Source Developer Series. This is pretty much the same talk I gave in Beijing except the slides are better integrated into the video, which makes it easier to follow.

If you've been wondering what all the fuss is about, now's the time to find out! You can download Guice from its homepage. After the talk, check out the user's guide and Javadocs for more details, and join the mailing list.

Thanks, everyone who came out!

Monday, June 04, 2007

Tweets

Recently, in my Twitter feed:

Try offline Google Reader. 1. Install http://gears.google.com/. 2. Load Reader. 3. Click green arrow. So user friendly!
Knuth is speaking on graphs at Stanford this Wed. at 4:30: http://tinyurl.com/8g7ac
To load all new Firefox tabs in the background, set "browser.tabs.loadDivertedInBackground" to "true" in "about:config".
...
My last tweet makes the "v" shortcut in Google Reader imminently more useful.
^J in IntelliJ shows an inline Javadoc popup.
I just uploaded 8 pages of photos to Flickr: http://www.flickr.com/photos/crazybob/
Candidates for best large airports: OAK, SJC, STL. Lucky me! Now, if only they had direct flights to STL. Source: http://tinyurl.com/2v9yrc
My hotel had an upscale karaoke brothel hidden in the basement. $150 US for karaoke, 200 for sex.
Twitter is flaky. When are you guys going to rewrite it in Java?

If you find this interesting and you don't want to join Twitter, you could always subscribe to my feed directly.

Saturday, June 02, 2007

Beijing-Guice Talk on YouTube

My Google Developer Day talk is up. It's a bit rough. Good thing I'll get to take another crack at it when I get home. Practice makes perfect--some of us need more of it than others. ;)

Check out this video if you absolutely need to learn about dependency injection (and specifically Guice) right this second. Otherwise, wait for the video for my Open Source Developer Speaker Series talk.

Update: You can download the slides here.