Friday, August 05, 2005

Django vs. Zope3, or "The Right Web App Dev Platform"

development :: python :: zope 3 :: django



First of all, let me start off by saying that this is not a flame nor a
crusade :-) The title of this post needs to be taken in context: this
is about making the right choices for you, the developer. We are not
machines, we are quirky people, each with our own uniquenesses. The
choice of platform needs to be as much about what technology best fits
the needs of the project as well as that which fits the personality,
the strengths, and the weaknesses of the developer.

I just spent an interesting two days with django. Let me just say,
right off the bat: I like it, it's fun, it's cool. I like their site,
their growing docs (I've contributed a little to the wiki), the homey
feel of the project. I got my first little app up and running in no
time. Piece of cake, just as advertised.

However, for my second project, I wanted to do something a little
strange. Oddly enough, just the kind of irregular thing a client would
ask for. Thus began the headaches. I spent about 30 hours with my head
up against the wall. I will say that my primary problem was not
understanding the not-so-documented subtleties of django. Additionally,
I'm really not that good at database modeling. Object relational
mappers are cool (much better than having to write SQL), but to me, the
logical next step is to give up the ghost and use an object-oriented
database. For situations that require hard-core databases, hire the
dba/db designer, and do what's needed.

It was tough going. I really wanted to do some strange things, and
django didn't seem to be so flexible in different areas. And I think
that's actually something that the django developers have openly
stated. They have written and are targeting their software for a narrow
problem domain, a domain that brings them a lot of business and for
which there is great need.

I want to emphasize that I'm not a python or software noob. I've been
writing code, in one language or another, since 1981. I've been in the
industry since 1994. I've worked with twisted for a couple years, more
so recently. I regularly delve into its internals. I have a love/hate
relationship with Zope: I love z3 and hate Zope2. I spend a fair amount
of time digging through z3 code and find it (almost entirely)
delightful. However, I don't have any of that experience with django.
The source code doesn't make architectural sense to me. I guess I like
and use frameworks, and django's actually really an application and not
a framework. This is reflected in the code, and I have difficulty with
that.

So, as I slugged through the issues of bending django to my will, I
found myself wishing for things: what would it take to add ZPT support
to django's templating? Could a wrapper/adaptor be written for the ORM
so that ZODB could be used? Could the code be refactored to use
interfaces, adaptors and components? Yup. I was unconsciously trying to
rewrite djando into z3. However, this is also flattering to django: I
was trying to hang on as long as I could. Why? Well, it's got some
really cool things:

* a fantastic look and feel
* a slick admin interface generation (z3 has auto-generation of this
too, but it's not as pretty)
* really cool URL dispatcher for custom URLs perl application

Overall, they did some great work. They sell the point that you can
build apps in record time with django. And they're right -- you can.
But you know what else? I was able to build a project from the ground
up with z3 in two days -- and that *included* learning curve. No
kidding. Talk about rapid. I was stunned. In fact, after that
experience, I emailed several close developer friends of mine as well
as a few partner companies we consult for. I did a write-up on the
project and an analysis of the z3 development process and how it
benefits our timelines. The reason things went so smoothly with z3 is
because it's designed the way I think. By using a framework that
matches me so well, I move through code with zero resistance and get a
tremendous about of work done.

I'm not trying to sell z3 here. But, what I did discover with django
was that it's not my platform for web app dev: z3 is. This is because
of the kind of developer I am, the kind of code I like to work with,
and the kind of tools that allow me to be as productive as possible.
This combination of factors is different for different developers. As
many others in the community have pointed out, pick the right tools for
you and the job. There's a lot of hype about Rails, Django, etc., these
days; all the different web platforms available for python. People are
complaining about proliferation, but that's what drives evolution.
Software evolution has provided me with great business tools: twisted
and z3. What's it provided you?


2 comments:

Nando Quintana said...

Hi Duncan, thanks for the analysis. For some reasons, I have to dive into django...

I've been programming z2 for years (lately z3) and I feel really comfortable.

I suspect django (as I saw with turbogears) of being too complex for not-so-complex not-so-common apps.

I agree. There is no sense in starting another flame. :-)

tameritoke said...

People!
I am switching to python from PHP5 for one reason, the beautifulness and the absolute power the language has.

I have never seen something really nice. Too dump that I didn't start earlier.

However, Zope with the Component Model Architecture make me curious, what Django doesn't and for building multilanguage web apps, zope3 has everything out of the box.

However, at all for Zope, I wish it would had been much better documented. I printed the whole Zope3 book, and I wasn't getting smart. On the other side at bluebream (zope 3.5) the documentation is understandable.


Tamer