Sunday, November 25, 2007

First Impressions of Spring

Over the long Thanksgiving break I decided to learn the Spring framework for a fun project I have been working on. My decision to use Spring was based mainly on a friend who said it was what I needed for my project.

Overall I like Spring. It is the glue of an application and makes the kinds of things (aka classes) configurable. One of the nice things Spring provides is an automatic answer to the question "where do I put that?" - a question that is supposed to be answered in the design phase of development. Spring also uses well known design patterns that make it easier to learn provided you know the patterns.

It was also nice to have many of the essential Java technologies all in one place. My application needs a web UI, a task scheduler, and a mailer all to run inside of a servlet container. The Spring framework already includes everything I need with Hibernate and Quartz.

One think I don't like about Spring is that it makes your application more prone to runtime errors. It is easy enough to pass a program through the compiler only to have it break during runtime because a bean uses a class in a jar that has not in the classpath. This isn't something I was used to in a strongly typed language such as Java. It would be nice if there was a tool that could run through my application and check bean/class dependencies. All things considered, for me this isn't a huge drawback - it is simply the price price that must be paid for all of Spring's flexibility. Hopefully it will motivate me to write better unit tests.

Another thing that was difficult for me was the number of dependent jars included with Spring. There were some inter-library dependencies that were time consuming to resolve. I would like to see all shared code compiled into one of the spring core jars and have every other module be self contained.

2 comments:

Ashkan said...

Yucha, which book do you study spring from?

myucha said...

Hi ashkan, thanks for reading.

I read Pro Spring 2 from Apress (http://www.apress.com/book/view/1590599217)