SDKs or libraries are important elements of a good developer experience. That’s why the API comparisons include a run-down of available libraries and why this factors into the DX Index. But how do libraries help improve the developer experience? In two primary ways, one of which is illustrated in a new update from one of the User Login APIs.
Why are API libraries important?
- They help developers get started fast
- They make good default choices for developers
The second is absolutely related to the first. With fewer choices to make, a developer can more quickly write code against the API.
In StormPath’s Express library announcement, Robert Damphousse shares several improvements. Many help developers make the easier decision automatically:
We often received this question: because the tokens are cryptographically signed, can I skip the token verification round-trip to the Stormpath REST API? You bet! This was always possible with the local validation strategy option, but in 3.0 we’ve made local validation the default.
We also refactored our middleware chain, to not attempt to resolve the current user unless you’ve explicitly requested a resolution with the getUser middleware. We made this change because it was too easy to accidentally require authentication on your public asset routes, and this could cause a serious slowdown if your front-end needs to request a lot of assets during bootstrap.
In the same way that choices degrade user experience, they also can be barriers to entry for developers. One difference is that we usually want APIs that are adaptable to our use case, which might run counter to few choices. The user experience analogy continues to work, as software usually has some base features for everyone and additional power user functionality. The libraries, with their good defaults, help developers get started and work long term for the majority. When you need more, you either change the defaults or move outside of the library to use the API directly.
Your very first experience with an API may be directly via cURL. Your second experience is almost certainly via an SDK or library, which is where good defaults will make you much more familiar with what’s possible. In its latest release, StormPath has proven worthy of its DX Index by being thoughtful about its defaults.