Framework vs Library?

Akash Deep Vishwakarma
2 min readMay 17, 2024

--

Framework vs Library

Do you know?

Angular is a 'Framework' of Javascript and React is a 'Library' of Javascript.

Do you know the difference between the terms 'Framework' and 'Library'?

Let's learn.

Both frameworks and libraries are code written by someone else that is used to help solve common problems.

1. Library:

  • ✅ Definition - A library is a collection of pre-written code that you can use to perform common tasks.
    A library is like going to Ikea. You already have a home, but you need a bit of help with furniture. You don’t feel like making your own table from scratch. Ikea allows you to pick and choose different things to go in your home. You are in control.
  • ✅ Usage: You call a library to use its functions, classes, or methods in your own code.
  • ✅ Control: You are in control. You decide when and how to call the library.

2. Framework:

  • ✅ Definition - A framework is a larger structure that provides a foundation and guidelines for building applications.
    A framework, on the other hand, is like building a model home. You have a set of blueprints and a few limited choices when it comes to architecture and design. Ultimately, the contractor and blueprint are in control. And they will let you know when and where you can provide your input.
  • ✅ Usage: A framework dictates the architecture and flow of your application.
  • ✅ Control: The framework is in control. It calls your code at certain points (often referred to as "Inversion of Control").

📌 Key Differences:

  • ✅ Control:
    - Library: You control when and how to use the library.
    - Framework: The framework controls the flow and calls your code as needed.
  • ✅ Structure:
    - Library: Provides specific functionality that you can use anywhere in your code.
    - Framework: Provides a blueprint for building applications, often enforcing a particular structure and workflow.
  • ✅ Size and Scope:
    - Library: Typically smaller and focused on a specific task (e.g., data manipulation with Pandas).
    - Framework: Broader and more comprehensive, covering multiple aspects of application development (e.g., web frameworks like Django or Flask).

👉 Conclusion:

In summary, think of a library as a toolkit you use as needed, and a framework as a foundation you build upon, which guides the development process and dictates the overall structure of your application.

--

--

Akash Deep Vishwakarma

Specialist Programmer (SDE) @ Infosys | Java | Kotlin | TypeScript | Angular | Spring | Spring Boot | Android Developer