As a newbie moving over from Python, the recent posts
regarding Python vs Ruby has set me thinking.  On the
surface Ruby and Python seem so similar, so why are
they fundamentally so different?

Then I remember the guiding principle of Python: There
is only one way to do something.

http://t2.technion.ac.il/~shlomif/humour/ways_to_do_it.html

This philosophy appealled to me in the beginning.  I
started using Python because I felt so frustrated with
Perl.  While I found Perl, with its philosophy of
'There is more than one way to do somehting, so
frustrating.  Even though I had become quite skillful
at writing my own scripts for munging data, I still
couldn't understand anybody elses.  After a couple of
years casual useage I'm still no closer to
understanding anything from CSPAN.

Python seemed better for larger scripts, but I found
that I was soon having to use a pile of clumsy idioms,
such as deliberately using exceptions to exit loops. 
The restrictions of Python have the same problem as
Java and VB (though not as bad).  Things like having
to use while 1 ... break annoyed me.  Would it really
hurt to add 'until' to the syntax? 

The remarkable thing about Ruby is that it takes
Perl's
philosophy of having many ways to do something.  I can
use a code block, I can use a for loop, I can use
small talk style iterators.  The context variables
like $_ are available, just like Perl.
    
All of this should result in a hodge podge of a
language.  Mixing all of these methods should result
in illegible code.  Having to remember all of these
approaches should be a nightmare for the newcomer.
    
Somehow, it all just works.  Everything works nicely. 
After a few weeks and reading the book, I find my
scripts running as expected first time.  I even find
myself mixing {}s with do...ends with yields without
really thinking about it.  I had expected that I would
choose the method I liked best and use mainly that
method.  To my surprice, it all comes naturally (is
this violating the principle of least suprise? :)

Probably the most amazing thing was that with just two
weeks experience I was able to delve into the Standard
Library and understand the code.  The stuff I didn't
understand was down to OO plumbing, and not obscure
syntax.  On top of this, my questions were patiantly
answered on this list within seconds.
    
The only other language I can understand the Standard
Libaray's source for is Java.  The problem there is
that while I can understand exactly what the code is
doing, I find it hard to grasp why.  Getting an
overview from Java source is a nightmare.
    
With ruby, not only could I understand what the code
was doing, I could also see how the objects were all
interacting.  I've never been able to do this before
in any language.

It seems to me that Ruby has a big, big future ahead
if my experiences are in any way typical.



________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/