Library vs API vs Framework
Hey, everyone, how’s it going?
Actually, the purpose of this post is just to bring a little bit of light into this vast world of programming. Often, terminologies have terms that complement each other or have a lot of overlap. But let’s try to “separate” some responsibilities.
Just a disclaimer: these definitions I’m going to mention here are more the result of day-to-day experiences rather than necessarily the product of rigorous scientific research, okay? So, here we go:
Library
In general, a library is a set of generic functionalities grouped into files (classes) that can be used in any program in any way. For example: the Java Math class library that contains a bunch of calculation functionalities. Simple, easy, and quick.
API – Application Program Interface
A set of libraries (expanding on the previous concept) for creating applications in a more robust manner. APIs generally offer more than just a library and are intended to provide methods for integrating different applications. For example: a database connection API, which provides libraries for sending SQL commands, data conversion, etc. Or even a system that provides its libraries so that developers can create their applications in integration with the system in question (such as the Google Maps API).
Framework
I often call Frameworks “APIs with a usage manual,” meaning they serve specific purposes (Web Framework, Game Development Framework, etc.). You can use a set of libraries as you wish, APIs are also used as you wish, but with a more specific purpose. Now, frameworks, if you don’t strictly follow their purpose and their “manual,” you’ll hardly be able to do anything with them. Want an example? Angular is a framework. If you don’t organize your web page into components (which is the way Angular advocates building Single-Page Applications – page components composed of HTML structure/CSS style/TypeScript code), you can’t do anything with it.
Did it help?
Feel free to share it with your friends if you’d like!