[Twisted-Python] Status of components, protocols, etc in Twisted

Terry Jones tcj25 at cam.ac.uk
Sun Apr 30 19:09:00 MDT 2006


I'm trying to better understand componentized architectures, protocols,
adaptors etc., as done in Python. I've been reading around and have a few
questions about the state of play. It would be good to understand where
things are, and where they're heading.

It seems there are (or were) 3 efforts to provide components, protocols,
adaptors, etc.: Zope, Twisted, PyProtocols.

It looks like Twisted is now using the zope module to do this. But I also
ran across discussion (on this list, in Feb 2004, I think), about possibly
migrating zope's use of components to PyProtocols. Did that happen?

I do like the sound of PyProtocols (and PEAK in general), but as someone
else said, and as Philip wrote, the documentation isn't really focused on
easing in a newbie.  A couple of points on those docs, I think it would be
good if someone set out how you would go about building something small
(i.e., small concrete examples, not "big" more abstract ones). Yes, that
someone could be me, agreed. Also, the docs say that it is intended that
_all_ uses of type(), isinstance() etc., can/should be replaced. A few use
cases would be helpful - how are we supposed to replace those things? I do
have the impression that one should have a clean componentized design from
the beginning and thereby never need or want to resort to introspection. If
that's the case, it might be worth saying, as the docs leave one wondering
if there's not perhaps some formulaic way to rewrite one's code to do the
Right Thing.  It's not that simple though, right?

I'd also be happy to use the standard Twisted (i.e., zope) approach too.

Do people have an opinion about which is better to use? Does it make much
difference if you're just building a simple app with a handful of
components you'd like to be able to swap in & out easily?

I think the Twisted evolution of finger pages are really good, with a
couple of minor weak points (e.g., highlighting new code from example to
example). It's amazing what you can get done in a couple of hundred lines
of Twisted code. BTW, there's a mention of __implements__ whereas
implements() is used, which I guess is a hang over from an earlier version?
This is on
http://twistedmatrix.com/projects/core/documentation/howto/tutorial/components.html
I guess someone will look for others. Grepping __implements__ gets a lot of
hits in the distributed Twisted-2.2.0 docs (e.g., in doc/howto/*.html).

Anyway, thanks for all the docs and code. I'm happy to put some work into
making improvements where I can.

Terry




More information about the Twisted-Python mailing list