JavaOne Day 4 - Part 2
Join the DZone community and get the full member experience.Join For Free
The widgets themselves are JavaFX applications that use the org.widgetfx.Widget class instead of the normal javafx.stage.Stage class to contain their user interface code. As an example of how easy it is to transform a JavaFX application into a WidgetFX component, Stephen showed us the WidgetFX version of Henry Zhang's Pac Man game written in JavaFX. The "conversion" was quick and the only tricky thing was making the screen resizable so it would fit in the WidgetFX dock. There were a couple of other interesting demos of existing widgets, but the most unusual involved a USB controlled rabbit. This was an informative and enjoyable session, and I recommend watching the video once it is available.
By the way, WidgetFX is currently running a contest and the top prize is a "year of books" from Apress. Go to the WidgetFX.org home page at http://widgetfx.org and click where it says, "WidgetFX Developer Contest Win a Year of Books" to find out more.
In presenting "Bulletproof User Interfaces: Applying Test-Driven Development to the UI," Jared MacDonald of The MathWorks, Inc. demonstrated that it is possible to use the Test Driven Development (TDD) approach when creating user interfaces. Jared started with a set of business requirements then followed the TDD process of creating a test that failed, writing just enough code to make it pass, refactoring any code that needed it, and then repeating the process until the requirements were met. He created a simple log-in dialog box as an example, and along the way demonstrated how using a TDD approach could find omissions and bugs in code that looks like it ought to work. Jared did an excellent job with this presentation and I look forward to seeing what he comes up with next year.
"Introduction to Google Guice: The Java™ Programming Language Is Fun Again!" presented by Bob Lee and Jesse Wilson from Google, was based on the premise that Dependency Injection is a Good Thing and that Google Guice is the best way to use it. Jesse began by showing us the code for a Twitter client that directly instantiated the objects it needed. He then showed us how using dependency injection made the code easier to test and to reuse in different applications. Jesse described the different types of dependency injection offered by Google Guice (constructor injection, method injection, and field injection), but strongly recommended using constructor injection whenever possible because it is the easiest and safest way.
Jesse gave us a quick look at Providers which allows for lazy construction for objects that may be expensive to create, getting multiple instances of the object, and accessing information from objects with different life-cycles and scopes. Moving on, he showed us how using Guice can help you take an existing application with many explicit dependencies and refactor it into a group independent modules.
Jesse covered a lot of ground in a short time and this is another time I'll recommend watching the video. There is a lot here and if you're interested in Google Guice, this session is a great place to start.
If you've been following my write-ups, I want to thank you for your time and attention. I am writing one more article on JavaOne 2009 for DZone and the intent is to take a step back and look at the conference as a whole. I’m also writing a review for a device that deserves much more attention than we’ve given it. I think you'll find both articles interesting.
Burk Hufnagel, reporting for DZone