[Zope] product organization

Dieter Maurer dieter at handshake.de
Wed Jul 27 13:26:30 EDT 2005


Nicholas Wieland wrote at 2005-7-27 13:54 +0200:
>Well, not exactly - just a way to separate access to data from everything else in the product.
>Maybe a separate class that needs the connection as argument and that just returns the data I need in appropriate data structures by calling class methods.
> 
>class DataModel (object):
> 
>  def __init__ (self, conn):
>    self.conn = conn
>    self.sqlFetchSomething = SQL (.....)

I think, a class variable "sqlFetchSomething" would do a better
job -- unless "SQL" depends on "conn".

Advantages:

  *  fewer objects in the ZODB, fewer loads, faster operations

  *  easier evolution of your SQL (in you need to change the
     SQL executed)


-- 
Dieter


More information about the Zope mailing list