Sunday, June 13, 2010

Trapped on a local maximum

A few months ago my laptop died and after several futile attempts to resurrect it1 I finally let it go. So I purchased a new laptop, restored my data from the old one and proceeded to get it set up just the way I like it. This was going to be a long but enjoyable process. Finally though the Yak Shaving had to come to an end I had a project to get working on. It was a web project and I was going to use my de-facto choice, Python and TurboGears, but then I thought maybe I should reconsider my tool-kit. I never really considered using a language other than Python but on the web framework choice there was room to manoeuvre, or so I thought.

I was in a hurry, I had a project to get started on and the laptop saga had set me back significantly. So I decided to take a look at what many would consider the market leader in Python web frameworks: Django. No sooner than I had started going through the tutorial I was longing for TurboGears. I told myself that it might be worth it, the Django project seemed more active, the documentation significantly more complete and so on. As time was of the essence and motivation to learn something new lacking, I started my long overdue project using TurboGears and I was as happy as a Duck in water.

My reluctance to even take the time to learn another web framework got me thinking, what is it about TurboGears that I like so much? Sure I like the extra power SQLAlchemy brings to the party but other than that, in terms of fitness for purpose these web frameworks are pretty comparable. I came to the conclusion that TurboGears was just comfortingly familiar to me, not in a deep meaningful way, but rather in the most superficial way imaginable.

My programming experience until a few years ago was mainly with the the C family of languages with the majority of my professional programming life spent using Java and Java Enterprise Edition. When I thought about things in that context I realised I just wanted to stay true to the Java annotation and XML values instilled in me from my Java and JEE heritage. I just like the way TurboGears code looks, the @expose decorators remind me of Java annotations and the XML based templating engine reminds me of well... all those XML documents you have to create in a JEE application.

When I started using Python and TurboGears I think I subconsciously gravitated to what looked familiar. So even though I had taken the plunge and started using a dynamically typed language, perhaps I was trapped on a local maximum! Looking back over my code I was relieved to find that this is not the case. I write Python code in Python not Java code using Python syntax. It is funny though that I still and probably always will find @ symbols and angled brackets beautiful.

Update: August 2010
The internet allows us to collaborate with and befriend people in remote places, but I have always been a believer in meeting people face to face when ever possible. A few weeks ago I went to PyCon Ireland there I attended the Introduction to Django tutorial by Michael Twomey, it was a slightly informal walk through the basics of Django and some more advanced and very useful bits and bobs. Since then I have been able to work through the Django tutorial with much more success than before. A little bit of in person hand holding was all it took to get past the inertia that was holding me back.

1. Including foolishly replacing the motherboard which extended its life by about 6 weeks, instead of spending that €250 on maxing out a replacement.