[Zope] Zope Book mentions "Fragility"
Paul Howell
paul at smoothstone.com
Mon Nov 17 01:15:58 EST 2003
At 12:38 AM 11/17/2003 -0500, Paul Winkler wrote:
>On Sun, Nov 16, 2003 at 10:38:01PM -0600, Brad Allen wrote:
> > I don't follow your use of the word "magic".
>
>I mean this:
>Asking for an object only by name and expecting to
>get the right object, no matter what folder you're in.
>Acquisition provides the "magic". It's very convenient when
>it works, and also easy to shoot yourself in the foot.
"Magic" words are a little deeper than that, as is the advice to be careful
with them. The Zope book passage you quoted didn't quite go deep enough
into the explanation for programming newbies, I think. The example used
"magic" words for Python scripts like "feed" and "vaccinate"... horrible
choices, actually. Why? Because they are common words and easy to use for
something else, like the poor administrator of the website example in the
Zope Book. If that script writer had instead used ps_vaccinate (ps_ for
Python Script), and consistently used ps_ prefixes for all such scripts, it
would (1) be unlikely that someone would accidentally step on this reserved
(or "magic") script name, and (2) anyone could learn quickly that
ps_anything is reserved. Such a naming style doesn't lead to pretty,
interesting URLs like the examples in the Zope Book provide, but I
personally NEVER build a website that depends on script names and
acquisition in the URL. Well, not never, because I use Plone more now, and
it does so in a number of places without my interference. But otherwise,
never.
As with any advice about coding styles and management of large websites,
YMMV. Good luck.
=Paul
More information about the Zope
mailing list