Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

masak (6289)

  (email not shown publicly)

Been programming Perl since 2001. Found Perl 6 somewhere around 2004, and fell in love. Now developing November (a Perl 6 wiki), Druid (a Perl 6 board game), pls (a Perl 6 project installer), GGE (a regex engine), and Yapsi (a Perl 6 implementation). Heavy user of and irregular committer to Rakudo.

Journal of masak (6289)

Friday June 26, 2009
03:11 PM

Reading up on MVC, part 1: Ruby on Rails

[ #39182 ]

Hello, don't mind me. I'm just going through a few MVC frameworks to see how they differ and how they're alike. I need the knowhow to create an MVC for Right now, my plan is to examine Rails, Catalyst, Django and Jifty. I'll write down my impressions of each of the in some kind of list, for future reference. Basically the only way you'd want to read this is if you want to laugh at how little I know about MVC frameworks.

Here's the list I got from watching this screencast:

  • Man, the Ruby folks sure can make a beatuiful screencast!
  • Rails uses scaffolding. I've heard not all people like scaffolding, but it does look kinda convenient to my untrained eye.
  • Partial templates are called, logically, "partials". They bind smartly with variable names somehow.
  • Different output formats are really easy to add. XML, JSON, Atom...
  • A blog is a really nice example for an MVC framework screencast, because it's just a list of posts, each with a list of comments.
  • Rails can add authentication through before_filter.
  • Hm, clearly the strength of Rails comes largely through the keywords it introduces. Wonder if it uses monkey typing for that?
  • Rails has Routes! Maybe this is my chance to finally understand ihrd++'s Routes, which I never really grokked.
  • Controllers do things like index, show, new, update and delete. Probably related to CRUD somehow.
  • That 'debugger' trick is fantastic! One of those features which you feel can't be just hot air.
  • AJAX is fairly well integrated, though I'll be danged if I understand exactly how. Looks like magic to me.
  • Did I hear that right? "rjs is just a way to generate JavaScript using Ruby." Wow.
  • There's graceful fallback from JS to non-JS.
  • There's built-in automated testing.
  • The console seems like the debugger again, but without the breakpoint. Yes, I can see how that might be very useful.
  • Never once do they explicitly say 'the database' in the screencast. They say the word 'database-agnostic' once, and 'table' and 'column' a few times, but most of the time it's just 'model', 'view', 'controller'. Seems like the abstraction is largely intact.

Um. Well, in summary, that cool-aid sure seems to have an effect on me. I'll leave the comments open so that you people can tell me how Rails, despite all appearances, is really bad for your teeth and leaves skid marks on your puppy.

Next up: Catalyst.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Have a look at Mojo. I recently read somewhere that the author (sri) had written it with a Perl6 (port) in mind.
    • Thats correct, we have a full featured HTTP 1.1 stack ready to be ported to Perl6. (also including a Rack layer on the server side)
  • Don't forget the simple but effective 'Rack'. I find Rails and Merb etc to be too complex. If you need mod_perl like raw power, Rack is the way to go. I wrote about it at rocks/ []
    • I don't think you can compare mod_perl and Rack (both Rails and Merb are based on Rack these days btw.). Rack is all about running your code on different HTTP servers using a unified api, while mod_perl gives you the power to hook into the guts of Apache and change low level logic.
    • Well if you like Rack then you should be looking at HTTP::Engine or Mojo for Perl equivalents.
    • It might please you to learn that aims to have a full port of Rack at its core. The idea is that people should be able to choose the level of abstraction they want to build their web app on. The levels are something along the lines of:

      • A minimal setup. (Rack.)
      • Templating.
      • MVC.

      That last level is the reason I'm investigating MVC frameworks at present.

      • If your aim is to have a full Rack port maybe you should call it Rack or Web::Rack? seems a bit too generic, after all there will be alternatives and they'll need a namespace too.
        • Noted.

          For various reasons I'm not inclined to discuss the naming of via a blog commenting system. I'll happily move the discussion to IRC or email, though.

      • That, my dear friend, will be awesome. Mod_perl is great but a web server agonstic and low level web framework like Rack or Servlets will make Perl shine again (and a bit of slick marketing!).
  • Scaffolding sure looks amazing in Screencasts, but what you shouldn't forget is that the ORM agnostic Merb was pretty much about to beat Rails when they decided to merge both projects.
    • I know nothing about Merb, except that it was merged with Rails. In particular, from your comment I still am no wiser as to why scaffolding is bad, or why Merb was successful due to its lack of scaffolding.

      Guess I'll have to read up a bit on Merb. Or what's left of it. :)