JQuery critique (dis)continued
Some time ago I posted a not so nice attack on jQuery, which I removed. Before that I posted a critique of jQuery that I myself find constructive and informative, but was nonetheless a bit random and incomplete. Moreover, it was also a shameless plug for a new technique I created myself: a stack-based, concatenative language that parses to Javascript in the browser. However, I have stopped working on it, as I think that stack-based languages are hard because of the mental bookkeeping you have to do on the stack. Sure, that is a perfect brain trainer, and there are ways to make the exercise less cumbersome, but I don't expect a mere fraction of jQuery users will ever warm up to such a niche technique. To cut it short, this introduction serves as an apology to both the reader and the user of jQuery, for whom it has created huge opportunities. But now to end my critique of the bling chain once and for all.
First of all, I'm no user of jQuery and never have been. The reason for my crusade against it has been the isolation I experienced in relation to the community of fellow web developers that created content based solely on jQuery. It would have been beneficial to my work (and perhaps that of others) if a more open technique would have been embraced. I've never found a community that completely fitted into my personal view, but the overall enthusiasm the past years for jQuery has put me off again and again. I know that at the moment the world of web development is going through a major shift, and my critique has become less relevant. However, I would like to put it out there, to try and prevent developers from making the same mistake in upcoming solutions.
JQuery is a catchall. You can just throw anything into $() and you don't have to care what comes out at the other end of the chain. You use .get() to evaluate the result, which can be anything, from a DOM node to an event handler. I suppose this is simply caused by organic growth of the library: first it was just a uniform way to query and transform DOM, but as the library grew, so did the types of data that were processed in this style. The uniformity obviously served a purpose back when you had so many browser incompatibilities, but it was never a good programming practice to begin with, as type systems have mattered since the dawn of computation. Actually, proper typing and other standards have probably been slow to develop in Javascript because of the popularity of jQuery. I think a lot of people underestimate the damage it has done, because it lacks any formalization, mainly regarding but not limited to the following:
Anecdote: I once came across a widget where an XMLHttpRequestUpload instance was thrown into $() just so bind() could be called. Imagine doing that with document.querySelectorAll... The point here is that typing doesn't necessarily has to be enforced, but using a tool that doesn't even adhere to best practices in this regard should not have been allowed to become this successful. It shows what little formal knowledge its large user-base has, and I don't say this to insult anyone. To conclude, I found a video on the internetz from 2012, where a designer makes some valid points about jQuery. Though not from a formal background, the speaker instinctively finds some flaws that I need not repeat here, but in my opinion the community should have taken note of back then.
https://youtu.be/3D1WeSCSkPQ
First of all, I'm no user of jQuery and never have been. The reason for my crusade against it has been the isolation I experienced in relation to the community of fellow web developers that created content based solely on jQuery. It would have been beneficial to my work (and perhaps that of others) if a more open technique would have been embraced. I've never found a community that completely fitted into my personal view, but the overall enthusiasm the past years for jQuery has put me off again and again. I know that at the moment the world of web development is going through a major shift, and my critique has become less relevant. However, I would like to put it out there, to try and prevent developers from making the same mistake in upcoming solutions.
JQuery is a catchall. You can just throw anything into $() and you don't have to care what comes out at the other end of the chain. You use .get() to evaluate the result, which can be anything, from a DOM node to an event handler. I suppose this is simply caused by organic growth of the library: first it was just a uniform way to query and transform DOM, but as the library grew, so did the types of data that were processed in this style. The uniformity obviously served a purpose back when you had so many browser incompatibilities, but it was never a good programming practice to begin with, as type systems have mattered since the dawn of computation. Actually, proper typing and other standards have probably been slow to develop in Javascript because of the popularity of jQuery. I think a lot of people underestimate the damage it has done, because it lacks any formalization, mainly regarding but not limited to the following:
- what the input is that $ operates on
- what types are allowed in that input
- what the types are of the throughput
- what the semantics are that operate on the throughput
- how to consistently extend those semantics
Anecdote: I once came across a widget where an XMLHttpRequestUpload instance was thrown into $() just so bind() could be called. Imagine doing that with document.querySelectorAll... The point here is that typing doesn't necessarily has to be enforced, but using a tool that doesn't even adhere to best practices in this regard should not have been allowed to become this successful. It shows what little formal knowledge its large user-base has, and I don't say this to insult anyone. To conclude, I found a video on the internetz from 2012, where a designer makes some valid points about jQuery. Though not from a formal background, the speaker instinctively finds some flaws that I need not repeat here, but in my opinion the community should have taken note of back then.
https://youtu.be/3D1WeSCSkPQ
Comments
Post a Comment