Showing posts with label spring. Show all posts
Showing posts with label spring. Show all posts

Thursday, 11 June 2009

The Sceptics Guide to Spring 3.0

The 50MB download of Spring Framework 3.0 has begun. More comprehensive REST support and a codebase fully updated for Java 5 await. What more could a Java aficionado desire?

Want to pry into the mind of a Spring-meister? Don't ask me, let Rod Johnson be your guide. Spring feels so much like the next JBoss. I'm not saying Spring and JBoss are equivalent, their completely not, but the whole upstart, hyped-up nature of Spring is just so reminiscent of JBoss, which points hard to its inevitable obsolescence. Given this outlook, why even bother trying to learn Spring? Well, because it is a "thermometer of our times" and the software concepts in Spring may well find life in some future products so the learning effort, we might assert, will not be entirely wasted. If we can overcome this emotional antipathy towards Spring, and overlook its incongruous rhyming nature with another, very familiar Java toolkit (Swing) we might be able to make some headway in terms of learning this technology.

To comprehend the incredible complexity of Spring, you need to first walk the path of dependency injection and "inversion of control". Nobody likes jargon, least of all pretenious, newly-coined terms like "inversion of control", but alas, one needs to have an acquaintance with aforementioned terms as a prerequisite to proceeding with Spring. It is just one of those rites of passage. Think of it as a bridge that once crossed will render the perceived complexity of Spring powerless.

Dependency injection is a specific example of "inversion of control" (which is a very vague general term that can be used for a lot of code patterns). Fowler prefers the term dependency injection in order to be more clear. Dependency injection, to put it crudely, is storing settings in an xml config file which can be read into a Java object (I will not use the term POJO as it sounds ridiculous imho) which is then used to initialise other objects. Dependency injection is no different from what you see in any software application that has configuration information. It's just another word for "config".

Dependency injection is like any other design pattern, a fancy name for something programmers have been doing all along.

Sunday, 11 January 2009

Spring Framework and Aspect-Oriented Programming

IntelliJ has full support for the Spring framework which supports Aspect-Oriented Programing
(AOP).

AspectJ is another AOP framework.

The idea of AOP is an application or service has various "aspects" such as logging, perfomance monitoring, exception handling etc.

Dependency injection and AOP are complementary techniques.

IBM have a series of articles called AOPAtWork. Here is a sample article: "Say goodbye to scattered and tangled monitoring code, as Ron Bodkin shows you how to combine AspectJ and JMX for a flexible, modular approach to performance monitoring".