Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: OT: Ruby On Rails - your thoughts?

by tilly (Archbishop)
on Nov 17, 2005 at 17:27 UTC ( [id://509484]=note: print w/replies, xml ) Need Help??


in reply to Re: OT: Ruby On Rails - your thoughts?
in thread OT: Ruby On Rails - your thoughts?

Ruby looks like a slightly crazier syntax than Perl to me.

Having used Ruby a bit and Perl a lot, I definitely prefer Ruby's syntax. It has a lot of the same shortcuts that Perl does, but is significantly more regular. With better defaults. And I find that as I go to more complex conceptual code, Perl is far more likely to get ugly on me.

As a random (unfair) example. Suppose that I want to do a sort on an array of arrays based on the contents of the first column. In Ruby that's array = array.sort; In Perl that's @array = sort {$a->[0] cmp $b->[0]} @array; Suppose that I want to do a lexicographic sort (first column, then second, then...) In Ruby that's the default. In Perl that turns into truly ugly code.

That is not an isolated example. Suppose that I have a hash of hashes and I want the keys of one of the subhashes. In Perl that's keys %{$hash_of_hashes{$foo}} while in Ruby that's hash_of_hashes[foo].keys. Which would you prefer to figure out in a hurry?

This is not to say that there aren't warts to Ruby's syntax. For a start, I loathe optional semicolons. Secondly, I strongly dislike the lack of a variable declaration, meaning that there is no easy equivalent of strict available. Thirdly the Ruby philosophy of, "Oh, add every alias someone might expect for this" has a conceptual cost when reading someone else's code.

But I still prefer it to Perl's. Significantly.

Replies are listed 'Best First'.
Re^3: OT: Ruby On Rails - your thoughts?
by perrin (Chancellor) on Nov 17, 2005 at 17:41 UTC
    That's reassuring to hear, actually. What I like about the recent success of Ruby is that it seems like a language which most Perl programmers would be pretty happy to work with, if it continues to grow. It's open source, unlike Microsoft's offerings, and higher level than Java.
Re^3: OT: Ruby On Rails - your thoughts?
by Joost (Canon) on Nov 18, 2005 at 00:31 UTC
    That's exactly what I think. In fact, I think one of the biggest adavantages Rails has over Maypole & similar frameworks in Perl is that it's written in Ruby :-)

    Yes, ruby is slower and the main developers have a tendency to choose "right" and "nice" over "simple" and "fast", but I'm very impressed with how the whole Rails system holds together as a logical, intuitive whole whithout making it look overly complex and longwinded (yes, Java, I'm looking at you)

Re^3: OT: Ruby On Rails - your thoughts?
by adrianh (Chancellor) on Nov 18, 2005 at 12:10 UTC
    Having used Ruby a bit and Perl a lot, I definitely prefer Ruby's syntax. It has a lot of the same shortcuts that Perl does, but is significantly more regular. With better defaults. And I find that as I go to more complex conceptual code, Perl is far more likely to get ugly on me.

    As the AOL folk would say - me too !

    I loathe optional semicolons

    I love 'em. The less I have to type the better :-)

    Secondly, I strongly dislike the lack of a variable declaration, meaning that there is no easy equivalent of strict available.

    Curiously enough I've never found this a problem. I thought I would when I first read the Pickaxe book - before I did any coding. However I've never found it a problem in real life. My guess is that my test suites catch these mistakes early enough for it never to be a problem.

    Thirdly the Ruby philosophy of, "Oh, add every alias someone might expect for this" has a conceptual cost when reading someone else's code.

    I agree this is a pain, but I think enough people are pushing back against this idea now that it's a problem the community will fix.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://509484]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-26 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found