Conference, day 1-2

  • The JavaFX programming model is no match for Flex’s or Silverlight’s
  • Bruce Eckel doesn’t look like Bruce Eckel
  • Googlers, Googlers, Googlers (carry an Apple, Apple, Apple)
  • Neal Gafter has a hat glued to his head
  • Bob “natural currency” Lee is a nice guy and an excellent presenter
  • Ola Bini got in the country, despite looking like a serial killer
  • The Java Posse recording was fun, but the audio was terrible
  • Josh Bloch is always right, even if he’s not
  • Effective Java Forever

Guice Book

December 13, 2007

I’m writing a book on Google Guice, the notorious DI framework created by Bob Lee. I’ve been active in the Guice community for quite a while now, and I have to say that it’s an honor to get the opportunity to write about one of the most innovative Java frameworks out there. Now that it’s been published on Amazon, I feel like I’ve reached the point of no return. The world knows, so I’d damn well better make sure that I deliver some quality. So far I’m having a blast, so perhaps I’m still in Ted’s phase two. :-)

Guice

On a related note, I enjoyed talking to Bob at Javapolis today. On popular demand he took the advanced route for his Guice talk, which I think was appropriate. Too bad he didn’t have enough time to go through the example though. I was pleased to learn that much of what he talked about already made it into the book, in some form. Which must be a good thing, right? Anyway, one more day at Javapolis, and then back to work. :-)

Wish me luck. I’ll try to make sure I won’t need it. ;-)

Guice Debug Output

December 8, 2007

Guice has a dirty little secret: it logs timing information to its JDK Logger. A while ago I created a simple utility class for myself to enable or disable the logging of Guice’s debug output to the console. Here goes nothing.

/**
* Enable or disable Guice debug output
* on the console.
*/
public class GuiceDebug {
    private static final Handler HANDLER;
    static {
        HANDLER = new StreamHandler(System.out, new Formatter() {
            public String format(LogRecord record) {
                return String.format("[Guice %s] %s%n",
                                  record.getLevel().getName(),
                                  record.getMessage());
            }
        });
        HANDLER.setLevel(Level.ALL);
    }

    private GuiceDebug() {}

    public static Logger getLogger() {
        return Logger.getLogger("com.google.inject");
    }

    public static void enable() {
        Logger guiceLogger = getLogger();
        guiceLogger.addHandler(GuiceDebug.HANDLER);
        guiceLogger.setLevel(Level.ALL);
    }

    public static void disable() {
        Logger guiceLogger = getLogger();
        guiceLogger.setLevel(Level.OFF);
        guiceLogger.removeHandler(GuiceDebug.HANDLER);
    }
}

Output looks something like:

[Guice FINE] Configuration: 51ms
[Guice FINE] Binding creation: 53ms
[Guice FINE] Binding indexing: 0ms
[Guice FINE] Validation: 131ms
[Guice FINE] Static validation: 0ms
[Guice FINE] Static member injection: 2ms
[Guice FINE] Instance injection: 2ms
[Guice FINE] Preloading: 1ms

Listen to the Logger, it’s making sense. Guice is fine! :-)