What is the difference between a plugin and a Javascript library?

Asked

Viewed 320 times

3

I have recently studied a lot front-end in the vast world that is web programming and by installing some new functionality on the sites I developed I realized that some authors called their project . js library and other plugin.

I would like to differentiate a plugin from a library and vice versa.

As for terminology, what’s the difference between plugin and library?

2 answers

2

Basically:

A PLUGIN is a component that adds functionality to an existing program (according to Wikipedia)

One LIBRARY is a set of routines and methods that can be used to develop software

1

In a web context, I see these two terms being used differently. From the definition:

  1. The plugin is a type of intrinsic extension to the context. She can be used only in that context and cannot be unplugged to put in another. It’s like a browser plugin as it will work only in that browser. Or a plugin for jQuery, which will only work with jQuery, and not alone.
  2. But the library is a kind of agnostic extension to the context. Her can be used anywhere with a Javascript Runtime (or up to without) and can be easily unplugged and placed in another context. As if it were a joker. An example is jQuery itself, that works in any context that has a Javascript engine.

Therefore, we can infer that:

  1. A plugin consumes code or Apis from the main application. Browser extensions consume Chrome Apis, for example. Or jQuery plugins consume jQuery Apis.
  2. The libraries are consumed by the main application. If you have the jQuery library, your program consumes your Apis, such as $('div').remove.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.