Core Competencies, Rails, and make_resourceful

November 5, 2007 – 6:34 pm

I was talking with a coworker while at Rubyconf this past weekend, and I was finally able to articulate why I’m not terribly fond of make_resourceful, resources_controller, and all those other plugins meant to DRY your RESTful controllers (as well as the should_be_restful macro in the shoulda plugin). This was a big step for me, so I thought I’d share it.

Don’t outsource your core competencies.

This principle is most often applied to businesses, but it holds for software, too. If you’ve got a graphics program, then you shouldn’t use somebody else’s graphics engine - you ought to be building your own. Printing and distribution? Outsource away - but keep the essential pieces of your work in-house.

My problem with the REST plugins is just this: I think of the controllers as part of the core competencies of a Rails app, and so it’s wrong to outsource their code to third-party plugins. In other words, you should be writing the code for your controllers and whatnot in-house.

Now, given that I’ve been working on a pluginable CMS for a little while now, you might think I’m being hypocritical. With sandstone, you have controllers and models outsourced to a third-party plugin - so what’s different between sandstone and make_resourceful?

The difference is that sandstone is not a replacement for a core competency. If your app is primarily a CMS, you’re much better off with Radiant or Comatose or something else). If, on the other hand, you’ve got some random social network devoted to beekeepers and you need a CMS to manage ten or twelve pages, you’re not outsourcing the essential core of your site by installing sandstone.

So: don’t hide the code that gives your site its reason for being; keep it in app/controllers where it belongs. Feel free to use plugins to add on to the core of your application, but leave the vital bits where nature intended them to be.

  1. 4 Responses to “Core Competencies, Rails, and make_resourceful”

  2. I can’t agree with you here - I don’t really understand how you draw the line to say that a controller’s responsibilities are uniquely part of the core of your application. Isn’t the HTML output you create part of your “core competency”? Better not be using ERB/Haml then, write your own tempting engine

    Or look at Pixelmator, a graphics manipulation program using Apple’s Core Image to do the image processing. Isn’t this the whole idea of reusable modular software, whether from a 3rd-party or not?

    My main worry about plugins like make_resourceful is that they make CRUD/REST *so easy* that it will discourage people from stepping off the golden path when it isn’t appropriate for a given part of their application - “hell with what the customer wants, I can roll this w/ m_r in 5 lines”

    By crayz on Nov 6, 2007

  3. I’d agree that drawing the line between core and not-core is tough, and different people might place it differently. For me, though, the line between core and infrastructure (which includes ERb, ActiveRecord, etc.) is usually pretty clear. YMMV, of course - and I’d never want to say that this is the only reason to dislike the REST plugins :)

    By Ben on Nov 6, 2007

  4. I think the difference of opinion here is that I think of my main competency as effectively producing websites. If that means writing code all day, then great. But also, if I can just deploy mephisto and make the client happy, then all the better.

    Tools like make_resourceful, and shoulda are double edged swords. Used properly, they can drastically decrease your production time, which is a huge win. But if used without understanding what they’re doing, then you can easily get yourself into a situation where you don’t know how to implement the last 20% of your clients needs. This, of course, is a huge loss.

    By Tammer Saleh on Nov 6, 2007

  5. I’ve always gotten a “bad vibe” from those plugins as well. I actually think I’d like them better if they didn’t try to include a myriad of options for when things get complex.

    I’m interested in Sandstone though… anywhere we can get more info on that? I recently needed a “plugin-able” mini-cms and whipped this up:
    http://svn.megablaix.com/plugins/unstatic/README

    It’s really a bare-bones solution though and I’ve been looking for something a bit more sophisticated, but still not a full-blown, full-site controlling CMS…

    By Justin on Dec 6, 2007

Post a Comment