Optimized for Change

What makes a great API?

What makes a great API?

Good API design is memorable and unambiguous. It encourages readable, correct and performant code, and helps developers fall into the pit of success.

I call these design aspects “first order” because they are the first things a library developer tends to focus on. You might have to compromise on some of them and make tradeoffs but at least they’re always on your mind.

However, unless you’re sending a rover to Mars, your code will probably change over time. And so will the code of your API consumers.

The best API designers I know don’t stop at the “first order” aspects like readability. They dedicate just as much, if not more, effort to what I call the “second order” API design: how code using this API would evolve over time.

A slight change in requirements can make the most elegant code fall apart.

Great APIs anticipate that. They anticipate that you’ll want to move some code. Copy and paste some part. Rename it. Unify special cases into a generic reusable helper. Unwind an abstraction back into specific cases. Add a hack. Optimize a bottleneck. Throw away a part and start it anew. Make a mistake. Navigate between the cause and the effect. Fix a bug. Review the fix.

Great APIs not only let you fall into a pit of success, but help you stay there.

They’re optimized for change.

(This is an article posted to my blog at overreacted.io. You can read it online by clicking here.)

Print Share Comment Cite Upload Translate
APA
Dan Abramov's Overreacted Blog RSS Feed | Sciencx (2024-03-28T15:51:16+00:00) » Optimized for Change. Retrieved from https://www.scien.cx/2018/12/12/optimized-for-change/.
MLA
" » Optimized for Change." Dan Abramov's Overreacted Blog RSS Feed | Sciencx - Wednesday December 12, 2018, https://www.scien.cx/2018/12/12/optimized-for-change/
HARVARD
Dan Abramov's Overreacted Blog RSS Feed | Sciencx Wednesday December 12, 2018 » Optimized for Change., viewed 2024-03-28T15:51:16+00:00,<https://www.scien.cx/2018/12/12/optimized-for-change/>
VANCOUVER
Dan Abramov's Overreacted Blog RSS Feed | Sciencx - » Optimized for Change. [Internet]. [Accessed 2024-03-28T15:51:16+00:00]. Available from: https://www.scien.cx/2018/12/12/optimized-for-change/
CHICAGO
" » Optimized for Change." Dan Abramov's Overreacted Blog RSS Feed | Sciencx - Accessed 2024-03-28T15:51:16+00:00. https://www.scien.cx/2018/12/12/optimized-for-change/
IEEE
" » Optimized for Change." Dan Abramov's Overreacted Blog RSS Feed | Sciencx [Online]. Available: https://www.scien.cx/2018/12/12/optimized-for-change/. [Accessed: 2024-03-28T15:51:16+00:00]
rf:citation
» Optimized for Change | Dan Abramov's Overreacted Blog RSS Feed | Sciencx | https://www.scien.cx/2018/12/12/optimized-for-change/ | 2024-03-28T15:51:16+00:00
https://github.com/addpipe/simple-recorderjs-demo