June 21, 2020, 7:55 p.m.

Library vs Framework - what is the difference between a library and Framework ?

In this article we are talking about the great subject of "what is the difference between a library and Framework?" Yes you might have already touched that subject looking at the definition about the library as well as in the Framework.
But those definitions are not all able to give you the whole perspective and is not able to make you understand what actually the individual subject means and also this is a common topic being asked in a variety of interviews as well the programming interviews as well. So it can be really helpful that you thoroughly understand what is the difference between a library and framework. Trust me after reading this article you won't be searching for this topic anymore further.


Now Let me tell you what the issue is, the issue is many time people try to just say understand what is a library and then try to understand what is a framework and you'll get bored the answers there, but it is not the perfectly correct thing. You need to understand both the things side by side.

If you look out into any definitions of Wikipedia or something like that. You will find a quiet a common definition which is "a collection of library is Framework" which can be true or cannot be always true. So to understand both sides by side, I will give you two examples here the II example will make much more sense but in order to understand that second example let's move onto the first example first.

Example 1 Library and Framework both of them are dependent on the rule, one is your home and another one is just like your school or university . So I am making an analogy here that your school is your framework and your home is just like your library. Here is my point when you have less number of rules it is more likely that it is going to be possibly a library and when there are more number of rules then there are chances that it's gonna be a Framework.

For example, in your home, you can just through off your t-shirt wherever you like and you can just place your bag whenever you like. But when you go to school or university there are fixed places where you put your bag, there are fix places (most of the time) that you are setting up, your marker for your the teacher has a fixed place that is gonna be there.

There are some options that you can change them like here or there a little bit, but it's always gonna be closer to the teacher. So that's more like you are bounded by more rules, while on the other hand at home there is less number of rules. Yes, you may like to follow some rules but most of them are built by you.

So the library is moreover like your home. It's like whatever I want to do, I am gonna be doing it. And similarly on a Framework is more bounded by the rules, that you are only allowed to do certain kind of things yes you can go ahead and change all of them but it takes time and all such things.


Example 2 The second example is moreover code-oriented and the people who are associated with little bit kind of the code even like simple JavaScript or jQuery will be able to understand it much more better. Now a simple library, the library simply a collection of codes obviously, some functions or some like document object model or all such things are being packed together and is being used over and over, That's basically your library is.

Now try to understand in this manner, whenever you are making a call to any library that is most likely to be a library so whenever you have the power to call the code whenever you like, that is simply a library. On the other hand in the Framework actually your framework calls your code and further your code can call to a library maybe.
But notice the difference here, in the library you are making a call to the library. But in the framework, Framework is actually calling to your code.


So just understand in this manner I'll take another very beautiful example which is a difference between jQuery and simply Django. In both of these things whenever you want to make a call to a jQuery library, you can make it. On the other hand in the Django, there is the most restrictive environment. For example, your templates folder should always be named as a template. Can we change it??... Yes of course but it requires digging up into the settings files or digging up the framework.

It's most likely that you are gonna be calling your templates folder always as templates because that's what Framework is telling you to do.


So if somebody next time ask you ....it's all about the rules. When we have more freedom that means more chances that its gonna be a library. When there are more destructive rules then there are gonna be great chances that it can be a framework. And again who is calling to whom is a great way of getting the sense that what it is? A library or is it a Framework. If you want to get an example always in your head just remember jQuery and Django. jQuery is a library and on the other hand your Django is a Framework.








Some recent posts



Complete process of changing database from SQLite to MySQL - How to migrat...

" How to download a file in django | Making a large file downloadable from ...

How to use proxy in python requests | http & https proxies - Scraping...

Top Django Querysets, How to filter records | Fetching data from database e...

How to change base url or domain in sitemap - Django ...

How to Make a Website - Everything you should know about web development...

What is Javascript - Features and usages ...

Top 5 Interview Questions : Tips for HR round ...

How to get job in IT : Perfect resume guide for IT job ...

Programming vs coding | difference between programming and coding ...



View all...