[Zope-dev] DTML is not simple

Jim Penny jpenny@universal-fasteners.com
Wed, 8 May 2002 15:51:21 -0400


On Wed, May 08, 2002 at 02:14:16PM -0400, Ken Manheimer wrote:
> (I missed the start of this topic, plz forgive me if i belabor what's 
> already been said...)
> 
> > Jim Penny wrote:
> > > 
> > > But, I also agree with Adrian's thrust, DTML is a simple useful
> > > language, that, ignoring the quoting problems and all the _ namespace
> > > magic, can be picked up by anyone with an imperative language background
> > > in a couple of days.  (Now, the quoting problems are indeed gross).
> > > There is also far too much magic in DTML, especially in name lookup.
> > 
> > So you see, DTML isn't actually simple ;-)
> > 
> > It appears simple, until you try and do anything useful with it.
> > Then, all of a sudden, you have to use the quoting, the _, and you have to try and make
> > sure you're <dtml-var some_variable>'s are coming from the right place, not calling
> > something when they don't mean to, etc, etc...
> 
> As far as i'm concerned, DTML's ideosyncracies are insignificant compared
> with the fact that DTML tries to intermix procedural and layout/templating
> languages, which is fundamentally flawed.  It can certainly be useful -
> like 'goto' can be useful in programming - but you lose crucial benefits
> of structured code in the process.
> 
... snip, snip
> Like i said, i think this debate is very like the arbitrary-goto
> programming issue which was laid to rest years ago - see dijkstra's "Go To
> Statement Considered Harmful", from 1968, for a classic account (it's
> reprinted as an ACM "classic of the month",
> http://www.acm.org/classics/oct95/ ).

Two responses -- much of the objection you have seen recently is due to
impedence mismatch, in the head of (some) developers.  I respect what ZPT is
trying to do.  I am switching (slowly) my own code to ZPT.  But, ZPT
looks like no other programming language, uses yet another set of
conventions for namespace access, is effectively buried deep inside
XHTML, or worse XML, encourages infix notation, and is generally not very 
scannable.

Nevertheless, I would encourage newcomers to begin with ZPT.  Note:  the
Zope Book needs to be re-orderd (and no, I am not volunteering) so that
ZPT is presented before DTML.

I think ZPT is harder for programmers who have been with zope for a long
time than it is for newcomers, and I think it is harder for people who
have a long experience with working in procedural languages than it is
for relative newcomers.  

What I found off-putting about ZPT has nothing to do with structure vs.
non-structure.  By classic definitions, DTML was almost strongly structured,
and I think that ZPT is not (classically, in the "structured program"
sense) structured at all!  ZPT certainly has a paucity of standard control
structures (deliberately), it is not clear that it has nested variable
scope, you cannot define (internal) procedures, much less nest them, etc.

It has nothing to do with templating vs. non-template use.  I have been
working to remove more and more logic from DTML, anyway.  

What I do object to is that 1) it is really, really hard to read TTW, and 
2) that is introduces some additional, fairly baroque magic in the
"order of execution of element type" definitions.  I would have
preferred that they be evaulated/performed in textual order.

Now: arguably a template language should look nothing like a procedural
language.  I am not sure.  I have not seen all that many template
languages, and most of the ones I have seen are more "screen painting"
in orientation than is appropriate in this context.  I hope, that in the
end, the aphorism will be "DTML looked simple, but wasn't; while ZPT is
the opposite".  I am not 100% convinced of that, at least, yet.

Jim Penny

> 
> (I'm fond of saying that ZPT does well the thing which makes zope excell -
> good impedence matching - and DTML does *not*.)
> 
> -- 
> Ken
> klm@zope.com
> 
> 
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>