Hacker News new | ask | show | jobs
by hawkharris 4534 days ago
If learning JavaScript feels like jumping into the ocean and trying to swim for the first time, jQuery is, in some ways, like a motor boat driving beside you. The driver says, "Hey, hop on in. Why learn the basics of swimming when you can start covering ground?"

Speaking from experience, failing to learn the foundational aspects of the language in the beginning leads to a lot of poorly organized "spaghetti" code. It took me a lot longer to appreciate concepts such as closures and the nuances of DOM events because I relied on jQuery to do the heavy lifting for me.

Having said that, I have a lot of respect for John Resig and his essays / books (i.e. Secrets of the JS Ninja). After taking the time to learn about Resig's functional programming style and the design decisions underlying jQuery, I gained a much deeper appreciation for both the library and plain JavaScript.

2 comments

I actually found that using backbone.js helped more with learning how to structure an app and about working with objects than writing vanilla javascript.

I was writing single-page applications just before jQuery was introduced, and I can tell you, my code was spaghetti because I didn't understand OO or functional design patterns. I didn't find jQuery to be a massive improvement in that, because I just linked data to DOM elements and everything was still all over the place.

Backbone forced me to write javascript in a cleaner way, even when I still didn't know what I was doing. I was breaking up my code into better methods and providing a better overall structure to my apps.

Now with Angular, I've taken that a step further to modularizing code, but I don't know how well I would have gotten on with Angular if I hadn't first learned so much from Backbone.

One of the main Problems with JavaScript is not the language itself, but the browser implementations. It was a huge pain to write cross-browser code when jQuery came out. jQuery took away a lot of these efforts and certainly had influence on the things you can do in modern browser these days, e. g. document.querySelector.

While I don't read your comment as a criticism of jQuery, I feel that jQuery gets bashed too often these days for insufficiencies in code. In the vast majority of cases such insufficiencies are not caused by the libraries, but by the developers using them.