Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Perceptions of Perl - views from the edge

by gamache (Friar)
on Feb 15, 2008 at 21:15 UTC ( [id://668254] : note . print w/replies, xml ) Need Help??


in reply to Re: Perceptions of Perl - views from the edge
in thread Perceptions of Perl - views from the edge

Two weeks ago today, I set out to write an auction website. The project was under a strict deadline; I had eight days.

I have written websites in Perl for years. Pure Perl, CGI.pm, CGI::Minimal, CGI::Application, Jifty, and Catalyst have each had their turn.

I decided to do this project in Ruby on Rails. I did not know Ruby. I did not know Rails.

Eight days later, there was a working auction site in place, with a few hundred items and a few dozen nerds bidding on them.

I will put this as clearly as I can: RoR beat the daylights out of every Perl web framework I have had experience with. Even after a decade of Perl experience and more Perl websites under my belt than I can count on both hands, I couldn't have done with Perl what I did in RoR in eight days. I don't know if I could have done it in twice as long. (I do know that it would have sucked.)

Ruby itself can't do anything Perl can't. I loved its syntactic consistency, though. I spent about 15 seconds learning the language conventions and then it just got the hell out of my way.

But Rails, oh boy. ActiveRecord is nothing less than a godsend. Finally, and notably in agreement with a Perl design philosophy, there is something that makes simple websites simple to build. I was continually impressed by both the extent to which the framework designers anticipated the needs of the website programmer, and the extent to which the framework "scales up" to more difficult tasks and optimizations without making things more complicated than they have to be.

Talk whatever shit you want on Ruby and Rails, I guess. The "convention over configuration" paradigm puts a lot of bees in a lot of bonnets in the Perl community. But I'll tell you, it wasn't hype that collected a little over $10k in a multi-unit ascending auction system last Saturday, and it's not just marketing that is building Perl's increasing reputation as a deprecated language for web development.

Replies are listed 'Best First'.
Re^3: Perceptions of Perl - views from the edge
by Withigo (Friar) on Feb 20, 2008 at 07:47 UTC
    I agree with your sentiments exactly. Although this seems to be somewhat of a taboo topic around here, and your comments might incite an angry mob bearing pitchforks and torches.
    :)
    Contrary to what many in the perl community say, I don't think rails is just hype--when you sit down and start coding, the well thought out APIs and the smooth ruby syntax just leap out, grab you and take you far in no time. Actually, this sense of whipituptude is kind of how I felt when I first started learning perl.
    The response from the perl community is rather like an ostrich putting its head in the sand--"oh it's just hype, nothing to see here, move along." Which is frustrating, because I like perl, and I think perl could easily meet the challenges posed by rails. Going into specific details would be off-topic for this thread, but I have been thinking about this a lot lately--maybe I'll collect it into an upcoming meditation.
      Which is frustrating, because I like perl, and I think perl could easily meet the challenges posed by rails.

      I don't.

      Technically, of course, Rails could have been written in Perl. Not even in a "Turing tarpit" sense of "could", either; Perl would be as good a choice as any language, all other things being equal.

      Rails, however, benefits greatly from the attitude that a few ground rules can simplify everyone's life. In other words, convention. Joe Perl does not like other kids telling Joe Perl what Joe Perl can and can't do in Joe Perl's sandbox. Joe Perl is allergic to convention.

      Now, before anyone starts hucking Molotov cocktails at my delicately handcrafted strawman, let's compare and contrast RoR with its closest Perl counterpart, Catalyst.

      • Language: Ruby and Perl are just about even in the sort of things you can do; they're both modern dynamic languages which support most common design paradigms. Differences of style are just that; anything expressible in one language isn't too hard to say in the other. Perl has a steeper learning curve, due to its rich syntax, but also greater support for shell-like file manipulation and quick-and-dirty coding. Tie.
      • Model: Rails uses its flagship ActiveRecord class as the basis for its data modeling. ActiveRecord is a highly reflective object-relational mapping framework which supports most SQL databases. Its capability to predict the sort of class methods you want, and write them for you, is second to none. Catalyst, conversely, leaves the choice up to the programmer. DBIx::Class? Class::DBI? Class::DBI::Sweet? There's more than one way for the idiot who you're replacing as lead programmer to have done it, and none of them match ActiveRecord in ease of use OR features. Winner: Rails.
      • View: RoR gives you ERB. If you know Ruby, you are about twenty seconds away from knowing ERB. It is very similar to HTML::Mason, actually, which is available in Catalyst; Ruby is ERB's template language, just like Perl is Mason's. ERB, however, is much better and more concise at HTML form generation. Catalyst again declines to enforce anything. Want to use HTML::Template, TemplateToolkit, or ZOMG::D00d::T3mpl4t3? No problem. They all suck more than Mason and ERB though. Winner: Rails.
      • Controller: RoR has it all over Catalyst. More features, cleaner syntax, easier routing (rewriting) control. No holdover bits from CGI.pm either. I haven't found an easier way to specify a web app's internal plumbing. Winner: Rails.
      • Leftovers: Rails' DB migrations are just super. No equivalent on the Perl side. Likewise for Rails scaffolding, which can take a DB table definition (as from a DB migration) and spit out skeleton models, views and controller to implement the "golden seven" actions: index, new, edit, create, show, update, delete. Winner: Rails.

      If it sounds like I'm on the verge of gushing, I am. If it sounds like I am fed up with Perl's bullshit, you're right about that too. If it sounds like an unordered list full of bullshit, you're going to have to convince me of that. And if it sounds like muted, low-frequency tones at a spoken cadence, your head might be in the sand too.

      There is something to this Rails thing.