A painting of me

Ruby & Python

   9 May 2008, early morning

Tyler mentioned on his blog, in passing, that one reason he likes jQuery more than Prototype is that the formers syntax is a bit object-oriented.

prototype has syntax which strikes me as antithetical to OO principals. for example, Element.hide(‘comments’) instead of $(’#comments’).hide().

I was thinking about the above while writing some Python code at work. I now prefer Ruby to Python, but it took a little while for me to warm up to Ruby. Ruby has a very terse syntax, and there is a lot of room in the language to write programs that look like that are composed of magic and pixie dust. (This is especially true when you look at Rails code.) Once you have written a few programs in Ruby it is a bit easier to see what’s up: where people have decided to leave brackets off, etc. Ultimately I prefer Ruby because if I want to know how long a list is, I can do so as follows: [1,2,3].length(). In Python, the same task is accomplished as follows: len([1,2,3]). The later just seems ass-backwards to me now.

(Python’s object-oriented programming support seems pretty half-assed, but I’m no expert in the language so my opinions of it may stem from my ignorance more than anything else. Still, what’s with all the self parameters. And __init__? Come on, you can do better than that.)

|  

Comments

Don't be shy, you can comment too!

 
Some things to keep in mind: You can style comments using Textile. In particular, *text* will get turned into text and _text_ will get turned into text. You can post a link using the command "linktext":link, so something like "google":http://www.google.com will get turned in to google. I may erase off-topic comments, or edit poorly formatted comments; I do this very rarely.