Is JavaScript and JQuery Synonymous?

I realized, while reading through Stack Overflow, the fundamental misconception amoung many new programmers when it comes to JavaScript. There are questions on Stack Overflow which ask how to accomplish fairly simple tasks such as scrolling the window or getting the current page's URL using JQuery. This isn't a problem, except for the fact it's easier to do this in pure JavaScript!

Have we become so accustomed to needing libraries for everything that we've forgotten these libraries are based upon an underlying language? Why is it, the next crop of aspiring programmers seem to view libraries as magic rather than abstraction? Are they lazy or do they not realize on a fundamental level anything which can be done in a library can be done on your own?

To use a direct comparison: anything which JQuery can do for us, we can do without JQuery. So why is it, then, we've become so dependent on doing all of our programming tasks with a library? Don't get me wrong, I fully understand the benefits of using a library, and I love Jquery, but there's a problem when we install a library just to help us with some string operations.

I've seen projects where developers are including a dozen javascript files on a page, some of which only contain a few functions. Don't they know how to code these functions on their own? Well, unfortunately, the reality is they don't. When a Google search for a JavaScript library which accomplishes a specific task almost always returns a few results, there's no need for developers to learn how to do it on their own.

Now, we're presented with a catch 22. Libraries are great, useful, and the epitomy of DRY programming, but only when the developer can understand what's going on under the hood. The moment a developer simply accepts a library is performing magic rather then understanding what's happening, is the point where the whole community falls apart. Unfortunately we've hit that point.

So many people use JQuery because they are either incapable of understanding what's happening behind the scenes, or because they don't care to know in the first place. I'm not suggesitng a developer has to understand each and every algorithm a library uses, but for instance, in JQuery, simple selectors are like magic to many developers.

I've talked to people who don't realize $('#test') is a concise way of calling a constructor and passing in a string parameter '#test'. To make matters worse, those same people don't grasp this syntax is simply, in essence, a short form of saying return document.getElementById('test'); I've heard of developers installing JQuery just to use this selector syntax in one or two spots! Well, that's an awful lot of page load overhead which could have been avoided if those developers had simply understood what $('#test') is doing behind the scenes.

I don't want it to seem like every developer has to understand what's going on all the time. I also don't want to insinuate not knowing what a library does behind the scenes is the worst thing. But, without these fundamental understandings, this problem is only going to spread like a plague to future generations of programmers to the point where hardly any new programmers understand JavaScript because they only understand JQuery.


Shawn Clake

Freelance Developer

Software Engineering Student - U of R

Current: Assistant to Manager of Instructional Tech - U of R

Web|Unreal|C++|Java|Python|Go

Web: http://shawnclake.com

Email: shawn.lavawater@gmail.com

Email 2: shawn.clake@gmail.com

Posted in Technology on Feb 09, 2017