Sunday, June 11, 2006

Spring MVC or Webwork ?

Disclaimer::
To start with, I'm new to both of these frameworks and am looking at both of them with a fresh pair of eyes. And these are the first impressions I get when I look at both these frameworks. I dont have anything against or for the developers of both these frameworks.

It all started with a session that I attended at Thoughtworks on 'Spring Experiences'. Eventhough I'd heard of the name 'webwork' a trillion times, I never bothered to look at it bcoz of the 'pre-notion' :- Why another MVC framework ?

I'm on the way of developing an open-src j2ee based elementary school information mgmt system. Now this needs to be a web-app and nothing more than that. I dont expect and foresee other EJB clients / Web Services clients /PDAs accessing this app b'coz its completely going to be on the administrative side of a school; only used by the admin, office staff and (rarely) prinicipal of the school. This is the 'domain' and scope of the problem at hand.

Initially I planned to do this using Spring MVC+ Hibernate + MySQL. However when I started to use Spring MVC it didnt look very sweet to me because of two reasons

1) Lack of books that cover Spring MVC; Maybe this is because of the fact that Spring is 'vast' and each area that it covers needs a separate book I guess...and also due to the time & 'space' constraints imposed on authors.

2) I did not find Spring MVCs view part that elegant, specially the bind tag.

At this juncture I was fortunate enough to attend a session on Spring MVC at TW India where some of thier developers explained the 'experiences' they had with Spring and which was very much in tally with my 'experience' too.

At the end of the session there came in a discussion where webwork was discussed for a couple of minutes.. I thought 'Ok let me see what this is all about.." I picked up the book "Webwork in Action" and started off rightaway, I must admit that this is one of the best books I've read anywhere in the past 6 months. The presentation is excellent and has the look and feel of a step -by - step tutorial that starts simple and moves to more complex topics, and shows how easily WW handles it.

(In fact I'd almost lost hope on these kind of books after reading some recent books on popular IOC based frameworks. WW-I-A is definitely a welcome change to it and I would highly recommend having a copy of it..)

4 hrs down I was left thinking "should I use Spring MVC for my project ?" WW is essentialy quick to pick up if you know Struts and is undoubtedly one of the best successors to Struts.

The tag libraries are pretty easy to follow.

Looks easier than struts

In general it looks like WW has learned from the pitfalls / grey areas of struts and corrected them.

I also just glanced thru the topics that were illustrating use of IOC in WW. Ivent wrote code usings WW's IOC implementation so I am **not** qualified enough to comment on it at this point of time.

In overall webwork looks a bit more 'friendly and familiar' to me than S-MVC when we have a web-app and nothing more than that in hand.

So here I am thinking of replacing Spring MVC to adopt WW. I need to complete the book b4 I make a final decision, but I must say:- 'now' WW looks closer to adopt than Spring MVC.

11 Comments:

At 8:15 PM , Anonymous Brian McCallister said...

If you are comfy doing things WW's way, it is fantastic. IIRC they switched to Spring for their IOC stuff recently.

 
At 10:51 PM , Blogger Matt Raible said...

I've used them both and they're both significantly better than Struts. There are a lot of cool features in WebWork that Spring MVC doesn't have.

 
At 9:35 AM , Anonymous Jason Carreira said...

Hey, glad you like the book! Obviously I'd say you should choose WebWork :-) Spring is nice for the IoC and AOP support, but WW is pretty slick for the web tier.

 
At 12:44 PM , Anonymous Lars Fischer said...

Take a look at the Ruby on Rails framework for such a simple application. It'll reduce the amount of time needed for coding.

 
At 1:46 PM , Anonymous Anonymous said...

There is actually now a really good Spring MVC book out there:
http://www.apress.com/book/bookDisplay.html?bID=10048

Spring 2.0 includes a set of excellent JSP tags which combine HTML output along with the same bind functionality that spring:bind does. Note that if you were willing to use Velocity/FreeMarker, a similar set of macros has been part of Spring for quite a while.

Matt, if you are going to say something as non-informatative as "a lot of cool features in WebWork that Spring MVC doesn't have" without getting more descriptive, you may as well not bother, it's not adding much value. I also don't agree; Spring MVC and WebWork are actually pretty comparable, I'd have to say.

 
At 1:47 PM , Anonymous Anonymous said...

Shoot, didn't mean to be annonymous. Last comment was from Colin Sampaleanu.

 
At 6:47 PM , Anonymous Anonymous said...

We recently had to make a similar decision for one of our projects. After some discussion we opted for WebWork but it was a close call. I'd used both before in other projects.

Here are the advantages and disadvantages we've seen so far. They're by no means comprehensive nor accurate (i.e. we may just not know who to use them correctly).

Webwork

* More mature and well documented compared to Spring
* WW Interceptors are great
* OGNL lets you call methods rather than just properties in JSP (bugbear of mine with JSP)
* OGNL requires getting use to, though.
* Too much config required to add an action (xwork and spring changes)
* Sometimes having the Action be the Form as well doesn't feel quite right (e.g. when you put it into the session and have services injected in)
* Properties being used for dependency injection and as form properties is a potential security hole
* Richer UI components / tags

Spring MVC

* Less mature and less well documented than WW
* If you use JSP's you can't call methods other than getters and setters
* Spring + Sitemesh + Velocity is especially poorly documented
* Not a big fan of the massive inheritance hierarchies in Spring MVC
* It's great only to have Spring configuration to deal with
* It's handy that the same framework is used for both the services and the mvc layer

 
At 7:25 PM , Anonymous Anonymous said...

I think defining 'maturity' is pretty hard, but I would suggest taking any statement to the effect the WebWork is more mature than Spring MVC with a grain of salt.

Spring MVC has actually been around for quite a while, and has evolved in a stable and backwards compatible form. In the same timeframe, WebWork 1 has come and gone, and then WebWork 2 came, which was substantially different (ask Hani why he didn't switch from one to the other, it was not a straight upgrade path). In talking to people who have been using WebWork 2.x I have a number of times heard about the amount of churn in the project. As one example, I trained in late Nov. last year a couple of guys who had used WebWork for more than a year, and while they generally liked WebWork, they said the most frustrating thing was how much the code had changed during that time, to the extent that their own code had broken on a number of occasions, and they were not happy with the level of documentation (the webwork book had just come out I think). Now WebWork is morphing into Struts Action Framework, and the model will change again to some extent.

So my suggestion is that people properly take the time to evaluate each framework, and see how it feels to them.

As has been already mentioned, with either framework you're worlds ahead of Struts :-) And with either framework, you can harness the full power of Spring for the middle tier.

Regards,
Colin

 
At 8:10 PM , Anonymous Frans Thamura said...

I am using WW and now Spring as IOC, and Hibernate as ORM. three of them make a very powerfull stuff, WW bring the development more simple strict forward.

 
At 5:32 PM , Blogger Ercilla Web said...

This comment has been removed by the author.

 
At 5:34 PM , Blogger Ercilla Web said...

What if I introduce a framework which is simply incredible? It won't be much pain to click http://ercilla.webs.com and explore.

 

Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home