// Blog

Consuming our own APIs

Originally published on Tumblr.

I wish we had a word for “being surprised by surprise”. Maybe German has one. If English did, I’d use it now.

I talk to a lot of people about our APIs, and I’m constantly surprised by how surprised they are to hear that we use them ourselves. We always have, from Day 1. It’s never occurred to us not to. It never occurred to us to build a front end that didn’t communicate with a backend process via a well-defined API. How else would we know that our APIs were complete, and useful?

If this is surprising, it must mean that most companies don’t, which I find surprising. It probably wouldn’t be if I spent a bit more time thinking about the implications of what people tell me.

Last week one of our engineers told me that a bank had asked him to run an API training course for 140 engineers. I was a bit stunned, but also somewhat generous. I didn’t immediately think: “Are these people really too lazy to open a book? “ Instead I thought: “Maybe they’re retraining programmers who’ve just finished cleaning up after their frenetic Y2K changes.” What should have occurred to me was that this army of engineers was clearly working in an environment in which consuming your own APIs just doesn’t happen. Maybe they have a special API team that exposes services to the outside world. Or maybe they haven’t even gotten that far.

The other day I read a fascinating post by a guy who spent months making sure that his e-commerce site wasn’t vulnerable to SQL injections. No APIs there. He could have designed and implemented an API three times in the amount of time he spent worrying about his SQL.

Sometimes I wonder if the use of APIs isn’t a bit like hair loss patterns that skip a generation. Back when people mostly wrote code in C or one of its derivatives, the idea of an API was not only common but inevitable. Functions were defined in header files for the compiler, which had the wonderful side-effect of forcing humans to think about the interface to their implementations.

Then we got Java, and interfaces became optional. I don’t know if that’s the generation with or without the hair.

In either case, I’m pleased that interfaces are finally an important topic of conversation again, and I’m pleased that we’re seeing more and more formalism in these discussions.

I hope that someday soon the idea of NOT consuming your own APIs will be more surprising than consuming them by default.