DEV Community

Discussion on: What is the ONE language/framework you refuse to use? But...WHY???

 
fjones profile image
FJones

It's still a spurious distinction. Where's the line between a library and a framework?

The best delineation I've heard yet is that a framework is involved in process control, and a library isn't. But then we look at how jQuery was actually supposed to be used, and suddenly it fits that framework definition awfully well.

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

We have tones of information online, just split what is an opinion and what is not.

As you suggested, a key difference between a library and a framework is "Inversion of Control".
When you call a method from a library, you are in control. But with a framework, the control is inverted: the framework calls you. Both of them define an API for programmers to use.

That's why jQuery, React are libraries while Angular or Vue are frameworks (as examples).

When you are developing an Angular App you create code that Angular will call to proceed.

In React you directly use React methods/functions in order for it to work, otherwise it's plain JS or invalid JS.

Same happen with jQuery, you need to actively call jQuery methods to perform actions.

On the other hand, other key differences are:

A framework tries to provide a complete solution on its environment (check Angular Reference), you'll see animations, a bunch of http-related methods, formatters, internacionalization, factories, forms, SSR...). While a library covers one or a little amount of features (check React Reference) you'll see a little bunch of functions, some of them are just HoFs to bring some extra thingy but related to the same.

You can also check this explanation from freeCodeCamp:
The Difference Between a Framework and a Library.

Have a great day