J1 Session Blog: Last sessions
JavaOne is winding down and I am in for a last round of sessions. Three of them were worth to blog about:
Building Next-Gen Web Applications with the Spring 3.0 Web Stack
Keith Donald and Jeremy Grelle from Spring Source talked about building Web applications with the Spring 3.0 Web stack. The goal of this Web stack is threefold: provide a unified programming model, support multiple client types (e.g. classic Web, AJAX, Flex), and be adaptable for different use cases. The basis of the Web stack are the Spring Framework and Spring MVC. Who would have thought otherwise? Restfulness is the service type in vogue and therefore this is now the preferred controller model in Spring MVC. The support for different client types is quite impressive. Spring invokes the appropriate content creation code based on the client. The server-side code looks pretty clean (if Web application code can look clean at all…). With Spring 3.0 support for AJAX is extended, but they are still conservative with JavaScript. Their approach is to decorate HTML elements with rich behavior. The decoration is optional and the user interface still works with JavaScript turn off. It is even possible to add client-side validation and the code for that is generated based on the server-side model meta data. As a summary, both presenters were excellent and within an hour I got a very good overview on the upcoming Spring Web stack.
Introduction to Google Guice: Programming is fun again!
The next talk was excellent as well and gave a concise introduction in Guice. The presenter mainly focused on dependency injection and how this can help to modularize your Java code. The factory design pattern is well known and is intended to vary object creation. However, it does not solve the dependency issue and requires additional effort for testability. Guice is really convincing in this area. By means of annotations and a clever API which almost feels like a domain specific language one can mange dependencies way better than with factories (and with less boilerplate code too). I especially liked their approach of a mostly programmatic approach (rather than trying to coerce annotations into a programming language). There is no XML, only a few annotations and everything else is done programmatically. The speaker emphasized that Google prefers Java code over XML. Guice even allows to configure servlets programmatically rather than having a huge XML file. Scoping is another nice feature of Guice. A scope defines the life cycle of an object, such as a singleton which is created only once and reused thereafter. On the server side the scope may also be request- or session based. Injected objects can be decorated with method interceptors for aspect oriented programming. All facilities of Guice are exposed via an API which is great for tool developers. Guice works both in Java SE and Java EE, in Android, Google App Engine, and even in GWT (via GIN). They also announced their support of Java modularity which comes with Java 7. Guice looks like a great alternative to other dependency injection frameworks such as Spring or Pico.
Building Enterprise Java Technology Based Web Apps with Google Open-Source Technology
The last session I attended was about Google development infrastructure too, given by Dhanji R. Prasanna who is one of the core engineers of Google Wave. Java is really at the core of Google development. Two of the main advantages of Java for Google are type safety and developer scalability. Type safety is important because it allows to reason about program behavior and this is crucial for horizontal scalability. For example, the scalability of the Google App Engine depends on this. Developer scalability is also a top priority for Google. Their experience with JavaScript is that it does not scale at development time at all. The overhead to develop with JavaScript in a team of developers is prohibitive, since it does not have the means to create solutions that are sustainable in the long term.
Dhanji started the talk with Guice which was kind of a summary of the previous talk. I was slightly amused about the slogan he used for Guice: Vitamin C for your app! Then he explained how they used GWT (pronounced gwit and not g-w-t) for the iGoogle portal. Only the combination of Guice (resp. GIN) and GWT can achieve both flexibility and scalability. However, I found their notion of MVC pretty strange. The view cares only about visual aspects, which of course makes sense. The controller captures the presentation logic and the model communicates with the server. Now here comes the catch: the controller dependes both on the view and the model. hence, if they run unit testing for the controller they have to replace the view with a mockup view (using dependency injection with Guice). A presentation model would be way more convenient since it has no dependency on the view whatsoever.
Google has also developed an infrastructure for functional (acceptance) testing of Web applications, called Web Driver. It is purely Java based (he argued that Google developers don’t like to learn yet another XML dialect) and it comes with browser plugins for IE, Firefox and Safari. Hence, they can achieve very fast DOM interaction and asynchronicity is well hidden from the test case developer.
The last puzzle piece is called Sitebricks. This was kind of an official announcement and it will be available publicly in the near future. Sitebricks is a RESTful web framework for Java. He emphasized two properties: speed and statically typed templates. Yet again another example how important static typing is to Google.
Bottom line: excellent speaker and convincing presentation.










