How To Design A Good API and Why it Matters
Video Statistics and Information
Channel: GoogleTalksArchive
Views: 119,783
Rating: 4.9788918 out of 5
Keywords: googlevideo
Id: heh4OeB9A-c
Channel Id: undefined
Length: 60min 15sec (3615 seconds)
Published: Wed Aug 22 2012
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
I love watching stuff like this just as I get to the end of a project. It really helps keep my happiness in check!
This is from 2007, the OP just linked to a copy of the video with very few views... here is another version (the original?) with over 100k views.
My biggest gripe with APIs is if they use cryptic docs and a single example. A database of examples covering all the general cases is all I need.
This is badass.
I find that different languages/platforms have different standards for what a good API is, or for that matter, what good code is.
For example, in C, classically (which most C code I see is in the "classic" style) you are supposed to write 400 line functions that do 10 different things and the more complicated parameters your functions have the better.
In Java, you are supposed to create a class for every contingency, document every class, and expose all of the classes in a way that makes it impossible to know what sequence of objects to create and methods to invoke without consulting the example.
In Node.js, you can never just return from a function, so proper code usually involves at least three levels of nested callbacks, and an API isn't any good unless the module does one single thing and makes the task as simple as it could possibly be.
I can't recommend this video, the reasons being:
it's only ~3/4ths of the talk then it cuts off (Google has 20% time but god forbid a talk go long by a few minutes, what?).
it should be called "how to design a good API in Java" as a lot of the talk is related to Java specifics. For instance near the beginning there's a slide showing a rough sketch of a new API... the slide is a wall of text of Java keywords "public static <T> Callable <T> ...". I know Java fairly well and it was hard to make out what the actual API was with line wrapping (one method is 4 lines on the slide). Talk gets bogged down in Java specifics.
guy gave out paper handouts (how retro) and handout is not included in the slides.
There's a ton of little details in this talk that are decent, at least for Java, but I felt it was really lacking in Zen. Designing a good API is more than just a checklist of 'did I make everything immutable that should be' or 'did I document every use case', but details like that are basically all this talk is.
I know APIs are not a language fare, yet, over the years I've realised how much Python have helped me towards being better and better at building them.
Python is an elegant language (there are others I bet ;)) and this is a subtle feature that has taught me a lot being more rigorous whilst understanding that programming is a some kind of art.
Saw this and now I'm scared to continue working on the library that I was working on. There are so many things I might be doing wrong!
Very good presentation and some urgently relevant topics!