[Zope] DTML or TAL
Harry Wilkinson
harryw@nipltd.com
Fri, 24 May 2002 16:56:32 +0100
On Friday 24 May 2002 3:35 pm, Andy McKay wrote:
> > > If yes, why does Devshed then post an article about DTML?
> >
> > They're lazy and out of date? ;-)
>
> They arent interested in ZPT because they can use DTML and find it fast and
> simple?
More likely they are sticking with what they know: DTML.
Long version of this post:
I feel I can speak pretty well on the subject of 'new users' and DTML/ZPT,
since I have been a new user of bother pretty recently. When I first started
using Zope I used DTML because it was the only option. Frankly, I hated it.
It reminds me of ASP in the way it mixes up logic in your presentation code.
I kept using it despite its inherant tendency to go awry, though, because
there was really no choice. Then ZPT appeared on the scene and I tried it.
It makes much more sense to me as a way of organising presentation of content
on a web page. The only place I used DTML now is where it really can't be
used, like in ZSQL methods, or (presumably) other non-XML things.
Some people seem to complain about ZPT relying too heavily on knowledge of
XML but I can't see how ZPT is that much more complex than HTML in structural
terms. Semantically obviously it's very different but the only thing
different to very basic HTML is the tal: and metal: namespace bits. Not
exactly rocket science.
Of course, you could do the same things (pretty much) in DTML that you could
do in ZPT in terms of seperation of logic from content, but it makes it so
easy to slip up and make a mess. You deliver a short-term solution to a
problem that has cropped up after release that isn't really best practise but
it's quick and easy. Then another comes in and you do the same. Then
another. Over the maintenence lifespan of your app, that once-clean
(although some people would say it's inherantly dirty ;-) ) DTML descends
into a stinking cesspool of hacks. I don't know about anyone else, but I'm
not a perfect programmer. I could use a little guidance now and again as to
how my code is best structured. I'd rather have a few constraints that keep
my code manageable in the long-term than make 'fast and simple' hacks that
come back to bite me in the ass a few weeks/months/whatever later.
On a vaguely related note, it seems lots of people make a big deal that the
main aim of ZPT is compatibility with WYSIWYG HTML editors. Personally, I
really couldn't give less of a shit about that. I don't use WYSIWYGs and I
don't plan to. The big win for ZPT is the inherant structure, pure and
simple.
Short version of this post:
dtml si su><0r!!111 ;-)
Harry