What are JavaScript Libraries and how are they used?

JQuery is referred to as a programming language, but in the opinion of the JQuery team, it Is a JavaScript library. What, then, is a JavaScript Library? And we have referred to it as a framework in previous documents, but there is a reason for the difference.

Libraries vs Frameworks vs APIs

comparison of Libraries, Frameworks and API's within Javascript

JQuery is referred to as a library because it is JavaScript code, simply put into compact, reusable functions and is not its own discrete programming language. A library is just a whole script or multiple scripts in one place, and the JQuery functions simply replace that code in a given instance of a JQuery command or function usage. A framework is slightly different. In a framework, the codes and commands are derivatives of the natural language used to implement other sections of code. To wit, in an application framework, you might use a command to show a window, but that window has been programmed in a separate language or subset of the language. In JQuery, when you call a window, you are simply referencing the code that creates a window.

APIs are different, in that they interface directly with either a browser or with the operating system. Java is an example of an application programming interface (API). It has libraries, but the actual code takes place in the class you are programming in; only the objects are inherited. All the properties have to be defined.

Therefore, JQuery is simply taking your command, referencing a set of JavaScript code, and inserting it in the place of your command through the library. The JavaScript code performs the heavy lifting, and all you had to do was write a few lines of JQuery code.


Length of time to execute js Libraries in and out of JQuery

Most programming languages are pre-compiled. JQuery is different in that it is interpreted by the browser and its library commands are interpreted by the browser only when a page is accessed. There is no executable code, unless JavaScript calls it explicitly from a different location. The browser sees the JQuery code, accesses the JavaScript library function, pulls the library code, and executes that with the arguments given in the JQuery command. This means that unlike back-end or Server-Side Includes, the load of processing is borne by the user and not by the server. Only when the JavaScript code called references something else on the server does it require extra load on bandwidth and processing resources. Another feature is caching. When you use a JQuery function on multiple pages, it only downloads to the client once and can be reused.

To explain how this differs from a framework, a JQuery library function is executed at runtime only when it is called. A framework typically runs all the time and your programming is called from it rather than your program calling a function from a library.

Javascript Optionality

Java Library Options

Another feature of a JavaScript library is that it is optional. We could work entirely without JQuery at all. The expense of this is obvious. Every time we needed to invoke JavaScript, we would have to write every line by hand, regardless of how redundant. JQuery is an optional programming language, but because of the use of the JavaScript libraries, it is almost fundamental to an operation that maintains a large base of JavaScript code. Being able to put those JavaScript code fragments into libraries for later use and reuse means that we can write one line of JQuery and replace dozens of lines of JavaScript. But, due to the library nature of it, that code is still there. You just don’t have to manipulate it unless you want to change the library or create a new library that does something different.

Size of JQuery java libraries

Because libraries are text, and not pre-compiled binaries or programs, they are small. This saves bandwidth, and means that no matter whether it is a lightweight mobile version or a full desktop version it is smaller. We are not passing large amounts of data back and forth, and only those libraries that are called by JQuery get passed back and forth, and then once they have been called they are stored on the client side to be reused during that session and future cached sessions. This dramatically improves the speed and lowers the amount of traffic that takes place between you and the end user, and prevents having to have pre-compiled code that is compatible with a specific user. The library is the JavaScript equivalent of source code, which has been tested to be usable with all browsers, so you don’t have the worries of technologies like Active Server Pages which run within the .NET framework and other somewhat browser-specific technologies.

In our next tutorial, we will explore the differences between JQuery and other programming languages. JQuery is indeed a language, but it has some extreme differences between it and conventional languages as well as some similarities. After that, we’ll explore setting up a JQuery environment for you to get started developing front-end applications. Then, we’ll settle into syntax. There, you’ll get practice learning how to use the JavaScript libraries used by JQuery to your advantage. These libraries are what makes a JQuery programmer and helps them to be successful. Continue on to find out the key differences within JQuery that set it apart from many other coding languages.

We will be happy to hear your thoughts

Leave a reply

Coders Eye - Web Dev Tutorials and How-To Guides for Beginners
Enable registration in settings - general