Define API –
The term “API” can be described by different industry experts in their own unique way. Like, for software developers APIs presents Rorschach Test, for web developers it refers to REST endpoints, and lastly, for desktop developers API stands for library codes.
So, every developer has a different interpretation of APIs according to his field. But, in reality, API holds the bigger stack in the technology industry. That’s why after going through numerous API definitions, we found tech terms definition highly appropriate:
“An API is a set of commands, functions, protocols, and objects that programmers can use to create software or interact with an external system. It provides developers with standard commands for performing common operations so they do not have to write the code from scratch.”
In simpler words, API decides how your program will interact with the other programs. Thus, each of the developers offers a right definition of API, but they only cover their part only. Suppose if you are writing a code and user interaction with your code via their own code, then you are building an API.
That’s why learning the characteristics of good API is vital to surviving in this industry. To be honest, as their some professional stacks are at exposure, so let’s jam up few characteristics of good API.
#1. Simplicity Is The Key
Foremost, a good API has to be simple. Programmers always have a simple way to solve the complexed problems. And, keeping the solution simply requires lots of work and challenge.
The tendency of programmers to offer something more to the users always complexes the simple solution. So, API programmers, don’t get wired up and introduce a thousand plans in one API. Try to make your API short, simple and on the mark.
#2. Offer Abstractions
Abstractions mean hiding all the codes from the users and only offering them essential codes to read. Abstractions means abound in the technology world. Normally, device drivers abstract detail information from the vendor hardware. Threading models provide an abstraction for worrying about scheduling execution at the OS level. The OS itself provides an abstraction over the differences in core computer hardware.
That’s why your API should have abstract to provide only useful codes to your users. If your user has to dive deep into your API code, then it means your API isn’t up to the mark.
#3. Make Your API Discoverable
Apart from having simplicity and abstractions, another thing that will make your API signify is the Discoverable trait. Yep, your API has to be easily discoverable by the user.
Let’s take an example, have you ever wondered why iPhone is more popular than regular button devices. Foremost, they have one large screen and a button plus all the features are easily discoverable on the main screen. And, that makes iPhone special from the UX interface.
So, to again the popularity like iPhone, you have to make your API easily discoverable by the users.
#4. API Must Be Consistent & Symmetric
Consistent mean keeps your API in the format as the user expected, but make slightly change the names. Like, it won’t make any difference if you refer “user” as ” customer ” sometimes. This way user can find the consistency with your API.
Whereas, symmetric means take slightly subtle route. Close your API loopholes in a manner in which the user is expected. For example, if you have an API for file access that lets you call Open(string filename), you should also offer a Close(string filename method).
#5. Adopt The Principle of Least Astonishment
The principle of Least Astonishment should be followed in a particular manner to have good API. Least Astonishment means that your API should behave in a particular manner as the users are expecting it to behave in the particular situation.
API Is A Product
Your API is a product, so should design it like a product. Where you should think as a user aka customer to better understand the needs of the user. And, introduce only users required features in your API.
So, consider all the simple, useful, discoverable, consistent, and predictable features of your API as all describe not only good APIs but good products.