[Zope] Death to zClasses!

Max M maxm@mxm.dk
Tue, 28 May 2002 10:51:38 +0200


Death to ZClasses!!!
====================

By Max M. 28-05-2002 10:42


I have used Zope for a few years by now and have developed both in 
zClasses and Python products. While zClasses seems nice when you start 
out, you will soon be bitten by their subtleties.

So you save a little time by not doing a Python product at the 
beginning, but soon you loose that time, and more as you struggle with 
the zClasses.


I have written this document to help other people see why zClasses are 
"A Bad Thing". I think that way to much effort is wasted in 
documentation and development using zClasses. If all that energy had 
been focused on Python products, Zope would be much easier to use and 
program for everybody.


so DEATH TO ZCLASSES! ;-)



It is hard to change the base classes with ZClasses
---------------------------------------------------

Sometimes you make a mistake, or you forget to include a base class when 
writing a product. So you want the ability to add them later.


The order in which you subclass classes matters. Sometimes you do it 
wrong, and you want to change it. zClasses makes this difficult. Example::


    class myFolder(SimpleItem, ObjectManager):
        "This won't work as SimpleItem has a method called ObjectValues 
that allways returns an empty tuple"
   
   
    class myFolder(ObjectManager, SimpleItem):
        "This is The Right Way as the it will call 
ObjetManager.ObjectValues() so yuu get the expected result"

Ok you made the mistake. Now try and fix it !



Subtle changes when changing meta type
--------------------------------------

If you change the meta type of a zClass you have to also change the add 
List name, in the zClass' factory to be able to add instances through 
the Zmi. That is at least when you have a Python Based ObjectManager 
class that uses the ZMI.

It also breaks the ability to cut/copy/paste/rename those zClass objects

It also makes the little + dissapear in the tree view so you cannot 
expand the Objectmanager based zClasses.



Makes it harder to learn what Zope actually do
----------------------------------------------

When you write Python product everything is much more transparent, and 
there are fewer subtle effect that surprise you and make you wast hours 
debugging.

You are more prone to do it the right way when writing Products and put 
login into Python and not the dtml. Simply because it is easier to do.

It's also hard to document how to make zClass based products as you have 
to use a lot of screenshots or animations instead of text.



Code for one class spread over several locations stops you from thinking 
clear
------------------------------------------------------------------------------

It as if you wrote Python code with all of your methods in different 
files. And as it is common knowledge the number of errors rises 
exponentially with the amount of code you cannot see.

It can make class seem much bigger and more complicated than it really 
is if you cannot see all the code.

Having products with parts of the code in External methods, other as 
dtml-files, python scripts etc. in the Zmi is a real drag! It seems so 
simple to begin with, but as the product starts to grow, it is so tiring.


Programming through a web browser sucks! It slows down development 
considderably. Using ftp in the editor doesn't help much.



A hassle to upgrade on remote servers
-------------------------------------

With products you just upload via ftp, and perhaps run a script to find 
all instances and add new attributes.

With zClasses keeping a development and production server in sync is 
hard to difficult.


There is a whole lot of software writte to work around the flaws of 
using and uprading zClasses. That should be a hint that somethings wrong.



Other reasons that other people has reported
--------------------------------------------       

There is a subtle bug in the ZClass registry code that can cause 
instances to refer to an older class definition.
   
Makes it hard to use straight up Python code, have to use external 
methods, Working from Python gives you MUCH more power
   
Copy & paste programming does not work with ZClasses. So it's harder to 
start new projects.
   
Debugging Python code is easier than debugging ZClasses.
   
You can use CVS for the code
   
ZClasses behave "strange" with regard to nested acquisition.
   
ZClasses are relatively slow, especially if you use other ZClasses as
base classes of ZClasses



If you have anything to add and/or correct. Please mail it to me at 
maxm@mxm.dk

regards Max M