jQuery and its cousins are great, and by all means use them if it makes it easier to develop your application.
If you’re developing a library on the other hand, please take a moment to consider if you actually need jQuery as a dependency. Maybe you can include a few lines of utility code, and forgo the requirement.
The site itself didn’t seem particularly exciting or controversial. We’ve seen these sorts of comparison before, and frankly claiming that you “might” not need jQuery is an awful innocent statement to make.
But the reaction was more divided than I expected with many getting a little worked up about the site. Which of course causes me to wonder—if suggesting we “might” not need a technology can cause such a heated discussion, perhaps we “might” be just a little too attached to it.
It’s not that I don’t like or use libraries and frameworks. I do. In fact, I use tools like jQuery and Ender quite frequently. A good library brings the benefit of being well-tested, documented (well, in some cases at least) and can be very helpful for complex functionality or when working in a team environment.
What worries me is that for many, libraries have become the default. They’re rolled into boilerplates and pattern libraries as an assumed dependency. And if we know anything about default settings, it’s that most people will stick with them. This undoubtedly leads to many projects incurring this overhead without every giving consideration to whether it is really necessary.
Compare those numbers to the start of the year and we see an alarming trend. Script weight is up 28% from the start of the year on desktop pages and up 22% on mobile.
This is concerning, but it’s not just download sizes that you should be worried about. In a presentation given at Velocity in 2011, Maximiliano Firtman pointed out that on some phones (older, but still popular, BlackBerry devices for example) can take up to 8 seconds just to parse jQuery. More recent research from Stoyan Stefanov revealed that even on iOS 5.1, it was taking as many as 200-300ms to parse jQuery.
Performance is not the only concern. At times, the abstraction that libraries and frameworks provide can actually be harmful. Without an understanding of the underlying language in use, it can confuse developers as much as it aides them.
I’m know I’m picking on jQuery, but that’s primarily because of its un-paralleled popularity. My concerns with starting with a library as a default method of coding are not confined to any one library in particular.
It seems this is a tricky topic to approach because it is so often viewed as being black or white: you’re either against frameworks or you’re opposed to them. Like so many topics, people can get religious about this stuff. But it’s not about what is the right™ way to do it: it’s about using the best tool for the job and arming yourself with the knowledge necessary to make that determination.
I’m not saying that we stop using libraries altogether—and neither were the people who created “You Might Not Need jQuery”. I’m suggesting we make that decision with a great deal of care.