[Zope] Problem Creating Instances Mysteriously Solved

Dan Shafer pydan@danshafer.com
Sat, 20 Apr 2002 14:50:52 -0700


I spent some time this afternoon after my last post on this topic messaging 
back and forth with my friend and colleague Kevin Altis of PythonCard fame. 
I think I understand better now how to proceed with this project, at least 
*one* way to proceed better.

I was making the classic programming error of letting implementation drive 
design. I don't *need* objects here. I can store all of the data I need 
stored in standard Zope objects and then use Python and DTML to manipulate 
their contents. I had allowed myself to become convinced that to "create a 
new clearing" of necessity meant creating a new clearing *object*. But a 
Clearing could be a structured document (XML), a collection of SQL database 
records or, as it turns out after only a little experimentation on my part, 
a collection of folderish Zope objects and documents manipulated directly 
through DTML (setting properties, etc.)

IOW, no need for custom classes, just extend the built-in classes via 
properties which can be set in DTML methods and Python scripts.

This is clearly no less OO than my original approach, but it will be 
several orders of magnitude easier to write and maintain. I'll probably 
finish this project now in about 10%of the time I've already spent just 
trying to get ZClasses working to my satisfaction.

Lesson learned. If it seems too hard, it probably is.

Thanks to Chris Weathers, Dieter Maurer, and others on this list for their 
help and insights. This is a fantastic community demonstrating once again 
why Zope rules.