06/01/2024
Framework vs Library
A framework is a supporting structure that gives shape to your code.
In the Framework, you have to fill the structure accordingly with your code. While
A Library is a set of code that was previously written by a developer that you can call when you are building your project.
In simple words, a bunch of code packed together that can be used repeatedly is known as Library.
The Technical Difference:
The technical difference between a framework and library lies in a term called inversion of control.
When you use a library, you are in charge of the flow of the application. You are choosing when and where to call the library. When you use a framework, the framework is in charge of the flow. It provides some places for you to plug in your code, but it calls the code you plugged in as needed.
One thing to remember here is that frameworks sometimes get quite large, so they may also use Library.
Framework doesn't necessarily have to use Library.
ANALOGY:
Think of a carpenter who needs to build a table.
Now, you can build a table without the help of tools, but it's time-consuming and a long process. Whereas, if you choose the correct tools, you'll be able to build a table more quickly and without any hardship.
Think of the tools as a library. Remember you can write your program without them.
Furthermore, if the Carpenter wants to build a table, then he needs a model or skeleton for how the table will look like. He can choose to build the table to have four legs and a top slab. Now, this will be the core structure of the table and he has to work accordingly in following that structure.
Similar to this is how a framework can be described. Framework also provides the structure, and you have to write the code accordingly.
BENEFITS OF FRAMEWORK:
Helps you save time and effort.
Gives you a simple coding blueprint to follow.
Allows you to concentrate on tasks unique to your project.
Produces neat and flexible code
BENEFITS OF USING A LIBRARY