04 February 2006 10 comments Python
There's been a lot of debate in the python blog community about which web framework is best for everyone else. There's also been a hot debate about templating languages much fueled by Guido's rejection of XMLish requirements. In the few blogs I've followed there seems to be a couple of finalists that deserve extra scrutiny: Zope3, Django and TurboGears.
I'm drooling over all of them. Zope3 feels like a wise granddad with vigour, Django as a bubblegum-chewing teenager with lots of energy and TurboGears as something in between. (if Twisted was to get an analogy it'd be Einstein or someone like that) I want to use all three or at least Zope3 and one of Django or TurboGears depending on the project. Stuff that needs thinking and will have to last and scale: Zope3. Quick and simple websites about a single topic: Django/TurboGears.
To the point, I ran a sloccount on django (from SVN), Zope 3.2.0 (for zope.org) and TurboGears 0.8.8 (from turbogears.org). The difference is big. Here are the results:
TURBOGEARS 8.8 python: 26976 (99.55%) sh: 123 (0.45%) Total Physical Source Lines of Code (SLOC) = 27,099 DJANGO (SVN) python: 17720 (100.00%) Total Physical Source Lines of Code (SLOC) = 17,720 ZOPE 3.2.0 python: 362334 (96.47%) ansic: 13058 (3.48%) sh: 178 (0.05%) perl: 37 (0.01%) Total Physical Source Lines of Code (SLOC) = 375,607
(all values excluding blank lines but including comments) This really has to be taken with a pinch of salt because Zope 2.8 weights in at about 270,000 loc and even though it accomplishes a lot it's not going to get much better. Also, bare in mind that Zope3's .py files comes with a little licensing comment at the beginning of almost all files which I estimate to amount to about 40,000 loc.
Zope3 is shipped with about 8,032 unit tests which takes up a lot of the total 375,000 but I don't know how much, but it doesn't matter because unit tests are valuable code just like comments are valuable too.
Does this make Zope3 a bloated beast? NO! Remember that unlike Zope2, Zope3 hasn't organically evolved but has been designed more or less from nothing but inspiration and thought. One of it's core features is the component architecture which puts in plenty of padding between the modules. Does this make Django/TurboGears a quick hack with a lot of hype? NO! If you listen to people who've actually used these, they do get things done and remember that many websites needn't be as complicated as Windows Update or Yahoo!. But, do appreciate the incredible power that this gives a Zope3 user. Imagine how many todo-list screencasts 375,000 lines of code would correspond to if TurboGears's video was 20 minutes for 27,000 lines of code. (hint: the answer is 4.5 hours)
Errata. Zope 3.2.0 source package comes with 8,032 unit tests, not 1,800 like I wrote the first time. Sh*t! That's a lot of unit tests. How can that not be pythonic? :)Follow @peterbe on Twitter