11/22
View Comments

Specifications and Implementations, or Rack Explained!

So today I was hacking on mongrel with evan (and by hacking I mean implementing what evan told me to implement) trying to build in Rack support. For a good long time I was slightly confused about what exactly Rack does, and what why it was useful. I mean I have seen all the 3 line lambda web apps and they are super fun, but WHY rack? So after futzing around with documentation and annoying people in IRC over what exactly mongrel has to do to be rack compatable, chris says “just call the app.”

This is, I am sure, the brilliance that people see in paintings with nothing but 1 paint drop on the canvas. And this is when evan, in his complete brilliance, decided to inform me on why rack is as much a specification as it is an implementation. In fact it is first a specification – and then to make it actually useful there is this whole implementation, but if when sides are doing it right the implementation becomes unnecessary.

Here, let me explain. We all love redheads. In fact we love them so much that we find a way of procration, a specific way that every damn time redheads happen to pop out of the womb 9 months after this certain act. This is stunning, and everyone is happy, because naturally everyone likes redheads. But yet there is still an entire generation of not very many redheads. So then, the same genius who invented the procriation specification which enables all redheads, invents an implementation of hair dye. Now everyone that used to be non-compatable with having red hair, can have red hair and thus continue to make wonderful redheaded babies.

Okay maybe the example broke down towards the end, but if you didn’t follow, using rack is red hair. We all want to write less code, and rack enables this. But rarely is someone the first to strike in such a matter, and here lies the genius of rack. What the rack code does is take things which are not rackable – code which does not respond to .call or call .call (depending on whether you are a server or a framework) and hacks it up so that it does. This way rack is useful from the start. But as brave young gladiators go and hack up code to make everything all rack all the time, the implementation of rack becomes obsolete. But the specification stays on, and continues to make red headed baby.

11/19
View Comments

My new blawg!

So this is my new blog. I will write interesting things I promise. I have just been writting the code for it recently, which will all be on github. I wanted to have a HTML blog which is generated and SCPd for me. Thanks to gist and disqus I do not need to run any sort of ruby on my server. The ultimate optimization. Anyways look forward to interesting ruby introductions, fun stories, and my tales of VIM as I am now a convert.