This post originated from an RSS feed registered with Java Buzz
by Dominic Da Silva.
Original Post: Spring solves the Javahut problem
Feed Title: dsuspense
Feed URL: http://tss9.serverconfig.com/suspended.page/
Feed Description: Java/J2EE, .NET, OpenSource, Orlando living, Trinidad stuff and of course the Dolphins!...
Imagine if the Perl cafe and Javahut were across the street from each other. You walk into Javahut, and ask to sit down. "I'm sorry," says the person at the door. I'm not actually the hostess, I'm a Factory class that can give you a hostess if you tell me what type of seat you want." You say you want a non-smoking seat, and the person calls over a NonSmokingSeatHostess. The hostess takes you to your seat, and asks if you'll want breakfast, lunch, or dinner. You say lunch, and she beckons a LunchWaitress. The LunchWaitress takes your order, brings over your food, but there's no plates to put it on because you forgot to get a CutleryFactory and invoke getPlates, so the Waitress throws a null pointer exception and you get thrown out of the place.
And my solution:
If he was using Spring,
400
he would have had everything he needed to order, seat, and eat already specified before
he walked in the door.
So upon entering Javahut all his depend objects would be there waiting for him.