What is the difference between a JavaScript framework and a library?

Possible duplicate:
Framework vs. Toolkit vs. Library

I would like to know what is the difference between a JavaScript framework and a library using some example.

For example, jquery, backbone.js and jasmine are a JavaScript framework or library? And why?

Can you give an example of the JavaScript structure and library using the Don't call Us, We'll call You. clause Don't call Us, We'll call You.

+43
javascript jquery
Jul 20 2018-12-12T00:
source share
6 answers

Even this question is very subjective, my personal opinion about these two is as follows:

  • Framework : this describes the given structure “how” you should submit your code. To a large extent, like a code template, some helpers, designers, etc., to solve / simplify a specific problem or bring your architecture in order. Examples, "Trunk", "requireJS", "socketIO".

  • The library . This is a whole set of tools that strongly abstracts different layers, such as browsers / DOM models, etc. As well as a good toolkit, it offers many tools and neat things to work with, which generally simplifies your coding experience. Examples of "jQuery", "MooTools", "YUI"

+49
Jul 20 2018-12-12T00:
source share

I agree with jAndy, in my opinion, the framework imposes a structure on your code to solve a specific problem, and the library is a common set of tools that help you in different tasks, without requiring the solution of the same problem.

In this respect:

  • jQuery is a library because it abstracts a lot of browser incompatibilities, but doesn't impose any structure on your code.
  • underscore.js is a library because it is a collection of utilities for managing data structures and other positive effects.
  • backbone.js is a framework because it structures your front-end code according to the MVC pattern.
  • Jasmine is a framework because it structures your code so you can easily make BDDs.

As for your proposed example, the framework is suitable for the don't call us paradigm, because most of them impose a stream of code (a kind of control inversion ). You call libraries, they do not call your code.

This is a subjective opinion, so take it as such.

+28
Jul 20 2018-12-12T00:
source share

The structure encapsulates the overall functionality of the application, allowing the developer to focus on those parts that are unique to their application. This means that the developer writes code fragments that are called by the infrastructure when different things happen; Example: backbone.js or jasmine . Libraries are packages of code that your application typically invokes to complete a task, such as DOM manipulation or HTTP requests. Example: jQuery .

+2
Jul 20 2018-12-12T00:
source share

The JavaScript library is a library of pre-written JavaScript that makes it easier to develop JavaScript-based applications.

and some JavaScript libraries, such as YUI, are classified as frameworks because they have the capabilities and properties of a full stack that are not found in shared JavaScript libraries.

0
Jul 20 2018-12-12T00:
source share

JavaScript is a scripting language.

JQuery is a JavaScript library that handles many commonly used functions and also handles differences between, for example, Internet Explorer and standardized browsers. This is something you can use to reduce the amount of work involved in building web applications.

0
Jul 20 2018-12-12T00:
source share

There is no real definition of the difference between the two, but in general, I would say that structure is a more general thing with several tools than a library, which is usually very specialized.

For example, Sylvester is a matrix and vector math library . This is very specific in its functionality.

A framework , such as Prototype , offers much more than just a limited set of very specialized functionality. It can even use or consist of several libraries inside.

Important: In the end, people use the "framework" and the "library" as they see fit. Unfortunately;)

0
Jul 20 2018-12-12T00:
source share



All Articles