[Zope3-dev] That damn <script> tag ;-)

Chris Withers chrisw at nipltd.com
Wed Sep 10 10:37:16 EDT 2003


Jim Fulton wrote:
>  > Scripting support inside templates leads to unmaintainable code and 
> unmaintainable sites.
> 
> For simple code and sites, I don't think that that is the case.

It's a very slippery slope.

> I suspect a profusion of Python scripts can be as bad or worse.

Isn't that why Zope 3 has persistent modules?

> For non-simple code and sites, you are right.  

So providing support for this kindof scripting is dangerous, surely?
I've seen far too many Zope 2 sites that started off as "something quick and 
simple in DTML" which then "evolve" into a complex mess of duplicated code and 
unfollowable logic.

Why are we encouraging this development path in Zope 3 after all the good work 
that has been done with CA?

> You can't understand the the dynamic logic of the template without seeing
> the code it calls. Similarly, the code often doesn't make sense if you
> don't see what it's being used for. 

I'm pretty sure I don't agree with that....

> if it's in one place.  In general, I find that abstraction makes things
> individually harder to understand.

Really?

<table>
<tr tal:repeat="row here/getRows">
  <td tal:content="row/title">A Title</td>
  <td tal:content="row/date">Date Of Publication</td>
</tr>
</table>

Are you saying you can't tell what the above code does even though the code got 
getRows isn't visible?

> I'm usually willing to trade off understandability of individual pieces to
> make the over all system easier to reason about.  For simple systems, the
> trade off isn't worth it.

We're talking about building an evolvable system here, when people evolve things 
they rarely change the paradigm they're working in. If they're started off using 
<script> tags, they'll probably keep using 'em in my experience. That's gonna 
hurt, especially for the poor sap who has to try and sort out the problems they 
get into later ;-)

> That depends on the site.  I'd bet a buck ($1 :) that the vast majority
> of people who use Zope build extremely simple one-off sites. For them,
> the ability to get things done in a very quick and dirty way is a big win.

Good thing I'm using that $1 as a bookmark already ;-)

> In Zope 3, I'm making a pretty clear distinction between scripting and 
> development.

How will you go about doing this?
What will happen when people misuse scripting tools for development and they 
don't percieve the need to learn development tools because they can "get away" 
with scripting tools?

> object it is acquired by, by using the "here" variable as the source of 
> it's data.
> In Zope 3, you won't be able to do that.

So you'd have to do more horrible things like traverse to the object(s) in a 
TALES expression ;-)

cheers,

Chris




More information about the Zope3-dev mailing list