From: MikkelFJ Date: 2003-08-20T18:27:42+09:00 Subject: Re: What attracts me to Ruby "Ged Byrne" wrote in message news:20030820084950.29906.qmail@web10807.mail.yahoo.com... > Then I remember the guiding principle of Python: There > is only one way to do something. .... > 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. .... > Somehow, it all just works. Everything works nicely. In Ruby there are many ways to do things because there are many problems. But there is "The Ruby Way" which is not enforce by the language, but rather encouraged by the language. The Ruby Way means there is a natural way to do things given a specific problem and as long as you try to express your code as natural as possible, there really isn't a mess of different idioms where you have to be a specialist to understand it (well, you dive into some very complex aspects of Ruby but that is mostly for fun or for writing library code to add new advanced functionality). As always in programming there are many ways to do things at the larger design level. Ruby makes it easy to move source code through incarnations starting with a with lines of code growing into a few functions growing into a class then multiple classes and finally using observer patterns and what not. For small programs it is more natural just to write the code directly without any functions. For larger programs you need more structure and abstraction. The ability to easily grow programs and the friendly syntax I think is what appeals the most in Ruby. The $ syntax is widely recognized to be a mistake - it helps Perlers intially but it doesn't bring anything to the table you couldn't express easily in a cleaner syntax. I think it is fair to say that it is considered bad form to use $ in Ruby code, but then I guess many have just gotten used to it. Mikkel