[Zope] How a WebSite works using Zope?

Jim Penny jpenny@universal-fasteners.com
Tue, 21 May 2002 15:01:14 -0400


On Tue, May 21, 2002 at 01:21:46PM -0400, Jorge O. Martinez wrote:
> sean.upton@uniontrib.com wrote:
> >I think you are on the right track in conceptualizing this; Zope does a 
> >very
> >good job in making it easier to break things up into easily digestible 
> >small
> >(generally) single-purpose components.  Everything is an object in Zope,
> >including granularly small single-purpose software components (like ZSQL
> >methods and the database adapter objects they use, or python scripts, page
> >templates, or user folders) that you place/arrange inside container objects
> >(folders).
> >
> >You may want to strongly consider using Zope Page Templates (ZPT) instead 
> >of
> >DTML; they are documented well in the 2.5 (online) version of the Zope 
> >Book.
> >They keep code, generally speaking, out of the presentation, and even allow
> >you to have designers create mockup that gets stripped at runtime.  You'll
> >get much better editor possibilities if you use ZPT because it won't break
> >syntax highlighting in most text-based HTML editors, and will work with
> >WYSIWYG editors without breaking layout.
> 
> One thing that I am not sure about ZPT is speed when compared to DTML; it's 
> slower, at least that is the perception I gather from the posts I've read 
> on this list, am I mistaken? Any Zope guru outthere could opine on this? 
> Don't mean to start a DTML/ZPT conflict, just an honest question ;-).
> 

This is my take, based on limited experience, and without doing rigorous
benchmarks.  I am going to refer to Script (python) as snake_thingie.

Tested in isolation, ZPT is without doubt slower than DTML.  I have seen
figures that indicate that it is MUCH slower.  But, I believe, again
without real testing, that in a real production environment, that a
snake_thingie/ZPT based system is not slower than a DTML based system.

The reason is that you are forced to move essentially all
logic into the snake_thingie.  In the DTML based approach, you had a
double interpretation problem, DTML was being interpreted using a mostly
python based approach.  In the snake_thingie/ZPT, you have the situation
where business logic is going much faster, and presentation is much
slower.  This appears to be about a wash.

Now, in the best of all possible worlds, you could write a
snake_thingie/DTML system, getting both faster business logic and faster
presentation.  I have been moving that way for quite a while, and find
that I just can't do it.  ZPT goes much further in "encouraging" you to
do clean separation.

As an aside, in my opinion, "Path Expressions" are underutilized in the Zope
Book, and many of the examples show elements with both a condition and
a content (or condition and replace).  This produces slower code simply
because of double evaluation!

Jim Penny