Ruby is the language I am always putting off to learning the next day. I came across Ruby almost at the same time I started learning Python. However due to its similarities with Perl, I was never able to take an affinity towards the language.
I knew Ruby needed to be in my toolbox of languages and it was only a matter of time before I got to it. This happened last week, trying to solve a very practical programming problem.
I was trying to develop a Javascript parser/tokenizer for HarvestMan so that HarvestMan can crawl pages which defines the DOM dynamically using Javascript. I have been at this problem for some time now, but never came across a pure Python or even a C/C++ extension Javascript parser I could use. Last week I came across
Rbnarcissus, a pure Ruby port of
Narcissus, the open source Javascript engine written in Javascript.
I have set upon myself the task of porting this code to pure Python. I figured I knew enough Ruby to do this without any additional help, but one look at the code and I realized I needed help. I bought Hal Fulton's excellent Ruby book
The Ruby Way from a book shop. (The book is a bit pricey for a low priced Indian edition, but it is worth the money.)
I have been spending the last two days with the book. I have realized a few things about the
The Ruby Way when compared to the
Zen of Python.
1. Ruby follows the Perl paradigm of
There is more than one obvious way to do it, when compared to the Pythonic
There should be one-- and preferably only one --obvious way to do it. (An
import this in a Python interpreter prompt gives you the Zen of Python).
2. Ruby is a more complete object oriented language than Python and empowers its types and objects much more than Python does. However this also makes Ruby slightly more harder to learn than Python.
I feel Python is still the ideal language for a newbie who wants to learn a very high level programming language. However Ruby is much more powerful and suited for the expert programmer who expects more power out of his objects and types.
I have not got completely into the Ruby Way yet, but I am on my way. I am hoping that combining the Ruby Way with the Zen of Python will lead me to the Tao of Programming...