+ 3
What is the difference between a Javascript library and a framework?
Can someone please explain the difference between a Javascript library (like React) and a framework (like Angular)? In which situations is it better to use Angular or React? With the answer I hope to decide which I should study first. Thanks in advance!
2 Antworten
+ 4
Library
A library is a reusable piece of code which you use as it comes i.e it does not provide any hooks for you to extend it. A library will usually focus on a single piece of functionality, which you access through an API. You call a library function, it executes some code and then control is returned to your code. An example of a good Java library (or libraries in this case) is Apache Commons.
Framework
A framework is a piece of code which dictates the architecture your project will follow. Once you choose a framework to work with, you have to follow the framework's code and design methodologies. The framework will provide you with hooks and callbacks, so that you build on it - it will then call your plugged-in code whenever it wishes, a phenomenon called Inversion of Control.
+ 5
A library is essentially a set of functions that you can call, these days usually organized into classes. Each call does some work and returns control to the client.
A framework embodies some abstract design, with more behavior built in. In order to use it you need to insert your behavior into various places in the framework either by subclassing or by plugging in your own classes. The framework's code then calls your code at these points.
For more details you can see below link:
https://www.quora.com/What-is-the-difference-between-a-JavaScript-framework-and-a-library