Niall,

This is *excellent* feedback. I really appreciate it and look forward to
working with you on this. My replies are included below. I hope you enjoy.

I am currently queuing up a bunch of responses so that I can go through and
update the document with feedback like yours.

on 3/4/01 11:55 AM, "Niall Pemberton" <[EMAIL PROTECTED]>
wrote:

> Jon,
> 
> http://jakarta.apache.org/velocity/ymtd/ymtd.html
> 
> I read your comparison of Turbine/Velocity and Struts/JSP and although you
> state it your aim to be "fair and unbiased", I think you failed since most
> of your examples, although sytanctically correct, were poor examples of the
> use of Struts and Jsp. I only started getting into Jsp & Struts a couple of
> weeks ago but below are my comments on your article. I also copy this to the
> struts mailing list as I am sure more experienced people may be able to
> comment better.

Yes, I think I should clarify the "fair and unbiased". I will do so.

> In your first example "Saying Hello" there is not need whatsoever in Jsp to
> have any "out.println" statements. The example you gave could have been
> coded in the following way:
> 
> <html>
> <head><title>Hello</title></head>
> <body>
> <h1>
> <% if (request.getParameter("name") == null) %>
> Hello World
> <% else %>
> Hello, <% request.getParameter("name") %>
> </h1>
> </body></html>

Thanks! I will update the current "right" example on the page to show your
code above.

> On the subject of "Generation", I don't believe this is a big issue, since
> 1) its automatically handled by the servlet container and therefore not a
> big issue to developers and 2) the performance issue is only relevant when
> you change the application, its not like it happens every time you run the
> jsp.

I specifically addressed your points #1 and #2 on that page by actually
agreeing with you. I think you missed the point of what I was trying to say.
I'm not saying that because of generation the system is slower or that it is
a big issue to have the servlet container do the work for you.

Sometimes, it takes explaining how the underlying system works in order to
explain the issues that are involved. In other words, as you go on to read
in the essay, quite a lot of the errors involved with working with or even
developing JSP are a result of the fact that JSP uses Generation in the
first place. The simple conclusion is that if you don't use Generation, you
don't have those issues.

Regardless of whether or not they are a "big issue" or not, they are still
an Issue and I see them come up quite a bit on the mailing lists.

(Note: My day job is to develop an Issue Tracking System, so I think I have
a pretty good understanding of what an Issue is. <smile>)

> On the subject of "Error Handling", you are comparing Velocity only with
> Jsp - the idea of Struts is that, it takes the need for Scriptlets out of
> Jsp by providing custom tags (java classes) to deal with those situations.
> What you quote here from Jason's books is only relevant to Scriptlets, not
> well written Struts applications. The issues stated there are exactly why a
> framework such as Struts was developed and an argument for using Struts.

100% True! I'm not suggesting otherwise. I have *always* said that if you
are going to use JSP, you should use Struts. Without Struts, JSP would be
even worse!

But, the point of what I am trying to say (and I will try to clarify it
further in the document) is that by using Struts and JSP there is *NO*
enforcement that requires you to not use scriptlets.

This goes back to the argument that says that embedding Java code in your
page is a bad thing. Of course it is! However, the fact of the matter is
that even in Struts own documentation, there is Java code embedded in the
page. If you go read the articles at Javaworld.com that talks about JSP,
each and every one of them does *something* wrong and it is actually
*harder* to code a page correctly than it is to do it incorrectly.

The final point being that I feel that developers (and users) should not
have to jump through hoops to do things correctly. Struts and JSP makes
people jump through hoops.

> Again in the section of "JavaBeans" you are not comparing like-with-like.
> Velocity/Turbine will have the same issues of "Scope" that any Web
> Application has and from what I see of your Velocity/Turbine example, you
> have just hidden this from the Web Designer.

YES! That is the *POINT*! Hide the hard parts from the web designer!

:-)

> The same can be done in a
> Struts application with Struts tags rather than the "<jsp:useBean>" tag.
> Again your quote from Jason's book relates solely to Jsp and is not a fair
> comparison to Struts.

In my opinion JSP == Struts (keep reading).

> I'll ignore the sample app section, again its Jsp not Struts.

