API Design Matters Stonebraker and Seltzer - RabbitMQ
API Design Matters Stonebraker and Seltzer - RabbitMQ
API Design Matters Stonebraker and Seltzer - RabbitMQ
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
programmer to know how to write various data structures<br />
<strong>and</strong> manipulate them efficiently.<br />
We have moved on considerably since then. Virtually<br />
every major development platform today comes with<br />
libraries full of pre-canned data structures <strong>and</strong> algorithms.<br />
In fact, these days if I catch a programmer writing a<br />
linked list, that person had better have a very good reason<br />
for doing so instead of using an implementation provided<br />
by a system library.<br />
Similarly, in the ’70s <strong>and</strong> ’80s, if I wanted to create<br />
software, I had to write pretty much everything from<br />
scratch: if I needed encryption, I wrote it from scratch;<br />
if I needed compression, I wrote it from scratch; if I<br />
needed inter-process communication, I wrote it from<br />
scratch. All this has changed dramatically with the open<br />
source movement. Today, open source is available for<br />
almost every imaginable kind of reusable functionality.<br />
As a result, the process of creating software has changed<br />
considerably: instead of creating functionality, much of<br />
today’s software engineering is about integrating existing<br />
functionality or about repackaging it in some way. To<br />
put it differently: <strong>API</strong> design today is much more important<br />
than it was 20 years ago, not only because we are<br />
designing more <strong>API</strong>s, but also because these <strong>API</strong>s tend to<br />
provide access to much richer <strong>and</strong> more complex functionality<br />
than they used to.<br />
Looking at the curriculum of many universities, it<br />
seems that this shift in emphasis has gone largely unnoticed.<br />
In my days as an undergraduate, no one ever bothered<br />
to explain how to decide whether something should<br />
be a return value or an out parameter, how to choose<br />
between raising an exception <strong>and</strong> returning an error code,<br />
or how to decide if it might be appropriate for a function<br />
to modify its arguments. Little seems to have changed<br />
since then: my son, who is currently working toward a<br />
software engineering degree at the same university where<br />
I earned my degree, tells me that still no one bothers to<br />
explain these things. Little wonder then that we see so<br />
many poorly designed <strong>API</strong>s: it is not reasonable to expect<br />
programmers to be good at something they have never<br />
been taught.<br />
Yet, good <strong>API</strong> design, even though complex, is something<br />
that can be taught. If undergraduates can learn<br />
how to write hash tables, they can also learn when it is<br />
appropriate to throw an exception as opposed to returning<br />
an error code, <strong>and</strong> they can learn to distinguish a<br />
poor <strong>API</strong> from a good one. What is needed is recognition<br />
of the importance of the topic; much of the research <strong>and</strong><br />
wisdom are available already—all we need to do is pass<br />
them on.<br />
more queue: www.acmqueue.com<br />
carEEr Path<br />
I am 47, <strong>and</strong> I write code. Looking around me, I realize<br />
how unusual this is: in my company, all of my programming<br />
colleagues are younger than I <strong>and</strong>, when I look at<br />
former programming colleagues, most of them no longer<br />
write code; instead, they have moved on to different positions<br />
(such as project manager) or have left the industry<br />
entirely. I see this trend everywhere in the software industry:<br />
older programmers are rare, quite often because no<br />
career path exists for them beyond a certain point. I recall<br />
how much effort it took me to resist a forced “promotion”<br />
into a management position at a former company—<br />
I ended up staying a programmer, but was told that future<br />
pay increases were pretty much out of the question if I<br />
was unwilling to move into management.<br />
There is also a belief that older programmers “lose<br />
the edge” <strong>and</strong> don’t cut it anymore. That belief is mistaken,<br />
in my opinion: older programmers may not burn<br />
as much midnight oil as younger ones, but that’s not<br />
because they are old, but because they get the job done<br />
without having to stay up past midnight.<br />
This loss of older programmers is unfortunate, particularly<br />
when it comes to <strong>API</strong> design. While good <strong>API</strong> design<br />
can be learned, there is no substitute for experience.<br />
Many good <strong>API</strong>s were created by programmers who had<br />
to suffer under a bad one <strong>and</strong> then decided to redo the<br />
job, but properly this time. It takes time <strong>and</strong> a healthy<br />
dose of “once burned, twice shy” to gather the expertise<br />
that is necessary to do better. Unfortunately, the industry<br />
trend is to promote precisely its most experienced people<br />
away from programming, just when they could put their<br />
accumulated expertise to good use.<br />
Another trend is for companies to promote their best<br />
programmers to designer or system architect. Typically,<br />
these programmers are farmed out to various projects as<br />
consultants, with the aim of ensuring that the project<br />
takes off on the right track <strong>and</strong> avoids mistakes it might<br />
make without the wisdom of the consultants. The intent<br />
of this practice is laudable, but the outcome is usually<br />
sobering: because the consultants are so valuable, having<br />
given their advice, they are moved to the next project<br />
long before implementation is finished, let alone testing<br />
<strong>and</strong> delivery. By the time the consultants have moved on,<br />
any problems with their earlier sage advice are no longer<br />
their problems, but the problems of a project they have<br />
long since left behind. In other words, the consultants<br />
never get to live through the consequences of their own<br />
design decisions, which is a perfect way to breed them<br />
into incompetence. The way to keep designers sharp <strong>and</strong><br />
honest is to make them eat their own dog food. Any pro-<br />
ACM QUEUE May/June 2007 35