There's no way around it: I'm a bit of a
Rails fanboy. While it's got it's
glitches, it's certainly made the part of my life that involves writing
web applications a hell of a lot easier, and introduced me to the wonder
that is
the Ruby programming
language.
However, there are plenty of times when Rails just isn't a good fit.
It's not particularly simple to deploy, it's quite heavy, and it does
have a definite learning curve. So, when I need to write something
simple, I've just used Ruby's built-in CGI support. But I will do so no
longer. For I have found
Camping.
The name doesn't make a whole lot of sense, and until you come to grips
with Why The Lucky Stiff's weird sense of humour, the docs will probably
make you think that acid trip you took several years ago has just kicked
in again. However, the
purpose of Camping is pretty easy to
understand: it allows you to make simple (CGI level) web "applications"
using Rails-like (or more properly,
MVC) concepts,
which are fairly easy to write and deploy.
If you're familiar with Rails (or probably most of the other Rails-clones
that have sprung up in
other languages) then Camping will probably
smell at least faintly familiar. You have routes, which map URLs to
controller actions, which retrieve models and feed them to a view which
sends results back as HTML. From that perspective, Camping is easy to
learn -- it's core concepts can piggyback on existing knowledge, and you
can get started very quickly.
Using your Rails-fu, however, will only get you so far. For one thing,
the API is similar-but-different enough that while your first couple of
simple experiments will probably Just Work, getting more complex things
done will either fall under the "different" or "difficult" headings.
That isn't meant to be a slight on Camping, though -- if you
want to do horribly complex things, then you're heading into
territory best served by Rails anyway. But there is a bit of a middle
ground where the utter simplicity of Camping is stretched a little, but
it's still more appropriate to write a Camping app than a Rails app, and
it's important to remember that you're not using full-blown framework
when you thump up against something that's beyond-trivial in Rails, but
is not quite so simple in Camping.
Camping is a
microframework -- it says so right there on the
front page. Why's
intention is that Camping will always be provided in less than 4kB of
code. So you're never going to get, for instance, the broad range of
HTML helpers that Rails' ActionView provides to make writing HTML
templates so easy, or the Prototype JavaScript framework shipped with the
main code. If you don't want to blow a steam pipe, then, when starting
out with Camping, you need to think "this is a lot easier than
hand-writing CGIs" instead of "this is a lot harder than writing a Rails
app".
There are a few things that are undeniably a pest in Camping, though. The
docs are a little incomplete and hard to follow (even when you account
for Why's "unique" style of writing), and some of the coding tricks that
are employed in making the framework can make debugging a bit tricky.
They're not showstoppers, but it's worth knowing about them in advance so
you don't go nuts when you're first using the framework.
If you're not the sort of person who needs small, self-contained web
scripts, then I'd say you'll probably never get much benefit out of
Camping. On the other hand, if you're still writing your CGIs against
the "bare(ish) metal", then I would
strongly encourage you to
take a look at Camping, to make your life just that little bit more
delightful.