I here it told that Ruby was, in part, an OO reaction to Python, i.e. that Matz didn't think Python was object oriented enough, and sought a better way. Python is certainly more functional (in the first class function sense) than Ruby -- indeed, methods just seem like syntacic sugar of functions over objects, with an implict self parameter instead of an explicit one. Objects themselves are little more than hashmaps.
But despite being a little hairier around the edges, I think Python's emphasis on first class functions over first class objects makes it more flexible. It's easier to manipulate methods in Python than it is in Ruby; in Ruby there's too much lambda/proc/block noise, and isn't so clear that methods on objects are simply functions with an implicit self parameter -- I'm not even sure that you can pull methods off objects in Ruby the way you can in Python, but then I haven't tried. Ruby encourages a more OOP perspective on things, which is not the case in Python.
It's also interesting to note that Django, perhaps in keeping with Python's relative hairyness, also doesn't bother with hiding too many nitty gritty details. In Django there just isn't as much magic. The request parameters get explicitly passed into the function, they don't magically appear. And it doesn't force you to do MVC. It's up to you. I heard one of the creators of Django say in a podcast, that he considers Django to be more like the factory for making the tools to make the product -- and a layer below Rails in abstraction.
Perhaps because I find it less magical and easier to understand, I prefer Django over Rails. It's not exactly a fair comparison, because my experience with Rails is limited to when I was young and foolish, but I would say that as a general principle, too much magic and you lose your way. I need to have my feet firmly on the ground; I want to know what's going on or else I feel out of control. I'm going to do another project in Rails; perhaps a website for my theorem prover, and in that sense I'll be giving it another chance -- but I think Django is the one for me.
It's also good to note that Python is considerably faster than Ruby.
Monday, October 6, 2008
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment