API Design Anti-patterns

Location: Portland 255
Average rating: ***..
(3.08, 26 ratings)

Whenever we design a software system, we should always be thinking about how other code (whether our own, or other people’s) will interact with ours (an “API”, in common parlance). Indeed, the most common and terrible mistake in API design is… not doing any! — i.e., not providing any designed, architected way for other code to interact with ours. That’s fortunately less common when “our code” is a library or framework;-), but, alas!, sadly widespread when “our code” is an application or website — that’s why questions about screen-scraping the web and simulating keystrokes and mouse gestures need be so tragically frequent all over the web.

Once past the obvious hurdle of not having any API at all, there’s still plenty of ways we can go badly wrong in the process of designing one — and many of those ways fall into recognizable categories, i.e., patterns. Specifically, since they’re frequently observed categories of defective design, they’re anti-patterns — and that’s what this talk is in fact about (as the smartest among you could tell from the title…).

I’m eminently qualified to present on this subject, since, in a lifetime spent mostly stumbling into software (after actually qualifying to design hardware in college, but only doing that for a few years), I’ve been responsible for more than my share of API design fumbles (plus, of course, just like every other programmer, I’ve done my share of swearing at the design fumbles of other API perpetrators). And, as novelist Richard Bach reminds us, “You teach best what you most need to learn”!-)

Photo of Alex Martelli

Alex Martelli


Alex Martelli is a senior staff engineer at Google. Alex is the author of Python in a Nutshell and coeditor of the Python Cookbook. He is a PSF member and won the 2002 Activators’ Choice Award and the 2006 Frank Willison Award for contributions to the Python community. You can read some of his publications here and
watch some of his past presentations here.

Comments on this page are now closed.


Brooks Brown
07/29/2011 6:11am PDT

I liked the longer perspective and more abstract, general treatment of the concept of API independent from current hot topics like REST. More concrete examples would have been nice, but there is only so much you can cover in 45 minutes.

Picture of Fred Willerup
Fred Willerup
07/28/2011 9:35am PDT

i liked the talk, but i think more examples would be useful.

Gabriel Enriquez
07/28/2011 7:41am PDT

Sorry, but I just don’t understand why presenters like to use “comic sans” in your presentation?