Sunday, October 7, 2007

Why Django is good for Python

So it is no secret that I love Plone the CMS, and I have been enjoying the past few days of getting into the Plone 3 way of doing things, which is really a Zope 3 way of doing things. However, Plone 3 is extremely complex, after all it is an enterprise level application with an enormous amount of flexibility and tools built into it such as the new KSS ajax framework. Plus, Zope itself is a gargantuan project. Plone uses Zope 2 + Zope 3 = Five. the mixing of the two Zope technologies are not very intuitive (IMHO). For instance, I'm still use to the Zope 2 approach to Plone, though I have played with Zope 3, which from a framework perspective is much better than Zope 2. But putting them together is making my brain hurt.

This steep learning curve, which feels now even steeper seems to make it hard to get new developers to utilize Python as web language over others such as PHP or ASP.NET. Of course this depends on what you are doing, but many developers I know argue that, they can do anything they need in .NET.

However, the Django framework seems to really make Python based web app development very intuitive. Now, it would take me forever to build in the same functionality with my Django app as I get out of the box with Plone/Zope, but Django's sensible structure and readability makes it a great environment for developers use to the PHP or ASP approaches.

For years this has been my primary gripe with Python. Though it is a great language, building web apps with Python has been horrible. With PHP I could get going immediately. Likewise, I learn by doing. All the PHP tutorials are designed to teach PHP programming in the context of web development. In a sense you get instant results. With Python you spend 80% of the time learning the spelling without producing anything.

However, with Django you start building apps immediately! In fact I was able to build a simple blog app within an hour or so using Django (BTW, VERY simple), similar to the time it takes me when using PHP. The cool thing is again, I can more readily use Python in my small web projects and stick with Plone for my larger projects. Pretty nice!

But if you are someone interested in learning Python then I would start with the Python Phrasebook and get cracking on the Django docs/tutorials. This is a very PHP way to go, but your code will benefit being object-centric from the get go, plus Django makes use of a nice ORM where as PHP seems lacking in this area.

Now, don't get me wrong don't let your PHP skills slack, despite my interest in Python most of the projects I get asked to work on are still focused on PHP and not Python. Yet that has been changing and knowing Python and understanding the power of a framework like Django or an application like Plone gives you some flexibility.

No comments: