Friday, September 12, 2008

Should I learn Spring Framework?

I am in the process of migrating an existing Model 1 JSP application to a modern MVC architecture and for several reasons I have picked SpringMVC for that matter.

For my proposal I need not only to justify the move (which is not hard) but be able to use the current workforce (several developers) which is not that familiar with Spring.

I came across a good SpringMVC tutorial that can be used as starting point for beginners ( http://maestric.com/en/doc/java/spring ) and someone posted a question that inspired me to come back and write my opinion about Spring Framework.

SpringMVC is just part of the Spring Framework. Spring is good because it tries as application framework to solve many different problems using "IoC" (Inversion Of Control) or "DI" (Dependency Injection), two terms which means the same for Spring Framework.

Spring promotes the use of POJO ( Plain Old Java Objects ) over EJB ( Enterprise Java Beans) found in J2EE ( Java 2 Enterprise Edition ). This POJO idea is important to eliminate wiring and make your code more testable and less dependent. Thanks to that idea Spring runs in any Application Server and even in simple J2EE Servlet Containers like Tomcat.

Spring is the framework picked by Grails, an attempt to bring more convention over configuration to Java. It is that "convention over configuration" what made "Ruby On Rails" such a well accepted WEB framework.

Programming to Interfaces is crucial in OOP and Spring encourages you to do so. The Spring container will take from you concerns that will allow you as developer concentrate in the specific domain of your application instead of things that are provided out of the box like testing, security, URL mapping, Database Access and much more.

AOP ( Aspect Oriented Programming ) is an important provided capability, another important Ruby On Rails feature that allows you to take care of things like logging from a single point in your application. Spring uses IoC and AOP to inject behaviors to your not animated Objects, keeping them unaware from each other existence while making them reusable from a business perspective.

The future seems to be DSL (Domain Specific languages) and Groovy has proven to be good at it with Grails making web development easier. Ruby has proven the same through Rails. It is Spring the Framework that makes things happen in Grails.

Whether you "should" learn Spring or not I really cannot say. What I can say is that Spring provides a good alternative to J2EE and the ideas behind the Framework are well accepted as a correct way to build Enterprise Applications while applying well known Software Patterns.

No comments:

Followers