Friday, May 17, 2013

Why use Spring Framework ?

For a job interview, the info found in the Wikipedia should suffice:
http://en.wikipedia.org/wiki/Spring_framework

Look at the the "Dependency Injection" section.
Follow this logic:
  1. Eorget about Spring for a moment.
  2. Think about an application with many classes, where -as usual- each class depend on many others.
  3. Think about how you would instantiate those classes.
  4. Soon you realize that the way they are coupled together, makes it a nightmare to instantiate them.
  5. Moreover, if you are unit testing, you want to make it flexible enough so that you can change those dependencies with mock objects.
  6. You realize that factories are a good way of abstracting and centralizing those object creations.
  7. You think about centralizing all this, so that you only worry about the functionality of the classes, and let "something else" worry about all that creation boilerplate.
  8. That's when Spring comes. It's a centralized container for those objects. Those objects are just POJOs (or beans). Pretty simple.
  9. Spring is much more than a container, but that's for the dependency injection related stuff.


Cheers.

http://forum.springsource.org/showthread.php?113923-Why-use-Spring-Framework

No comments:

Post a Comment