Monday 19 March 2007

QCon - Friday

I made it down to QCon on Friday, and was really impressed. The content was really good, with virtually no sales fluff in sight. I would have really liked to get down on Wednesday and Thursday as well since the program looked full of good stuff. Hopefully the video presentations will be made available online at some point.

I went down specifically on an Ajax fact hunting expedition for a project I'm currently working on, and wasn't disappointed with the Ajax track. I attended 3 Ajax sessions, and learned quite a bit from each of them.

The first was "Ajax and Design Patterns: Do we need a client tier?" presented by Dave Crane.

The simple answer to the question is yes if your application is complex enough to warrant it. Initially Dave did a good job of explaining how Java and Javascript differ, specifically looking at Closures (which aren't easy to describe)! This led into examining the MVC and Strategy patterns applied in the client tier and looked at some Javascript implementations.

My session notes:

MVC:
  • Model maintained in client (possibly XML or JSON data sctructure)
  • Multiple views registered as model listeners with controller
  • Views access model state
  • Controller invokes view callback functions to update views on model change events
  • Javascript allows dynamic reflection on callback functions by function name, i.e. if controller can find a function with a name on a listener it will be invoked.
Strategy:

  • Since functions can be referenced as variables and passed around, strategy implementations can be implemented as functions with a closure.
  • Function objects in Javascript are a bit like anonymous inner class in Java.
  • Example use of a closure to pre-register lunch activities (devour sandwich, clean ear with pencil, ...) when person comes into office in the morning, with objects to interact with (e.g. sandwich).
I asked about how the server side domain model should be exposed to / kept in synch with the client side domain model. Dave answered by suggesting a DTO approach and Facade patterns as one possibility, although remoting potentially seems more attractive from a maintenance standpoint.

I found the talk interesting, but on reflection feel a little disappointed that Dave only covered two patterns. I personally would have preferred a higher level view of pattern usage in the client tier, and looked at more patterns without spending as much time on Java v Javascript, syntax, and closures. There's obvious scope for future work in this area.

Next came "Google Web Toolkit: What, Why and How" by Bruce Johnston.

Whilst GWT has been on my radar for a while, I haven't had a chance to look at it at all. From what I saw GWT looks pretty cool.

I really liked the slides about the pitfalls / risks of rich web interface development. I'm experiencing many of the issues highlighted on my current project. It just seems too hard / unproductive hand crafting HTML, CSS & Javascript (even with dojo et al). Fortunately it's still early days, and the UI framework is not set in stone yet.

My session notes:

  • Hosted mode customer browser allows Java debugging of UI without opening IE / firefox
  • Widgets are styled with CSS
  • History support looked well implemented
  • RPC support allowed for Java refactoring of client and server code together
  • Read the "Making GWT Better" document
  • No support for reflection / class loading. The tradeoff was for aggressive performance optimisations in the compiler.
  • Native javascript can be embedded in Java source
  • GWT can be integrated into existing apps
  • Several options for automated test support using hosted browser.
Overall, really impressed with what I saw, definitely something to play with this week :)

After lunch I ended up at the "Rich Internet Apps with Flex & Apollo" presentation. I had thought of going over to the agile track but am glad I didn't. Flash applications can definitely score in the "wow" factor stakes, the demo'ed applications built with Flex looked pretty slick. The presentation was mostly demos focusing mostly on a table data grid, and various ways that data can be fed into it including xml over http, web service, and a remoted pojo collection. Nice to see spring integration catered for out of the box. Other interesting things include
  • the performance test comparing flex to xml & javascript. Flex outperformed XML / Javascript by a factor of 10 when rendering 20000 records in a tabular grid (3 seconds v 30 seconds).
  • Live in table data editing
  • Real time collaboration demos showing 2 client sessions being kept in synch via the server, i.e. updates in one session, were shown in 2nd session.
Again really impressed with Flex, I'll be trying the test drive demo soon.

The final presentation I went to was "Synaesthesia - Listening to test smells" by Nat Pryce and Steve Freeman. Another good session highlighting how smells in test code often highlight design issues in code. Particularly liked the description of how the objects that an object collaborates with can be classified into:
  • Dependencies
  • Policy
  • Parts
  • Notifications
and how a constructor only really needs to accept dependencies as parameters to setup an object in a valid state. The policy, parts and notifications can typically be defaulted.

It was interesting to see how some of the audience thought that "logging is an interface" was really contentious. An example was shown of a class with a static Logger, with Nat and Steve highlighting how static stuff is hard to test, yet there was some incredulity that maybe a logging object could be passed / injected as a constructor argument instead.

Got an unofficial update on JMock 2 which Nat reckons will be released before the SPA conference next week.

I ended up in an open space session about People Stuff which has been blogged about here. Had intended to go to another session but it was nice to talk to others for a change.