The Difference Between a Library and a Framework

2 min readJan 5, 2021


Library and Framework are the two most important terms that are used in many tech companies, and you already heard about them.

So, Let’s get started so I am going to cover what is a Framework and Library? and the difference between them. This topic is so important being asked in programming interviews so you need to understand it thoroughly.

What is a Framework?

In Framework, we have predefined classes and functions that can be used in our projects or a set of rules and beliefs which we use in our applications. We can not go out from it we have to follow all the rules.

What is Library?

A Library is a collection of code that we can call upon when building our own projects. In Library we set our own rules, we do not need to work under the rules as much we do in Framework.

So, Let’s discuss the differences with some examples.

So we have rules in the Framework and in Library but the framework is like your school and a library is like your home. For Home we have fewer numbers rules and for school, we have many rules which must be followed. For example, In school, there are allotted places for everything like for students and for teachers. We are not allowed to change it, In short, we are bounded by rules. On other hand, In Our Homes, we have fewer numbers of rules which are built by us. Let’s move on next example In the above definition of Library I mentioned that In Library we call a library so whenever we call any library we have the power to call a library whenever we like on the other hand framework is actually calling your code.


Frameworks and libraries are written by someone else that helps us in our projects. Framework tells us what we need but we call the library whenever where ever we need it.

Thanks for reading!




Student of Information Technology & JavaScript Developer

Recommended from Medium


See more recommendations