The Kaptain on … stuff

01 Apr, 2009

The first two chapters of Griffon In Action

Posted by: TheKaptain In: Development

Documentation up until now has been sparse to be sure, but judging by the first two chapters of the MEAP for Griffon in Action, this book is going to be worth every penny.

I’ve experimented a bit with Griffon a bit lately, but still being somewhat of a Groovy noob, I don’t think that the full impact hit me until I started reading the book. Maybe part of the problem is not that it’s hard to understand, but that it’s hard to believe that it’s so easy.

A very clearly defined way of separating the classic MVC. Injection of views, models, controllers – all available by convention not by annotation, xml configuration or even having to a refer to a component by name. The transparent access to a variety of builder actions through plugins makes a large toolset available with little or no cost. Clear architectural boundaries exist that guide you to where your code should be developed. The Griffon framework, created with gracious acknowledgement to its forerunner Grails strives to do one thing above all – make Swing easy.

The power and versatility of Swing has always been obvious to me. The ‘magic sauce’ that makes large scale Java Swing applications behave in any sane way has been a little more hazy. The advent of SwingWorker and other enhancements to the Swing toolset and the availability of better documentation have certainly made the landscape a lot more tolerable, but at the end of the day, it’s still hard to even find good examples of large Swing apps to use as a guideline(well at least it has been for me.) On the other side of the spectrum, I’m not sure there IS such a thing as a small Swing app. The amount of boilerplate code required is cumbersame, to say the least, and between anonymous inner classes for actions/listeners and correct handling of business logic and the EDT by the time you’ve finished doing anything moderately significant you’re already a couple 1000 lines in.

Griffon takes all that and hides it behind a curtain. Expanding on the already powerful SwingBuilder capabilities, it provides a quick and easy way to develop complex Swing applications. Utilizing @Binding to provide easy view/model interaction and baking the Observer pattern right into the framework make it beyond simple to deal with GUI events. And the pattern for dealing with EDT issues couldn’t be much more straightforward.

[groovy]

doOutside {
…. do whatever you need to do off of the EDT
doLater { … come back to the EDT when you’re done to update widgets }
}

[/groovy]

I’m pretty sure that’s an easy enough pattern that I will never again forget the cost of doing… well pretty much anything that takes +1 second while blocking the EDT.

Personally, I’ve run into a couple of unexpected results when trying to utilize the webstart version of the application, but other than that everything has worked exactly as advertised. And at the end of the day I’m willing to chalk that up to my misuse of the system. I’ll tell you for sure when I get to that chapter of the book. Which will probably be about 2 days after the authors publish it.

🙂

So far my impression of the pre-release chapters of the book are pretty good – well written, clear and above all – the code samples work. Kudos to the authors Andres Almiray, Danno Ferrin and Geertjan Wielenga.  Look forward to the rest of the book boys, and to writing some new Swing apps with Griffon!

Reblog this post [with Zemanta]

2 Responses to "The first two chapters of Griffon In Action"

1 | Manfred Moser

April 1st, 2009 at 10:07 pm

Avatar

I have been curious about Griffon and your adventures with it for a while.Now I definitely want to get a hands on demo. Keep me posted.

2 | TheKaptain

April 2nd, 2009 at 11:03 am

Avatar

I certainly will, my friend. Between the recent Groovy 1.6 and the Griffon framework, Swing may no longer be a dirty word in my vocabulary.

Comment Form