Library vs Framework
As a Web Developer (and too being a Beginner), its one of the most hardest question you need to find the answer……
What is the difference between Library and Frame Work..??
It is a Question which has confused many professionals in their career whereas its the question which is also mostly asked in the interviews too..
I have gathered some information with real life examples to make you understand key differences between Library and Frameworks and i hope that it will help you a lot in understanding these two terms of the tech industry and you wont have to search about this topic anymore..
What is Library:
A Library is a Code which is written by Someone Else previously and can be called when you are building your own code, it means it is a collection of code packed together to use over and over again, which helps you to solve a specific problem or add a specific feature to your program.
What is a Framework:
A Frame work is also the Code written by Someone Else with the purpose of helping you solve common problems in easier ways. It is a supporting Structure where your own code defines the operations by filling out the structure.
By reading these Definitions you will definitely understand these two terms, but its still hard for you to know the differences between both of these, Here are some most noticeable differences between a Framework and Library..
Key Differences between Library vs Framework:
The Key difference between a Framework and a library is “Inversion of control”, You can control when to call a code and when to not from a library, but its just opposite in Framework, the Framework calls you..
There are many limitations in Framework, as it defines a skeleton where the application defines its own features to fill out the skeleton, whereas in library there are less limitations as you have to simply re-use an already written code by any developer and you can control the code and use wherever you need..
In Library you are the in-charge of the flow of the application, and in Framework, the framework is the in-charge of the code, it leaves blank places for you to write your code but its in the choice of framework when to call which code.
In easy words it can be expressed like..
Real-Life Example:
Think for a second you are at your home, how freely can you do things, there are some rules and regulations but no too much like you have to face in your office or university..
The limitations you face in Office or University are much more than the life at your home, there is a dress code you have to follow , you have to be punctual, in short there are many limitations which you have to face, the same case is there between Framework and Library, in Library you have the whole command in your hand, whereas in Framework you have to adjust yourself in the rules and limitations given by the structure..
Suppose you have to build up a house, and the tools like hammer, nail gun are your libraries, you have to use them in constructing the house, and you can construct any thing you want, like , chair ,table, etc.
But in the framework there is a difference, the supporting structure will be the framework, which will dictate you how to construct your project and you have to follow every command from it, you can use libraries in framework but you are not dependent on libraries only.
When there are more Rules there are more chances of it to be a Framework, and when there is more freedom it is expected to be a Library
Some popular Frameworks and Libraries:
Popular Frameworks: Rails, Angular, Django, Express
Popular Libraries: React, jQuery, Lodash, Redux