I’ve played with both Rails and CakePHP and found them both to be awesome development environments. However, after a few frustrating weeks of dealing with other’s PHP code (not related to CakePHP), I’ve determine that PHP is the equivalent of today’s Perl (Perl lovers will hate this analogy). Perl allowed anyone to create great scripts that did awesome things. However, in the hands of a novice, Perl allowed for some pretty atrocious code.
Determined to never code in PHP again, I set out to choose between Ruby and Python. Both have very powerful feature sets for languages that are for the most part scripting languages. Many things went into the decision - a topic for another blog post, but I decided Python was the language I wanted to use moving forward.I had played with Python in the past, but in a few short days I went through the first 9 sections of the tutorial at python.org. Having coded for the better part of 10 years, it wasn’t difficult to pick up.
Immediately after this course, I jumped into Django. Django is the Python equivalent of Rails (Rails uses Ruby) or CakePHP for PHP. It has many similarities to Rails and a few differences. I’m still in the early learning stages of Django and only made it through the Pragmatic Programmer book with Rails, so I’d say I’m not yet qualified to compare and contrast the differences completely.
Two of the biggest differences from a development standpoint is URL handling and AJAX. URL handing is handled manually with Django and automatically with Rails. Handling URLs manually allows the developer to do some pretty amazing things, but it requires the developer to maintain url.py files. As far as AJAX, Rails has built in support meaning you are tied to the Prototype JavaScript library while Django allows the developer to use their own library of choice - I prefer jQuery. This choice means you have to handle all the AJAX yourself rather than leaving it to the framework. However, using views this is pretty painless in Django (views are equivalent to controllers in Rails).
Hosting is another difference to consider. I won’t go into all the ways that one could run Rails or Django, but I will say the most popular method for Django is mod_python for Apache. However, most web hosts don’t offer this as a default. And because of the popularity that Rails has achieved, more hosts are offering Rails hosting more than mod_python hosting. A lot more could be said on this topic.
All in all, I think either choice has some pros and cons. Hopefully more and more developers will migrate to one or the other and leave PHP behind. Good PHP developers will love the power and true object oriented nature of both Python and Ruby. Bad PHP developers should leave the coding up to professionals.
1 response so far ↓
1 Gaurang // Sep 30, 2007 at 3:58 am
Hi — I would be very much interested in knowing why you chose Python over Ruby? Would be great if you can make a nice little post on that issue!
Thanks for all the info you have on your blog - it helps the community..
Leave a Comment