Again, how can you take a technology and build on top of it and then ignore
the foundations for which it is built upon? Especially given that there is
nothing truly hiding that foundation or preventing you from using it?

You extend a class to add functionality to the base class. The publicly
available methods in the base class are still available to the classes that
extend it.

Putting Struts on top of JSP doesn't fix the warts in JSP. It simply hides
them until your developers find them.

> The "Taglibs" section is the first serious section which deals with Struts
> and you start with cheap points about "cutting edge of a broken wheel" - so
> tell me how is Velocity cutting edge then? - yet another scripting language
> to handle presentation that a Web Designer needs to get to grips with.

Ah. That is the difference that you haven't figured out yet. :-) Velocity
isn't a scripting language. It is a template language that has a *few* tags
that are well known and easy to use. That is why it is called Velocity
Template Language instead of Velocity Scripting Language. :-)

The core of the entire Velocity Template Language is:

#if
#else
#elseif
#foreach
#set

A scripting language is more like PHP which is more difficult to learn and
master (note, I have been using PHP since it's 1.0 days).

Velocity can be picked up (and mastered) in just a few hours.

> The idea with Jsp/Struts is that it extends HTML in the same "style" to what
> Web Designers are used to.

Infinitely extending HTML is better than a simple core set of 5 tags?

Also, as I pointed out in my "Implementation" page, Velocity is much more
than just a HTML generation system.

It can be used to auto generate dynamic email. It can be used to output SQL.
etc...

> I would be the first to say the Struts documentation could be better but the
> two examples that you listed from the Struts documentation were small
> examples used to illustrate specific Struts features and not the best way to
> develop Struts applications on the Model 2 architecture.

Leading by example is the only way.

> The first example
> using the <logic:equal> tag is poor because it encapsulates the "business
> logic" (I know its simple) of the app in the presentation and therefore
> shouldn't have been in the Jsp. Complex logic shouldn't be in the
> presentation layer and so their use should be limited. The "if. . . .else"
> logic of Velocity looks good to me, as a programmer, but I think a Web
> Designer would be more at home with the Tag Style they are used to.

Thank you for your opinion.

> In your second example from the Struts document which uses a Scriptlet to
> define an ArrayList - this has clearly been done to make the example simple
> (a point I seem to remember being made in the document, though I couldn't
> find the example again) - it is a break from the MVC architecture but its
> not how Struts should be used, this collection would have been created in
> the "logic" java end and put into scope ready for a Web Designer to use
> through Struts tags - as simple or simpler than the Velocity example.

If it isn't how Struts should be used, then it shouldn't be in the
documentation. Right?

> And finally - the example from "Jason Hunters" book which you say has been
> entirely implemented as a Struts app - this is awful and is a complete abuse
> of everything that Struts is about - why not get a decent Struts developer
> (not me!) of giving you a good example - also where is the Velocity
> equivalent for fair comparison - nowhere to be seen!

Ok. That made me laugh really hard.

Craig (who I'm assuming you think is a decent Struts developer given that he
wrote it) was the one who approved the examples that are going to be
published into the book!

:-)

> I was hoping for an article which would help me make an informed decision
> but your portrayal of Struts didn't show it in the way it should be used

Then *show* me how it should be used or even better, on the very first page,
I explain that this is a work in progress and that this document is a live
piece that is not only checked into CVS, but you can send me diff's that
improve on it!

I simply took the examples of how Struts documentation said it should be
used, just like a regular user would.

> or
> explain what else it could do, such as Internationalization.

There are a million cases out there that I could spend a 100 pages
explaining.

> I understand
> (but not like) commercial software vendors going to any means to disparage a
> competitors product but I am shocked that one Open Source project has done
> it to another when they both come under the same Apache umbrella.

The idea is not to disparage, the idea is to encourage you to make your own
decisions about things. That is why the title of the Essay is "You make the
decision."

There are *many* people (including myself) who have to go up to their boss
and explain why they choose to use a certain technology over another one.
This essay is a round of ammunition for these people. It gives them
something to point to when they tell their boss why they made their
decision.

thanks,

-jon

-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/ymtd/ymtd.html>

Reply via email to