Quoting Eduardo Pelegri-Llopart ([EMAIL PROTECTED]):
> Hi Justin,
>
> I am not sure I understand your point. Is the objection that in JSP
> you have both scripting elements as well as custom tags? You could
> say: "don't do that". Most development groups and/or individuals have
> style guidelines that they enforce one way or another. For example
> you can even use putback scripts that check your files don't have
> scripting elements.
Yes, my objection is that JSP does not enforce a separation of concerns
between page design and program code. You could try and say "don't do
that", but late some tired night you will anyway.
It's similar to trying to do object oriented programing in a language
which offers no support for encapsulation. You can say "just don't
look at my private data", but people generally believe the situation
is much better when the language enforces it.
People generally prefer languages like Java for OO programming over
languages like C, because Java offers architectural support for
good design whereas C does not. Similarly people who use WebMacro
(or FreeMarker for that matter) do so because they prefer to work
within a framework that imposes good design architecturally.
> There is a different tackle on this: we can define a directive of a
> JSP that means: "does not use scripting elements". Although you could
> use this (specially with a project default value) as a stylistic tool,
> I think the most useful function might be in assuring your ISP
> provider that your JSP page will behave well. The ISP provider can
> give you a list of JSP tag libraries you can use "safely", and then it
> make some assumptions about your JSP page behavior.
Turning this on permanently and allowing someone to write pure Java
(with no non-java JSP junk in it) on the back end would be a good idea,
short of that I'm not sure it solves the problem.
I doubt very much you are willing to consider such a radical change
in the way JSP is defined and used. JSP is an attempt to copy the
design of ASP to the Java world, and it would cease to be that if
it were modified to enforce the design architecturally.
At best you could make this some kind of option that could be turned
on somehow (and preferably one that cannot then be turned off again.)
> I just went looking at webmacro.org and I am now more puzzled since
> webmacro seems to have scripting elements. Justin, can you elaborate
> your point a bit more?
WebMacro's script directives have absolutely nothing to do with program
logic or flow control, and cannot be used that way.
For example, there is a #foreach directive which repeats a block of
text. It looks superficially like a traditional program looping
construct, but it can't be used that way--its only function is to
repeat the block of text it contains once each time through the
loop, resetting the loop variable each time to the next value
in the list.
Similarly there is an "if" directive which looks superficially like
a traditioanl flow-control "if", but all it does is decide whether or
not to include a block of text.
No doubt a truly evil person could find a way to abuse this kind of
repetition and looping to perform program like functions--but it would
be fairly difficult, and not something that you would do by accident
late at night when you're tired.
Since WebMacro enforces these constraints architecturally it encourages
you to pursue correct design.
With JSP, on the other hand, the default behavior encourages you to
mix program logic with page generation. And while, as you point out,
you could say "don't do that", it is the default thing to do in
the language--and therefore what most people will wind up doing
most of the time.
>
> Thanks!
>
> - eduard/o
No problem :-)
Justin
>
>
> > Date: Wed, 3 Nov 1999 16:24:06 -0500
> > From: Justin Wells <[EMAIL PROTECTED]>
> > Subject: Re: Is JSP viable in a production environment
>
> > The big difference is that the separation of logic from view is so
> > critical that you really should have some architectural support for
> > it. I don't think JSP provides that--it allows you to separate them,
> > but only in the same way as assembly language programming can be
> > structured--only if you behave.
>
> > Template systems such as WebMacro and FreeMarker actually go a little
> > further and enforce the separation architecturally. That makes it harder
> > for you to get lazy and stick something where it doesn't belong.
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html