From 7b78564440a2fcb2e77e2d6d3e461f45e722f92e Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 11 Sep 2022 08:44:31 -0400 Subject: add 2022-09-11-jqueries.md --- content/posts/2022-09-11-jqueries.md | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 content/posts/2022-09-11-jqueries.md (limited to 'content/posts') diff --git a/content/posts/2022-09-11-jqueries.md b/content/posts/2022-09-11-jqueries.md new file mode 100644 index 0000000..effaf55 --- /dev/null +++ b/content/posts/2022-09-11-jqueries.md @@ -0,0 +1,55 @@ +--- +slug: jqueries +title: "jQueries" +date: "2022-09-11T07:23:10-04:00" +draft: true +--- +Several of my coworkers do not like [jQuery][]. A lot of folks say +that the modern [DOM][] and cross-browser compatibility are now good +enough that [you might not need jQuery][]. Other common arguments +against [jQuery][] are code bloat and security. + +My personal opinion is a bit more nuanced. I agree that [jQuery][] +isn't *necessary* for new projects and that the modern [DOM][] is +usually sufficient. + +That said, [if it ain't broke, don't fix it][fix]. It often takes +less effort to maintain [jQuery][] in an existing application than it +does to remove [jQuery][] and replace it with something else. + +Also, consistency is important. If a team of developers is working on +several applications, then consistency between code bases is often more +important than using the latest technology or the best technique. +Using consistent dependencies, idioms, and formatting reduces the +[cognitive load][] for the entire team. + +In the case where a team is creating a new application and that team +already maintains several existing [jQuery][] applications, I would +argue in favor of using [jQuery][] for the new application as long as +the version of [jQuery][] is kept up to date. + +Even as someone who [cares about page size][shrinkage] and [literally +measures JavaScript size by the byte][js-byte-size]), I don't +find the arguments about bloat compelling; [jQuery 3.6.1][] (the current +version as of this writing) is 90kb minified, and 30kb compressed. Slim +builds are even smaller (73kb and 25kb, respectively). That is +relatively small + +[jquery]: https://jquery.com/ + "jQuery" +[you might not need jquery]: https://youmightnotneedjquery.com/ + "You might not need jQuery." +[dom]: https://en.wikipedia.org/wiki/Document_Object_Model + "Document Object Model" +[fix]: https://idioms.thefreedictionary.com/if+it+ain%27t+broke%2c+don%27t+fix+it + "If something is performing or functioning well enough, there's no need to change or interfere with it as you may introduce new problems as a result." +[cognitive load]: https://en.wikipedia.org/wiki/Cognitive_load + "Measure of perceived mental effort." +[jquery 3.6.1]: https://blog.jquery.com/2022/08/26/jquery-3-6-1-maintenance-release/ + "jQuery 3.6.1, the current version of jQuery as of this writing." +[shrinkage]: {{< relref "posts/2022-01-28-media-shrinkage.md" >}} + "Post about compressing media assets and enabling compression in Apache." +[js-byte-size]: https://git.pablotron.org/sites/pablotron.org/plain/themes/hugo-pt2021/assets/script.js + "Comment about byte count from unminified JavaScript for this site." +[javascript]: https://en.wikipedia.org/wiki/JavaScript + "JavaScript programming language." -- cgit v1.2.3