Frameworks vs Libraries

Githmi Vithanawasam
4 min readOct 19, 2020

What is a library? What is the framework? What is the difference between these two? — one of the major confusion most developers have.

Frameworks and Libraries
Frameworks vs Libraries

Frameworks and Libraries? Both of these words are always in IT undergraduates’ mind. By the time new technologies and trends are coming to the tech industry, and people try them out in their implementations to make new versions of applications.

Like that, new frameworks and libraries are creating around the world, and community groups are building around them according to developers’ choice. But some confusion is always struggling in my mind when I discover about these technologies.

What is a library?
What is a framework?
What is the difference between these two?

These confusions are having with most of the developers, and they have their ideas about them. I thought of sharing the knowledge of what I learned about them with you.

Frameworks

“In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software.”
- wikipedia.org -

It means a framework is a platform for developing software applications that support or guide to building something useful. These can have predefined classes, functions that can use to process input, manage hardware, and interact with the system software. Framework only defines the concept. But the functionalities which beneficial for end-users are identified by the application that uses a framework.
ex:- Vue.js, Spring, Hibernate, Angular, Node.js, Laravel, CakePHP, Django, Rails, Express

Several frameworks
Several frameworks

Libraries

“In computer science, a library is a collection of non-volatile resources used by computer programs, often for software development. These may include configuration data, documentation, help data, message templates, pre-written code and subroutines, classes, values, or type specifications.”
- wikipedia.org -

A library is a collection of files, programs, scripts, functions that can use in a program code. They are mostly useful for storing frequently used routines. The linker automatically looks in libraries for routes and connect them. Most of the programming languages have their libraries to use in codes to reduce DRY (Don’t Repeat Yourself).
ex:- jQuery, Parsely, PHPUnit, Swiftmailer, Faker, Maven, Mockito, TensorFlow, React, Redux

Then what is the main difference between them?

Difference between a framework and a library
Difference between a Framework and a Library

“Inversion of Control” (IoC) is the main difference between a framework and a library.
When programmers are using a library in programming, they are in the control of program flow. The programmer will call the necessary methods at relevant places according to his plan. We call the library to our program code when the programmer wants.
But when programmers are using a framework, the control of the program is out of the programmers’ hand. The framework will handle the flow of the program. It calls us to the code where it wants to add relevant parts.

Frameworks

- Supporting structure for our code
- The framework has the power to call the code
- More number of rules
- Less freedom to handle the code
- Frameworks can contain libraries

Libraries

- Collection of code can use over and over (re-usability)
- The programmer has the power to call the library when they want
- Less number of rules
- More freedom to handle the code
- Libraries can’t contain frameworks

Those are the differences between a framework and a library. I hope now you all have a better idea about a framework and a library. Now we can figure out what we want to use in our implementations without confusion.
Thank you for reading my article.

REFERENCES

--

--