ACCU
Paul
Grenyer:
March 2010 saw the
The first half of the presentation looked at techniques for mapping objects to relational databases. His first example was a classic manual SQL approach where the developer writes all the code to invoke the query, extract the result data and clean up. Anyway who attended his previous talk about resource management in database access code will know the lengths required for this approach. He then switched to using one of the most popular O/RM tools (Hibernate) to take much of the legwork out of this affair. This was then refined over subsequent iterations to slowly reduce the amount of client code at the expense of a more complex class hierarchy using the Data Mapper and Registry patterns. The payoff though was the ability to Unit Test and Integration Test your Database Access layer.
The Integration Testing aspect was of particular interest to me as I had been working on this issue myself, albeit in C#, and was glad to see I was following a similar approach. Paul had MySQL running locally and the technique involved creating a database from scratch that contained just the tables and objects – no data. The tests would then be responsible for adding and removing any data; he used the natural rollback feature of transactions to perform the clean up. His test code essentially performed a round-trip by writing a new object and then reading it back again, being careful to ensure he was really hitting the database and not being served up his previous object from some internal cache.
The latter part of his presentation looked
at the GUI side of things and the Google Web Toolkit (GWT) in particular. This
toolkit allows you to write your presentation code in Java as well - turning it
into JavaScript to run in the client’s browser – so that you can use the same
code on both client and server. The server-side logic was exposed as a web
service using JETTY and invoked from the client via
As always we moved from the conference room to the pub across the road to continue any discussions, although I probably monopolised the speaker as I had a number of questions about his Integration Testing methods. His talk may have had Java in the title, but as is often the case many of the concepts and techniques he illustrated apply equally well to other similar platforms such as C#/.Net. I look forward to watching the full version at this years ACCU conference next month.