ZODB: Quixote vs. Twisted

Graham Fawcett graham__fawcett at hotmail.com
Wed Apr 2 10:50:38 EST 2003


Hi Thomas,

Thomas Guettler wrote:

>I just saw your message called "Quixote Server on top of Twisted
Python"
>in Quixote-Users of last week.
>
>What is your intend of doing this? Do you want to use PTL, or do you
want
>use it to use ZODB? I haven't looked at twisted in detail, but it
should
>be possible to use twisted with ZODB without quixotte, too.
>

The short answer: modularity. I want to build systems with components
that each do one thing, and do that thing well.

Now the long answer... ;-)

I look at Twisted as a Web server written in Python, and nothing more.
Twisted is an excellent general-purpose networking framework. Twisted
certainly is  more than that, for example, it has its own Web
application framework (the twisted.web package) that provides form
"widgets" and other conveniences for application programmers. But, I
don't want it to be all of that -- that's serving multiple purposes.

That's not good separation of concerns, IMHO. If I write an
application based on the twisted.web framework, then I am commited to
running that application on a Twisted Web server -- I can't swap out
Twisted and swap in another Web server if the need arises. For
example, if I needed to move to HTTPS, the easiest way for me to do it
would be to move the application to an Apache server that already had
HTTPS installed and configured. But I couldn't easily do this because
of my application's dependency on Twisted as a *Web server*, not just
as an *application framework*.

Quixote is not a Web server, and it doesn't care what Web server you
use. There is a bias toward Apache, I think mainly because that's what
the principal developers use. But this bias hasn't affected the
framework, it's truly server-agnostic.

Andrew Kuchling added a "driver" to let Quixote run on the Medusa Web
server. My script is (hopefully) the starting point of a similar
"driver" to let Quixote run on top of the Twisted Web server. (There
is another, probably better, way to do this: see the other discussion
on the quixote-users list in March re: the SCGI approach.)

So:

Twisted gives me a Web server. I disregard its Web application
framework. So I have a component that does a single thing well.

Quixote gives me a Web application framework. It interoperates with
(conceivably) any Web server, giving me great portability. Again, a
single thing well.

Lastly, the application I wrote makes use of ZODB. I love not having
to worry about persistence, and the design and performance of ZODB are
suitable for my application. And again, ZODB does persistence -- and
nothing else -- very well.

That approach minimizes my application's dependencies on other
people's code. Yes, my app depends on Quixote, but it doesn't depend
on any given Web server: I can use any one that suits my requirements.
Similarly it depends on ZODB, but the back-end of ZODB could be a
FileStorage, a BerkeleyDB, or anything else ZODB supports.

In support of Quixote, it is the cleanest Web app framework I've seen.
It's simple. It lets me do my work, and doesn't get in my way while
I'm doing it. It vanishes into the background, like any good framework
should.

Lastly -- and very importantly, I think -- you can read the Quixote
source in a couple of hours, and understand it from top to bottom,
inside and out. I tried that once with Zope2, and the nightmares
haven't gone away yet. Hopefully Zope3 will be more readable, but I
think you'd need a bit more time to understand what it's doing
underneath the surface.

Hope that helps,

-- Graham




More information about the Python-list mailing list