Java University

comment 1
Dev

Today was the Java University day. It was a long day. There were three sessions, each of three hours duration which meant a twelve hour day (including breaks).

My first session was Developing Enterprise Applications With the Spring Framework with Chris Richardson, the author of POJOs in Action. He was a good speaker although he had one of those slightly mutant delicately nuanced accents that Brits seem to get after spending a long time living in the US. The session was interesting although he spent most of the time on all the dependency injection stuff I was quite familiar with and seemed to run out of time toward the end and had to rush a bit over the Hibernate stuff. But he went into some detail over Spring’s AOP support as well as the annotations that can eliminate a lot of the XML. While annotations can reduce the amount of XML required I’m not sure this is entirely a good thing as then your POJOs become more tightly coupled to the Spring framework. I think I prefer keeping it all in XML then your POJOs don’t need to know anything about Spring. He also described configuring the Application Context using JavaConfig which is pure Java but this looks even worse than annotations to me.

After lunch I attended a session on Using the Power of JRuby and Rails to Develop Robust Applications. This was a joint presentation by Brian Leonard and Sang Shin of JavaPassion fame. I found this really interesting. Brian gave a (brief) introduction to Ruby and JRuby in the first hour and the next two hours Sang went through a hands-on lab building various Rails applications.

The ability to create a working CRUD application using the Rails framework in about five minutes is amazing and it definitely looks like a fun language/framework to learn. An interesting Rails feature is the database migrations which manage the evolution of database schema. The transformations are described in self-contained ruby classes that have up and down methods that are called in sequence when migrating between versions of a database schema. Eg:

You can put any ruby code you want in these up and down methods.

It’s interesting that when you generate a new model class it actually contains no real code, eg:

Rails actually makes extensive use of ruby’s metaprogramming features here to create dynamically generated classes and methods.

The neat thing about JRuby (a ruby interpreter that runs on the JVM) is that you can call all your java code from your ruby program, eg:

I’m definitely going to have a play around with this and Netbeans has some awesome ruby/rails support now.

After the reception I stayed for a session on Netbeans 6.x. This covered quite a few features of the latest Netbeans but particularly interesting was the profiling tools. This uses JVMTI and lets you specify “root methods” which will only add instrumentation to those methods. This saves adding any profiling overhead to other areas of your application. You then run the appserver in profiling mode and take a “snapshot” which shows methods called, the number of invocations and the time spent in them, including “self time” which doesn’t include time spent in methods called by that method. You can then view this output in a few different ways and jump to the code. It looks really useful.

They also covered Netbeans’s new support for scripting languages like Ruby and JavaScript. Both the ruby editor and the javascript editor have support for refactoring and code completion. The javascript editor also has code completion support for frameworks like JQuery, scriptaculous and yui. A nice touch are the little icons that indicate browser compatibility. I also scored a Netbeans USB drive which includes an early access release of the new PHP suport in Netbeans.

This morning It had been lovely and sunny when I left at 7.30 but it was quite chilly when I emerged at 9pm. A sea fog had started to obscure the tops of the tallest buildings and the air was damp. I stopped for a while to listen to a loud three piece band playing on the corner of O’Farrell St and Powell.

It was a long day but a good start to what looks to be a busy week.

1 Comment

  1. […] so I thought I would attend his talk on using EC2 for testing. He’d obviously read my previous post as he made a reference to me calling his accent “mutant”. Chris, I hope I didn’t […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.