Wednesday 8 August 2007

Using the Presentation Model pattern

I came across the Presentation Model pattern while looking at other libraries at JGoodies. This is an interesting alternative to the usual Model, View, Controller approach to implementing a Java & Swing GUI. It fits better with the way Swing works and JGoodies binding puts it all together beautifully. The pattern is described in detail on Martin Fowler's site.

At work, we are are about to begin coding a pretty large Swing application which will model most of the company's business. We are going to be using JGoodies binding and Presentation Model for this. I wrote a reasonably complex prototype to test out some ideas we are considering using. I used the same prototype to try out Presentation Model and binding. I like it a lot. There is a bit of a learning curve at the start, but this is rewarded with a lot less code to write. In particular, there is less boring, repetitive and error-prone code to write to synchronise the view with the domain model.

Anyone about to implement a Java Swing application should take a look.

No comments: