Live data from Hacker News

Ask HN: Why do people consider Ruby better than Perl or vice versa?

news.ycombinator.com

1–10 of 32 posts

Ask HN: Why do people consider Ruby better than Perl or vice versa?

#1
I've seen a lot of anti-perl, pro-ruby speak recently on HN and am curious for what reasons people find Ruby to be superior (esp. from people who have experience with both)

I'm personally a fan of both (and continuously delighted by learning new things in both languages). I'm spending more time with Ruby lately because it looks like it's where the community is going and is fashionable these days, but I have no real major issues with perl itself.

Perl is often a stereotyped as unreadable, but it's largely up to the writers of the code itself to make it _that_ illegible; it's not a consequence of the language.

Re: Ask HN: Why do people consider Ruby better than Perl or vice versa?

#3
I've used perl for over 15 years and ruby for over 5.

I prefer ruby just because, I tend to be able to read and understand other people's ruby code easier than other people's perl code.

Maybe that is something about the language, maybe it is something about the people who use each, maybe it is something about their cultures or something about me. In the end it doesn't matter much to me.

Re: Ask HN: Why do people consider Ruby better than Perl or vice versa?

#4
Ruby owes much of its popularity to Ruby on Rails. I don't think Ruby would be as popular (or "hip") if it hadn't been for Rails.

Ruby on Rails also appeared around the time webapp development was gaining a lot of momentum, so that might be a part of the reason.

I myself don't find Ruby superior, for me Ruby (on Rails) and Perl solve problems in different domains. Ruby is great for web development. Perl is great for system administration and scripting, and it's preinstalled on most Unix-like systems (although Python has replaced Perl for the most part in my case).

Re: Ask HN: Why do people consider Ruby better than Perl or vice versa?

#5
I tried both for a while when I was getting into programming, and one huge thing that has always bothered me about Perl is the strange behavior with changing sigils. Here's what I mean:

$foo is a scalar

@foo is an array

$foo[0] is the first element of @foo, instead of @foo[0]

As far as I know, Larry Wall's rationale as a linguist was that in English, one would say "this apple" and "these apples", but "this third apple" instead of "these third apple". The problem is that code isn't a human language, and obeying these rules doesn't make sense and puts additional cognitive strain on the programmer. Basically, having different syntax quirks for scalars, arrays, hashes, and file handles makes code unnecessarily weird, especially when combining them for things like multi-dimensional arrays.

Re: Ask HN: Why do people consider Ruby better than Perl or vice versa?

#6

I've used perl for over 15 years and ruby for over 5. I prefer ruby just because, I tend to be able to read and understand other people's ruby code easier than other people's perl code. Maybe that is something about the language, maybe it is something about the people who use each, maybe it is something about their cultures or something about me. In the end it doesn't matter much to me.

Other people aside.. I prefer ruby because I tend to understand my own code easier when coming back to it. Every time I try working with Perl, I have to "relearn" the language

Re: Ask HN: Why do people consider Ruby better than Perl or vice versa?

#7
What you are seeing is probably more sibling rivalry (or plain old fanboyism) than genuine hatred.

From the Ruby FAQ:

"If you like Perl, you will like Ruby and be right at home with its syntax. If you like Smalltalk, you will like Ruby and be right at home with its semantics. If you like Python, you may or may not be put off by the huge difference in design philosophy between Python and Ruby/Perl."

http://www.rootr.net/rubyfaq-2.html

Re: Ask HN: Why do people consider Ruby better than Perl or vice versa?

#8
Anti-perl speak? I must have missed it. I'm not sure why someone would hold a poor opinion of perl, unless it were simply personal taste. To say you don't like a language is not the same as saying a language is bad. I don't like to program in ASP.NET C#, but I don't think it's a bad framework/language.

Perl is kind of the "C of scripting languages". It's been around for a very long time (late-eighties/early-nineties). The fact that modern languages, like Ruby, borrow from a language that was invented in the late-eighties says a lot about that language.

Re: Ask HN: Why do people consider Ruby better than Perl or vice versa?

#9
"Perl is often a stereotyped as unreadable, but it's largely up to the writers of the code itself to make it _that_ illegible; it's not a consequence of the language."

Well, one argument is that the language (and community) should encourage good/readable/maintainable code.

Re: Ask HN: Why do people consider Ruby better than Perl or vice versa?

#10
post #7

What you are seeing is probably more sibling rivalry (or plain old fanboyism) than genuine hatred. From the Ruby FAQ: "If you like Perl, you will like Ruby and be right at home with its syntax. If you like Smalltalk, you will like Ruby and be right at home with its semantics. If you like Python, you may or may not be put off by the huge difference in design philosophy between Python and Ruby/Perl." http://www.rootr.n…

But to the question of whether a language can be intrinsically "illegible", I'd say that it is easier to write "hard-to-read" code in some languages than others.

The conventions that a language community shares often lead to easier or harder to read code. In the Perl community, clever code which solves a problem is highly valued. In the Python community (as the Python Cookbook famously says) "To describe something as clever is NOT considered a compliment in the Python culture." A Pythonista is more likely to compliment your clean code, to say that it is pythonic.

I don't know enough about Ruby's community to say whether they have their own view about the relative merits of the clever/clean approaches or if they value something else entirely.

Post reply on HN