I'm just back from a trip to the west coast. Willie and I spent three days in Mountain View giving demos of FreeTTS and Sphinx-4 at the Sun Labs open house. For a quick lunch one day, we stopped into In-N-Out Burger, a fast food burger joint. They don't have these on the east coast. The In-N-Out menu is very simple, three kinds of hamburgers, french fries, and drinks. That's it. The place was clean, the burger was good, what more could you ask for.

This serves as a good model for API design, unlike McDs, In-N-Out has tried to keep their interface (the menu) nice and simple. And since their API is so simple (just burgers and fries, no fajitas, no apple pies, no chicken, no fish, no salads), they can do a good job. It's The Unix Philosophy applied to hamburgers: Make each program do one thing well. The advantages of a small menu are obvious. Shorter lines since customers don't spend too much time deciding on what to have, and better food (since they are just cooking burgers, they can make them to order).

I have seen APIs that use the McDs approach ... give the customer all the choices. Look at the log4j API. It is a logging and tracing package. Now, in my mind, logging packages should be pretty straight forward. They need to take a message, classify it and send it somewhere to be output. Looking at the log4j API I see over 120 classes in the API. This API is so big there's a whole book describing it. In my mind, that is way too complicated, too many choices. All I really want to do is this:
    Logger.log(WARN, "Coffee is too hot");

API designers need to walk the fine line between functionality and usability. Too much functionality can limit the appeal of an API. Just give me a burger with fries please.

Comments:

So what do you think about In-N-Out's undocumented features?

Posted by Wes Felter on August 02, 2004 at 03:01 PM EDT #

Yep, just like all heavily-used APIs, there are those undocumented features. The danger of course is that one day you'll order 'the animal' and they'll just say "What? that's not on the menu. Sorry". Not to long ago I visited a McDonalds and ordered the #2 only to find that they had switched around the value meal menu. I got the wrong thing. Of course this is a most egregious violation of API principles, changing the behavior without changing the name. Sigh, I'm getting hungry.

Posted by Paul on August 02, 2004 at 03:21 PM EDT #

Already getting to be too much of the Bruce Tate effect.

Posted by Sumit on August 02, 2004 at 10:03 PM EDT #

Post a Comment:
Comments are closed for this entry.

This blog copyright 2010 by plamere