Categories
General

Software Library vs API

Difference between Software Libraries and API(Application Programming Interface) could be complicated for new programmers. In this blog topic, I will try to simply explain the main differences between them.

First of all, the Software Library is a stack of code that shared by programmers to help other programmers. With that shared codes you can develop software faster, simpler and without falling into repetition.

On the other hand API is a little bit different. I will try to explain it with examples. Think that some professional software developers created a library for image processing. You got that library and you only want to resize your image. Question is which function does this job in library? Or does it really has it? OK. Nothing is cheap; lets read library source code and search for resize. We found lots of resize function named like resizeImage, resize, _resize etc. For a basic function everything getting messier right?

API is ready for help like that situations. Same software developer team also write an API for you with documentation which prepared good or bad. Now at least you can only find resizeImage function inside document. Because the developer team only exported resizeImage function and documented it; other functions are only for internal working mechanism.

After you start to use API(Imagine it is only top level header which named imageProcessLib.h) you only called resizeImage API function then API called other functions to resize your Image.

TL;DR version,

API is a guy that know what should he do. You gave him a job to do some work. He found workers, make them do your job and gave you a finished product.

The roles in this mini-story:

The Company which the guy and workers work = Library,

The guy know what should he do = API,

Company brochure = API Documentation,

Workers = Library functions, classes, variables, etc.

I hope you get the difference between Library and API. You can always make corrections or additions using the comment section.

Thanks for reading.

By Emre Anıl TERZİOĞLU

Embedded Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *