LIBRARY VS FRAMEWORK
Mince

Mince @mince

About: I am currently making a game named Monsters ahead. I am a great web developer and am a decent roblox game dev. Follow me to get awesome posts to your inbox.

Location:
INDIA
Joined:
Jul 14, 2023

LIBRARY VS FRAMEWORK

Publish Date: Feb 11
6 3

So, many people get it wrong between libraries and frameworks. Today let's break it down quickly.

Libraries

Library

Libraries improve or provide a specific functionality. They solely focus on that single functionality and do not got out of spectrum. Like a library does not try to improve the whole mathematics capabilities of the programming language. It rather tries improve algebra only. In simple words a library can provide a solution to a specific problem that occurs while building an app

Example: Socket io, NumPy

Framework

Frameworks

Framework are similar yet completely different from libraries. Frameworks provide a backbone to build an entire app. They simplify the whole project building process rather than focussing on a single problem. So, they don't have a limited spectrum and they are not as perfect as libraries. In simple words, A framework acts like the whole bone system of your body providing a framework to build on

Example: Flask, Django

Example

python

As discussed, if the framework if like the whole of the bones of your body, a library is a single organ. Framework provides support while library provides functionality. This is the primary difference between libraries and frameworks

Conclusion

Hope you understand my explanation, If you didn't please tell me what you couldn't understand. If you did, can I get a heart pls.

Anyway, have a productive day ahead

Comments 3 total

  • Lucian Lature
    Lucian LatureFeb 11, 2025

    The Hollywood Principle ("Don't call us, we'll call you") perfectly illustrates a key difference between libraries and frameworks:

    • Libraries: YOU call THEM. You maintain control of the program flow and decide when to use the library's functionality. Like calling an actor's agent to book them for your movie - you're in charge.

    • Frameworks: THEY call YOU. The framework controls the program flow and calls your code when needed. Like Hollywood calling actors for roles - the framework is in charge (deviq.com/principles/hollywood-pri...).

    Example:

      // Library approach - You're in control
      import _ from 'lodash';
      const numbers = [1, 2, 3, 4, 5];
      // YOU decide when to call the library
      const doubled = _.map(numbers, n => n * 2);
    
      // Framework approach (React) - Framework is in control
      class Component extends React.Component {
        // Framework CALLS your code when it's ready
        componentDidMount() {
          // Your code here
        }
        render() {
          // Framework decides when to render
          return <div>Hello</div>;
        }
      }
    
    Enter fullscreen mode Exit fullscreen mode

    This inversion of control is why frameworks often require more upfront learning - you need to understand when and how the framework will call your code .

    • Mince
      MinceFeb 11, 2025

      That was really great explanation

      • Mince
        MinceFeb 11, 2025

        Better than mine, I reckon

Add comment