Dismissing programming languages
Jeff Atwood recently posted on his blog about the Wide Finder project, a project that Tim Bray initiated to discover if we can write parallel applications without significantly altering the way we write sequential applications. The project is interesting but, unfortunately, that’s not the subject of this post. I suggest if you are interested you go check it out.
As part of the original Wide Finder project Tim Bray used a naive Ruby implementation as a specification for the project:
counts = {} counts.default = 0 ARGF.each_line do |line| if line =~ %r{GET /ongoing/When/\d\d\dx/(\d\d\d\d/\d\d/\d\d/[^ .]+) } counts[$1] += 1 end end keys_by_count = counts.keys.sort { |a, b| counts[b] <=> counts[a] } keys_by_count[0 .. 9].each do |key| puts "#{counts[key]}: #{key}" end
It’s not the most penetrable code I’ve ever read! But most of this is thanks to the regular expression, and that would look the same in any language.
Jeff quoted this code snippet in his post, alongside this remark:
Tim calls Ruby “the most readable of languages”; I think that’s a bit of a stretch
Unfortunately, most of the commenters are people that have picked up on this digression and decided to chime in with their reasons for disliking Ruby. Jeff never said he disliked Ruby, of course, but plenty of people seem to be agreeing with him that Ruby sucks.
As you might know I’m a fan of Ruby so I’m hardly an impartial observer, but what frustrates me is that a programmer can so easily dismiss any programming language.
It’s true that Ruby does not have any new features; it takes object-oriented elements from Smalltalk, functional programming from Lisp and syntax from Perl and Python. The syntax might not be C syntax, as many commenters seem to wish (as though this were an objective worth pursuing!!), instead it is designed to capture the essence of the program, rather than forcing you to go to unnecessary lengths in order to perform simple tasks. (Thanks to Ola Bini for putting this so eloquently!)
The ease with which so many people can dismiss a language like Ruby offends me. In a sense programming languages are like an ecosystem. While one language flourishes other languages compete and develop on the fringes, until the climate changes and suddenly, for one reason or another, the fringe language is more preferable. While Java and C# might currently be the dominant languages, dismissing those languages on the fringes is, in my opinion, a dangerous thing for a developer to do. Who knows when the climate will change?
I had trouble parsing the Ruby example, which is why I objected a little to Tim’s comment, but it’s such a simple program that it’s not *that* hard to figure out.
It did surprise me, however, that so many commenters reacted so negatively to this tiny code sample.
BTW, great design on your blog!
Jeff Atwoodon Friday, 20th June 2008 at 07:45
Hi Jeff, thanks very much! I’m glad you like the design.
I agree, Tim’s code is hard to digest at first glance. Besides the regular expression there’s also the combination of both
do .. endand curly braces to express blocks. Maybe this is an instance of using coding conventions as signals, but I’m not 100% sure!I’m still surprised by the reaction so many people had to such a small sample of the language. As I read through the post I expected the comments would be overwhelmed by flames from Ruby fans defending their language.
I hope that as Ruby matures it will gain acceptance from the wider programming community but, if it doesn’t, then I guess there is no real harm!
baxteron Friday, 20th June 2008 at 12:35