From: Gregory Seidman Date: 2008-03-16T00:03:08+09:00 Subject: Re: What is Ruby's biggest strength ? On Sat, Mar 15, 2008 at 10:05:45AM +0900, 7stud -- wrote: > Marc Heiler wrote: > >> What helps Ruby stronger than other programming languages > > > > These days, I would give the following reasons for ruby: > > > > - Extremely clean code compared to the other languages I know/look at. > > In my opinion that is a a lie perpetuated by the ruby community. In my > opinion, ruby syntax is ugly. But even if you think the syntax is > clean, ruby is all about cramming 4 or 5 function calls into one line > and sprinkling some regex's in for spice, which is creates an > indecipherable mess. I've never encountered any language that is coded > so poorly by its community. Most of the code I see posted is very hard > to decipher, but if you say perl is worse, I'll believe you. Actually, I think you're seeing a strength and misinterpreting it. The advantage of being able to express things tersely is that when you have a page of code on your screen (or printed out, if you prefer) you can grasp a lot of what's going on. This often comes up when comparing Java with other languages (even C++); Java advocates point to IDEs with code completion and generation as offsetting the time it takes to write the numerous lines of code it takes to express functionality, ignoring the much more important aspect of understanding all those lines of code. Now, this can't be taken to absurd extremes. Long, descriptive variable and method names make the code easier to understand, and are more valuable than less descriptive names even though they shorten the code. What you may also be seeing is a more functional programming style, where methods are chained one after the other. This, too, is a strength rather than a weakness. Thinking in terms of dataflow, which is just another way of talking about functional programming, is very effective for understanding what kind of data is being taken in, how it's being processed, and what the result will be. It is a terse (but clear) expression of functionality. I'll also point out that much of the code you see posted is from people who are just learning how to work with Ruby, and are looking for help with that code; it's unsurprising that it would be poorly written. Most of the gems that are out there, particularly those that have reached a 1.x version, are much better written. --Greg