[Zope] any design patterns in building zope apps?
Dylan Reinhardt
zope at dylanreinhardt.com
Fri Dec 12 13:10:31 EST 2003
On Fri, 2003-12-12 at 08:16, harry_potter wrote:
> In J2EE, there is a recommended set of Design Patterns
> for each tier, such as FrontController, Business
> Delegate, Service Locator and DataAccessObjects. Is
> there such collection of 'patterns' being recommended
> for zope apps?
Yes and no.
On the one hand, many of Zope's built-in object correspond with
well-worn patterns on other platforms. If using a ZSQL object
constitutes usage of the DataAccessObject pattern, then I guess you're
using a pattern. Digging in to Zope's code, you'll see factory methods,
massive reliance on composition, chains of responsibility, etc.
Your knowledge of patterns should make many of Zope's conventions easy
to understand. But pattern usage within Zope is almost redundant, given
how many common patterns it already implements for you. You rarely hear
patterns mentioned however... IMO, that's because using Zope feels less
like using patterns and more like using tools.
> >From what I understand, Zope does encourage MVC
> framework by separating presentation, biz and data
> logic, e.g. PageTemplates, Products/ExternalMethods
> and ZSQL Methods(correct me if I'm wrong).
You're right so far.
> Can we use
> PageTemplates in the form of Controller/DispatchView
> pattern?
It may make more sense to think more simply than that. Templates create
interfaces, scripts perform logic, ZSQL connects to external data
stores, etc. The ways in which you deploy those resources is entirely
up to you.
> Can Products be used in BusinessDelegate/
> SessionFacade type of pattern?
Products provide a way to collect logic, interfaces and just about
anything else in a single object type. They can range in use from a
simple wrapper on a library function to a full-fledged application.
HTH,
Dylan
More information about the Zope
mailing list