06/12/2012

Being RESTful. How to Explain REST So Even Your Mother Can Understand

We’ve all been there. You’re at a cocktail party, holiday family meal, even the grocery store and someone asks, “What do you do?” You cringe a little, knowing that if you try to explain it their eyes will glaze over, they’ll nod, and change the subject, or walk away.

Of course just saying “web developer” works to some extent - they’ll know you do something with the internet. Or “computer programmer” and they get you’re a geek who works with computers. But if you want to explain what you do in a way that someone will actually understand what you do - even just once - here’s a low-tech way to do it.

Tell your Mom (or whomever you’re hoping will understand you) that she just sat down at a restaurant and the waitress has come over to take her order. That’s the equivalent of opening up her browser on her computer.

The waitress takes the order and heads to the kitchen. A URL is her order (whether she typed it in manually or the default one for when she opens the browser), and the waitress is the instructions (or protocol) that delivers the order.

Next the waitress POSTs the order at the kitchen. The cook sees that he’s got a new order to fill and gets to work. The cook is the host computer (or a server - but in some places wait staff are called “servers” so to avoid confusion use host computer instead) that gets your requested web page ready.

When the waitress delivers your Mom’s drink, your Mom remembers she forgot to say “no onions” on the burger she ordered. The waitress smiles and heads to the kitchen again. She PUTS in the change for no onions on the order.

Finally the waitress GETS the order and delivers it to your Mom just the way she ordered it. This is the same as the requested web page being shown in the browser.

And what you do is tell the waitress what to do by giving her the instructions she needs to know. The format of how the order should be written so the cook understands it, and so when she delivers the meal it looks the way you expect it to (and she doesn’t put the soup bowl upside down or in your lap).

When your Mom asks why all that work is important explain this:

  • Your Mom doesn’t need to know how to make the meal she ordered, or even the ingrediants.
  • The waitress doesn’t need to know all that either, but she does need to know how to write the order up properly so you get what she wants to eat.
  • The cook doesn’t need to know anything about your Mom to make the meal, just that she ordered a burger without onions.

This means that people can all use the same website no matter what type of computer or smartphone or tablet they have. The whole process works without your Mom needing to learn the ordering systems of every restaurant she goes to. The wait staff don’t need to know how to cook all the meals. And the cook doesn’t ever have to meet a single customer to understand how to make a meal.

This is the power of being RESTful. It makes the internet universal, and easy for the average person to use - thanks to you and other web developers who do all the heavy lifting for the rest of us (no pun intended).