hancock at anansispaceworks.com
Tue Jun 27 23:53:26 EDT 2006
I'm trying to find the right place to ask this question.
I learned interface/component/adapter methods originally while
working with Zope and Zope3, and found them to be extremely
useful. However, they are kind of a pain to install separately from
While working on another project (Python Universe Builder,
http://py-universe.sf.net), a collaborator wanted to use PyProtocols'
interface system, and so I've been trying to use that instead.
My initial impression from the docs was that PyProtocols was
pretty much a full superset of Zope's interfaces, so it would be
fairly simple for me to use.
However, I'm running into walls at this point because some of
the most basic things I use interfaces for don't seem to be
available with PyProtocols:
1) First of all, there's no "verify" methods or functions to check
that an object really provides the attributes, methods, and
method signatures that its interface declaration says it does.
This is basically the entire reason for using interfaces as
far as I am concerned, so I'm shocked to find this missing.
2) So, I figure I'll need to write that. But whereas Zope interfaces
provide excellent methods for interrogating the interface to
see what it expects to be there, I find that there are no such
methods on PyProtocols interfaces. Which means that writing
a verifier is oddly difficult.
Going back to the PyProtocols documentation, I begin to see
that adaptation based solely on the assertions in the code seems
to be the driving idea behind PyProtocols, and it seems to
ignore other uses of interfaces.
But that leaves a major gaping hole in my QA process. For me,
one of the most important roles of interfaces is as testing tool
to make sure that I really do have consistent interfaces between
objects. This has been a big time-saver on previous projects.
This becomes even more important when you have the situation
that I do, where there's going to be multiple objects, probably
written by different people, that have to conform to different
interfaces. But really, it's useful even when it's just me.
So, I'm starting to wonder if we're making a mistake by using
PyProtocols' interfaces. And if we are, then what *should* we be
using? Is there something out there that is a full superset of
both PyProtocols and Zope interfaces? Should I be looking at
Twisted (never touched that as yet)? Is there something else
entirely I should be looking at?
Recommendations would be appreciated.
Terry Hancock (hancock at AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com
More information about the PEAK