Middle of the week

October 25th, 2007 at 11:05 pm by Jesper Thuun Petersen

Wednesday did not end with me blogging away in my cell, but saw me chatting away late into the evening at the Tenderfoot Lounge bar.

It was an interesting day, where I managed to learn what REST is. the right approach to webservices and how it is possible to structure code by using a mix of POJOs, dependency injection and AOP.

Although the session on POJOs did not present any eye openers, it was nice to be reassured that the path we’re currently taking in the project I’m working on, is the right path. DRY SOCs where the keywords, which in plain english is Don’t Repeat Yourself and Separation of Concerns.How? The speaker used Spring to tie together the parts of his system, although Guice could have been another approach. We don’t use either, but we do design our system using interfaces and constructor injection so as to avoid tight coupling. We can easily test the parts mocking the dependencies using JMock, which the speaker also demonstrated.

He went on to show how boilerplate code on his service layer including security, transaction management, logging and auditing, is added using abstract oriented programming, which is also a part of the Spring framework. With AOP handling these concerns, the mock object test cases also becomes a lot simpler! He shows an example where AOP is used to add certain behavior to classes with certain annotations. He does this by making AOP make the annotated classes implement an interface, and adding the appropriate methods defined by this interface. Great stuff!

AOP seems to have matured into something ready for production code.

I went to two different sessions on REST. The first one took a very academic approach to the subject matter, and I didn’t leave that session with a very clear idea about the concept. Luckily, I went to another session on the same subject, and I was reminded that speakers are more important than the subject matter. The latter guy managed to explain the concept in clear understandable examples, and in just about 5 minutes I had understood more about the concept that the 1½ hours with the first guy. The very short version is hard to give, but REST is the architectural style in which the web has been built, and more specifically, the design principle behind HTTP 1.1. Unfortunately, the existing browsers are not using the protocol as it were supposed to be used. All URIs are supposed to represent a ressource, and the HTTP commands GET, POST, PUT and DELETE are the CRUD operations available upon them.

Popularity: 290 points

Leave a Reply