floater
Java Jedi
总版主
发贴: 3233
积分: 421
|
于 2004-09-16 01:27
1. spring has 1 tag, one interface with one method, while struts has dozens of tags. This is not only an overkill, but also pollute into html world, it increases the learning cost, make html tools hard to use(even dreamweaver adopts this). 2. struts actionforms are intrusive to business objects, they have their own hirachy so we can't have our own hirachy in the business layer. DynaForm has its own problem too, there are redundent small objects everywhere. 3. M in MVC is for model, but the datasource binding in struts makes us to carry this unrelevent object all the way through. Business objects shouldn't care this at all. Struts folks misunderstand this. 4. Struts IoC is not generic at all.
These are just behaviors on the surface(It's just hard to capture all the behaviors because they are changing). There are some fundamental difference on concepts and logic in understand web problems: 1. The dynamic data and structure in HTML: are handled by JSTL, no extra tags needed. Error binding shouldn't interfere with HTML code. Replacing html with customized tags is pretty much like stepping on someone else's toes. 2. The mismatch between HTML form and java OO. All we really need is to match HTML form to java objects. This can be handled by one tag, that's enough, no need for more than 1. Spring does this precisely, while Struts just uses brutal force for almost everything(it has 41,000 lines of source code for tags). It further replaces the form action too.
So we really need just one simple tag for binding and errors. Once we have the java object for the form, we should be back to OO world and do whatever we do there. It should be a simple solution, conceptually. Struts just makes it a big deal, even struts centered solution. It claims that it solves certain problems, but the facts are it solves them with a higher price tag.
Recently, it happened I was dragged by my bosses into this Struts/Spring war. I found most of the struts developers I talked with are not technical matured, short sighted, narrow minded. They just know how to code mechnically, and don't have extensive experience. So I figured this is not just Struts/Spring war, but a war or a coaching on OO and general computer science. This is where I stopped because I don't get paid for this.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler, Refactoring - Improving the Design of Existing Code
|