Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Apologies for the somewhat general question, but I’ve been reading a few of the links on this page, and many of them:

  • spend time explaining what an API is
  • are a bit general and vague
  • are rather wordy

Do you know of any resources on API design with several different examples and/or case studies illustrating the principles?

share|improve this question
Any book that discusses Test-Driven Development would be a pretty good primer, since one of the fundamental principles of TDD is fleshing out a sensible API. – Robert Harvey Mar 10 '11 at 4:39

closed as not constructive by ChrisF Apr 22 '12 at 11:38

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

7 Answers

up vote 5 down vote accepted

enter image description here

Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, written by Microsoft architects Krzysztof Cwalina and Brad Abrams. This book gives clear DO and DO NOT advice for designing class libraries. Although heavily focussed on .NET, the book contains much general advice useful to anyone developing a class library.

share|improve this answer

I found the video "How To Design A Good API and Why it Matters", a recording of a Google TechTalk, to be very interesting.

Other than that just Google on "api design best practices" and you'll find a multitude of best practice advice articles and blogs.

share|improve this answer
1  
“Other than that just Google on "api design best practices" and you'll find a multitude of best practice advice articles and blogs.” I know I’ll find a multitude by Googling. I’m looking for well-written ones, with several examples and case studies. Cheers for the video though, that looks like great stuff. – Paul D. Waite Mar 10 '11 at 14:13

I'm currently reading Effective Java by Joshua Bloch, and if you are programming API for Java he has many great advices. This only applies if you are programming Java, but if you are, I'd say this is required reading.

share|improve this answer
I’m sure a lot of the principles apply outside of Java as well, nice one. – Paul D. Waite Mar 10 '11 at 14:14

If you'll forgive the self promotion, I have written a book on API Design that was just published by Morgan Kaufmann in the past few weeks. It's focused on C++, although the first few chapters are generic in nature and offer general advice on what makes a good API and how to go about designing high-quality and long-lasting APIs. I attempt to illustrate all of the concepts with actual code examples (which you can download and play with yourself). I also cover the entire API development pipeline including design, styles, implementation, testing, documenting, versioning, extending, etc.

You can read more about the book to see if it looks interesting to you at: http://APIBook.com/

share|improve this answer
Looks great, nothing wrong with self-promotion if it helps other people too. – Paul D. Waite Mar 10 '11 at 14:16

On iTunes U, there’s a WWDC 2010 session video called “Session 138 — API Design”, which has Bertrand Serlet explaining the design ideas behind Apple’s Objective-C APIs.

share|improve this answer

Not sure if your question includes web APIs, but I've found RESTful Web Services: Web services for the real world By Leonard Richardson, Sam Ruby To be quite excellent. It focuses on REST APIs, gives a lot of good examples and argues against the RPC approach. A must have for anyone designing a Web API IMO.

share|improve this answer
Sure, that counts — and you’re entirely right, it’s a great book. – Paul D. Waite Feb 15 '12 at 18:08

A good collection of "rules of thumb" for API design were collected by Joshua Bloch in his article "Bumper-sticker API design".

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.