Ruby or Python: Round Two!
Yesterday in my post about web development frameworks, I mentioned I would be revisiting my previous post on whether to learn Python or Ruby. So this post is a continuation of that earlier discussion. I’m bringing up the topic of Python or Ruby again as I have been thinking about web frameworks since watching Cal Henderson’s ‘Why I hate Django’ talk from DjangoCon 2008 at the weekend and then the ‘Snakes and Rubies’ presentation.
The availability of MVC oriented web frameworks for Python (Django) and Ruby (Ruby on Rails) was not something I had considered when making my earlier decision about which of these two languages to put time into learning. However now that the idea of writing a new version of this site in one of these new fangled MVC/ORM frameworks has occurred to me, I’d like to reconsider my earlier decision. I’ve done some Google searches on ‘Django or Ruby on Rails’ and have been reading through the results. One of the more interesting blog posts I found on Django, Rails and php (here) has lead me on to the videos of the ‘Snakes and Rubies’ presentations which are very informative and well worth watching (they can be found here).
So far after watching the Django presentation I must admit I’m loving a lot of what was demonstrated: automatic administration page generation, built in caching, URL pattern matching and templates which separate content and logic/code sounds ideal. The automatic generation of an administration interface sounds especially nice as writing an decent administration interface is very time consuming to do correctly. And these interfaces are not something the end users will generally ever see so it can fell like a lot of effort for a feature that is never appreciated by the general population only by the administrators. The template system sounds excellent as well as it means graphic/web designers can handle the design of the site without requiring programming knowledge or support.
I’ve now watched the Ruby presentation too and I have to admit it did not grab me as much as the Django presentation did. Beautiful code, which seemed to be the main selling point of the presentation is a wonderful thing. However features like administration interface generation, caching and templates are more attractive to me than being able to use fewer lines of code to do things.
To digress for a moment, I think that my lack of excitement at the concept of beautiful code as it was presented in the video, could be in part to me being mainly a C/C++ programmer: so beautiful code in the sense of code that does a lot of work in a few lines of source code is not something you see very often in C/C++. In fact in a lot of cases that particular brand of beautiful code is something you would be down right suspicious of in C/C++ but that is perhaps more due to the nonrestrictive nature of C/C++: its lack of hand holding or built in safety as a language. This lack of safety perhaps drives C/C++ programmers to be more obsessive about understanding what exactly their source code does under the hood to avoid unpleasant surprises later. This encourages a preference for easy to read and comprehend source code and perhaps promotes suspicion of ‘voodoo’ code that does allot of work in a few lines of usually harder to read code. In short beautiful code is a worthy goal but something I would personally be suspicious of but that is probably more due to my personal C/C++ baggage than any fault in Ruby.
Now back to Ruby on Rails or Django. Another thing which I had not really considered in my earlier post was which language had the best range of high quality libraries available. I had assumed that both languages would have a similar range of libraries available but so far my investigations seem to be pointing to Python as having more. Ruby does not seem to have as many available libraries, unless of course I’m using the wrong keywords when searching the ruby gems system and if that is actually the definitive library index for Ruby. This lack of libraries is quite a big deal to me, as I am a big fan of not reinventing the wheel unless it is absolutely necessary, so I like having lots of high quality libraries I can use. That also speeds up prototyping efforts as it is easier to hook up existing libraries than write the same functionality from scratch again yourself.
In summary when I consider learning Python or Ruby for scripting, rapid prototyping and with added dimension of writing a website with an MVC framework. I think I would now reverse my decision and learn Python rather than Ruby. If I was still just thinking about scripting and prototyping with these languages I would consider the two languages evenally matched. With Python having an advantage with the apparent range and quality of its libraries and Ruby having an advantage with its support of Public/Private class members which I am more comfortable with.
DjangoCon 2008: Why I hate Django.
This amusing keynote speech from DjangoCon 2008 by Cal Henderson is well worth a watch.








