Disappointed by Ruby
Posted by Nils Sat, 08 Sep 2007 14:17:00 GMT
First of all I don't dislike Ruby or think it's a "bad" langauge. The problem I have with Ruby is just that it offers nothing new compared to languages like Python, Perl, Java and c#.
Comparing it to Python
I learnt Ruby because I wanted to learn Ruby on Rails, so I learnt it while learning the Rails framework at the same time. By the way if you want to learn Rails too, I recommend you to read "Agile Web Development with Rails", which is really a great book. I've noticed that Ruby is very similar to Python in some ways:
a = 1
print "Blah" + a
If you try this you get: TypeError: can't convert Fixnum into String
It's easy to see that you need to cast Fixnum into a String. This can be done using the .to_s method (or str(a) in Python)
If you do this in Python you also have to convert the Integer into a String. The question is just, why isn't this done automatically. (like in Java, C#)
Like Python it also comes with an interacive shell (irb), however the tab completition did not work as good as in Python and I also miss the doc Strings. For example, if you have a method or an object in Python, that you don't know exactly what it does (or is), you can learn this very easy by typing:
>>> print a.__doc__
int(x[, base]) -> integer
In Ruby you have to start ri and wait or use google.
Also I miss Pythons in keyword, which for example checks if something is in a list.
>>> a = [1,2,3]
>>> 2 in a
True
So far I used Ruby on Rails for two projects. And while I had to figure out, how I can do things in Ruby, I saw that Ruby differs from other langagues. (like the 3 way logic: true, false and nil) But I didn't find anything, which made it more desirable to use then other langauges.
Why Ruby?
The reasons to use Ruby I found so far are:- Ruby on Rail ;-)
- The syntax is interesting, you can write very well readable programms
- Regex and things are easy to use (but they are in Python, PHP, etc too..)
Conclusion
Maybe I'm just disappointed, because I just learnt the langauge by using it and used it because I had to.. However I hope that some of the Ruby fans are able to give me examples, how I can do things in Ruby much faster, bettter, etc then in other languages.


