[Zope-dev] Abstract ZClasses

Dieter Maurer dieter@handshake.de
Wed, 2 Aug 2000 22:29:57 +0200


I would find an abstract ZClass (or Meta ZClass) concept
very nice (and useful).

I would like to use it, e.g., for a general hieararchical view on relational
databases. The view allows browsing (via the tree tag) and selection
of one or more items.
Most can be implemented independantly of the specific hierarchical
relation inside the database. A few parameters and the
SQL method are dependant on the database tables.
A few others are still more specific, e.g. tree display style
and single/multiple selection.

Thus, I would prefer the following structure:

HV: generic Hierarchical View -- abstract
      defines the interface and a minimal set
      of required properties and methods
      implements most of the functions


HV_T1, HV_T2, ...: Hierarchical View specialized for a specific
      hierarchical relation
      this (standard) ZClasses define the SQL method and
      instantiate some parameters of HV

i_T1_1, i_T2_2, ...: Instances of HV_T1
      more specializations (parameters, presentation methods).


Most can be done with the current ZClass architecture:
  the intermediate ZClasses HV_T1, ... are all
  derived from ZClass HV. The instances are instances
  of the intermediate ZClasses.
There are 2 exceptions:

 * HV_T1 cannot specialize properties of HV.
   They can be specialized in the instances of HV_T1,
   but it would be nice, if it could be done in the class,
   if all/most instances share the same value.

   Workaround: do it in the HV_T1 constructor.

 * Instances can override property values but not methods.
   Trying to add a method overriding a default class behaviour
   results in an "Id already exists" error.

   Workaround: give the overriding method a different name
     and let the default method look whether something overriding
     exists.


What do you think about abstract (or Meta) ZClasses?


Dieter