[Zope] Implementation Alternatives Question

James W. Howe jwh@allencreek.com
Thu, 27 Jan 2000 11:20:13 -0500


I'm working on a site to display news articles.  There are a handful of 
different "sections" to the site, each with it's own look.  For the most 
part they look the same but there are subtle differences.  A title or 
graphic might change, some subnavigation might be different, etc.  As 
currently implemented, I've just defined Folders which contain a set of 
DTMLMethods which define the layout.  After doing two or three I see that 
the content of these folders is almost identical.  I realize that I could 
factor out the common stuff and move it to the root folder, but I'm not 
thrilled with cluttering my root with stuff which is only applicable to a 
subset of lower elements.

What I'm currently experimenting with is defining a ZClass for a "Content 
Viewer" folderish object.  The ZClass would contain definitions for the 
common methods.  The variability between looks can mostly be accomplished 
by using different property value settings for each individual ZClass 
instance.  My current quandary is what to do when a property change isn't 
sufficient.  If I were doing this in Smalltalk or Java, I would simply 
subclass my folder viewer and override any methods that I needed.  I know 
that I can do something similar with ZClasses but I'm wondering if that is 
a good approach for Zope.

Given what I want to do, I see three basic alternatives:

1. Move common functionality up to the root folder.

2. Define a ZClass and subclass with other ZClasses as necessary to get a 
combination of variability while obeying the "once and only once" rule of 
good OO programming.

3. Do the subclassing via Python and create a flat ZClass structure within 
Zope.

Are there any other options?  What are the pros and cons of each option?

Any input would be helpful.

Thanks.

James W. Howe				mailto:jwh@allencreek.com
Allen Creek Software, Inc.		pgpkey: http://ic.net/~jwh/pgpkey.html		
Ann Arbor, MI  48103