[Zope-dev] Why are ZClasses bad?

Bjorn Stabell bjorn@exoweb.net
Wed, 3 Apr 2002 20:09:36 +0800


I would really like to see a hybrid between ZClasses and the CMF's
portal_types, so that you can define methods in the Python class that
you want portal_type instances of this class to be able to overload.
I'm currently abusing the CMF portal_types' actions to "overload"
methods of these types.  This makes it possible for CMF portal_types to
override some of the Python class' methods; that's usually all I need.

The methods that you want to be able to overload have to look for a
specific CMF action (for that portal_type) and call the skin method that
is defined for that action, similar to the way the CMF overloads
index_html/view.

Regards,
--=20
Bjorn

-----Original Message-----
From: Joachim Werner [mailto:joe@iuveno-net.de]=20
Posted At: Wednesday, April 03, 2002 17:41
Posted To: Zope Developer
Conversation: [Zope-dev] Why are ZClasses bad?
Subject: Re: [Zope-dev] Why are ZClasses bad?


Hi!

I guess ZClasses are not "evil" or so. But as somebody who has worked
with ZClasses for a long time and then switched to Python Products
instead, I see a lot of problems/disadvantages ZClasses have:

- Most important: It is rather hard to change the base classes with
ZClasses. In Python, you can do that very easily.

- Copy&paste programming does not work with ZClasses. With Python
Products, I can start writing my own version of an existing Product by
just searching and replacing all the occurences of the original Product
name by my own one. With ZClasses, copying an existing ZClass and
changing it to fit will not work well.

- If you use a decent editor (I am currently using PythonWin on
Windows), it is much more convenient to have all the methods of your
class in just one file than having to drill down into the ZMI and search
for individual Scripts (Python) or DTML Methods

- Debugging Python code is easier than debugging ZClasses. E.g., you can
use a real debugger, or just add temporary print statements to the code.
With Python code, the tracebacks are much more helpful than they are
with ZClasses, especially if you use DTML ...

- Working from Python gives you MUCH more power, and the code usually is
more compact.

- You can use CVS for the code, and there is a rather strict separation
between instances of your Product/class and the code ...

- ZClasses behave "strange" with regard to nested acquisition. I
experienced cases where two instances of a ZClass acquired from each
other in a way they shouldn't ...

- ZClasses are relatively slow, especially if you use other ZClasses as
base classes of ZClasses.

One of the great disadvantages of Python-based Products was that you had
to permanently restart your Zope to see the changes in action. But now
we have "refresh", which works great.

That said, I can still imagine using ZClasses together with a
custom-built Python-based base class. They are over-the-web, which is
their greatest advantage.

For Zope 3, I'd suggest a complete redesign of ZClasses to offer
something similar without the disadvantages ...



----- Original Message -----
From: "Dario Lopez-K=E4sten" <dario@ita.chalmers.se>
To: <zope-dev@zope.org>
Sent: Wednesday, April 03, 2002 11:20 AM
Subject: [Zope-dev] Why are ZClasses bad?


Hello!

I keep hearing people argue that ZClasse are bad, and I am curious as to
why they are.

I recall something about ZClasses and the catalog, but are there any
other "badness" with ZClasses?

/dario - curious

- --------------------------------------------------------------------
Dario Lopez-K=E4sten, dario@ita.chalmers.se        IT Systems & Services
System Developer/System Administrator     Chalmers University of Tech.



_______________________________________________
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 )




_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -=20
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )