Entries For: September 2006
2006-09-09
First steps with Django
Django and Plone are both kind of Python web development platforms. Plone is an old timer, huge mature content management system monster. Django is a light web development platform. Though they don't serve the same purpose, comparing technologies in them might shed light on some issues.
On the blue corner...
Django is a web development framework. You can easily implement small site functionality on it. Django has a bit hype around it now when the father of Python, Guido van Rossum, named it as the preferred framework for Python web development.
Plone content management system/(running on Zope application server) is complete content management solutions which ships with tons of stuff like permissions. workflows, complete skinnable UI. Plone has been here for years, there are a lot of real companies doing web development and some developers estimated Plone installation base be several thousands.
Naturally both are open source.
Common for both of these web platforms is that they are based on Python programming language. Currently, Python is my favorite as a wrist saving language. Python has compact, easy-to-read, syntax: You type less - you are more productive.
Test-fix-restart
Plone takes aeons to boot (it loads nearly 10 MB Python code to memory). This makes Python code debugging painful, even on the latest monster machines. (Note: this doesn't concern CSS/HTML development). Plone used to have on-the-fly code replacing, but with the latest Plone/Zope versions it usually fails due to Zope 3 dependencies. Zope 3/Five doesn't support hot replacing code, does it?
Django boots in one second.
The best of both
Django doesn't have a hiearchial content tree which makes things like automatic navigation trees, permission inheritance, etc. difficult. On the other hand, a big part of Plone codebase internals deal with acquistision: you have extra things to worry about.
Django is good when you don't need through-the-web content editing, the content is mostly static and there aren't many people working on your site (permissions).
Also, Django is based on traditional relational SQL databases. Plone's object-oriented Zope database, though is better for hierarchial content like most of CMS deal with, is simply weird. This scares off management people.
Why Zope backend is better for CMS? For example, it has field level automatic permission support, hiearchy (SQL doesn't do trees very well) and built-in capabilities to deal with HTML (e.g in search). The high level of integration is also needed when building very high performance sites - tuning database access on product level à la Plone's Cache-Fu product is the only way to achieve high level dynamic performance for content.
Hype(r)space
Even though Plone is an old project, it lacks the marketing it deserves. Plone is tons of times more mature than Ruby on Rails & co. but when you mention Plone everyone is like "huh?". People even know Django better. I wonder where Plone would be today if it had buzz around it like RoR or Django.
Common woes
Let's hope that organic growth, one of my favorite topics, don't harm Django codebase as much as it has harmed Plone. Looks like Django already had some mixed styles in its coding conventions.
Organical growth problems in open source codebases
Problems with evolutionary codebases in the open source world
I have been working with few Python based open source projects (Plone, Zope, Django and Python itself, all community driven) and then with Java projects (Eclipse, IBM led).
- Community driven code borns through natural evolution
- Corporate driven code borns through design and discipline
- If there are big payrolls involved someone is usually paid to create documentation and there might be even useful comments in the source code due to formal reviews. Less try-to-see-how-it-works, less dive-into-source, less headache.
- The style is consistent. You don't see code like MyClass. my_function(). getAnotherFunction(). isthisreasonable(). Java has standard coding conventions, when Python lacks them. The result is eye hurting soup to read. Since good auto complete is nearly impossible to implement in Python IDEs, double checking function naming is even more PITA.
- More polish. You won't find XXX, TODO, etc. in code in a critical moment when you thought the subsystem was already working
- After things are once done without too much thinking, phasing them out is difficult. "This method will be deprecated" warnings may stay in the code many years.
I have myself patched some Plone products. It's very unmotivating when your freshly baked cake gets tossed away when the codebase maintainers point things you are not interested in and thus your patches are rejected.