Difference between Framework & Library

Denny Mathew
2 min readDec 27, 2022

A library in computer science is a collection of pre-written code that developers can use to build software applications. It provides a set of functions, classes, or other code constructs that developers can call upon to perform specific tasks or operations.

A framework, on the other hand, is a set of conventions, protocols, tools, and techniques that provide a structure for building and developing software applications. It provides a common set of rules and guidelines that developers can follow when building applications, and it helps to ensure that the resulting software is functional, reliable, and maintainable.

There are a few key differences between libraries and frameworks:

Control: A library provides a set of functions or classes that a developer can use to perform specific tasks. The developer has complete control over how these functions are used and can call upon them as needed. A framework, on the other hand, defines a set of rules and conventions that the developer must follow when building an application. The developer has less control over the overall structure and flow of the application.

Inversion of Control: A library allows the developer to call upon its functions or classes as needed. In contrast, a framework dictates the overall structure of the application and calls upon the developer’s code to perform specific tasks. This is known as “inversion of control,” as the control flow of the application is inverted compared to a library.

Extensibility: A library provides a set of functions or classes that can be used as-is or extended as needed. A framework, on the other hand, often requires the developer to define custom subclasses or implement specific interfaces in order to extend its functionality.

Overall, the main difference between a library and a framework is the level of control and flexibility that they provide. A library is a collection of standalone code that a developer can use as needed, while a framework provides a set of conventions and guidelines that the developer must follow when building an application.

--

--