Optimized for Change

What makes a great API?


This content originally appeared on Dan Abramov's Overreacted Blog RSS Feed and was authored by Dan Abramov's Overreacted Blog RSS Feed

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.)


This content originally appeared on Dan Abramov's Overreacted Blog RSS Feed and was authored by Dan Abramov's Overreacted Blog RSS Feed


Print Share Comment Cite Upload Translate Updates
APA

Dan Abramov's Overreacted Blog RSS Feed | Sciencx (2018-12-12T00:00:00+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 ,<https://www.scien.cx/2018/12/12/optimized-for-change/>
VANCOUVER
Dan Abramov's Overreacted Blog RSS Feed | Sciencx - » Optimized for Change. [Internet]. [Accessed ]. 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 . 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: ]
rf:citation
» Optimized for Change | Dan Abramov's Overreacted Blog RSS Feed | Sciencx | https://www.scien.cx/2018/12/12/optimized-for-change/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.