Junk Comments It doesn’t ignore the web client UI specific concerns.
Juan Mendes

It absolutely glosses over and disregards web client UI specific concerns as either trivial, easily surmountable, irrelevant, or something.

To start,

  • For over 15 years of web development, one of the primary performance considerations for web sites and applications has been network transport.
  • Experienced and professional front end developers typically try to avoid bloating the resources that must be downloaded by users.
  • This is done by making conservative architectural and design choices, optimizing assets, minifying code, avoiding redundancy, and maximizing re-use.
  • npm3’s de-duplication doesn’t make a flat dependency tree. It makes a flatter dependency tree than npm2. If a shared dependency doesn’t have any overlap, you will end up with 2 versions in a nested structure just like npm2.

Sure, while your typical desktop user in a first world country probably won’t notice the tradeoff, third world or mobile users will. Which basically means developers are failing to leverage the web in all its potential, just because they were annoyed at having to do the work.

Because they wanted to do the work like it was server side, or in a way which allowed them to use their favorite language only, or in a way that uses the newest and coolest albeit immature technologies. Even when they shouldn’t. Even if it negatively impacts the product’s potential reach, even if it limits their company’s hiring pool, or even if it negatively impacts user experience. Please note, ignoring these things are not hallmarks of good product, technical, or design thinking.

Perhaps that’s why authors of so many New Era of JavaScript articles that focus on npm, Node.js, and bundlers aren’t as familiar with the tradeoffs they’re making as they seem to believe. They’re operating from a place of evangelism, subjective preference, or me-too-ism. Or they think that the web client can and should be just like the backend and Java or Ruby on Rails or whatever, if only they can keep the dummies who don’t know how to really program out.

Because they miss plenty of of the most fundamental shit, for example,

  • There are numerous web front end modules which place the library reference in the global scope and these are often the most popular ones.
  • UMD, for example, supports scoped modules via AMD and CommonJS, as well as global references. Because it’s necessary.
  • In a browser client, HTML and CSS both have global scopes. HTML or CSS modules are always global.
  • Custom Elements specification authors have specifically said no namespacing, that HTML namespacing is a horrid idea. Custom Elements, although written in JavaScript, will therefore be global.
  • This many web developers have jobs because the web was what many of them are now trying to abstract away: an open platform of backward-compatible open standards that were simple enough to foster an explosion in democratized self-publishing. (Granted, things change, and that day may be over. I’ll be sad the day I have to admit it.)

“Global,” above means one or both of these:

  • One or more references are in the global scope (e.g. window).
  • It’s not possible to use more than one version of the module concurrently in a document.

This means npm’s approach to dependencies that assumes the viability of multiple runtime versions of a module isn’t tenable. The web client is not just a JavaScript interpreter. The fact that more tools exist to fix the problems your preferred tools create doesn’t make them not problems. Just because there are goods in the tradeoffs doesn’t mean the bad parts of the tradeoff aren’t bad. Are some points valid? Yep. Are the good parts still good? Yep.

Since I’m not a marketer, not a developer evangelist, not an employee of npm, and not trying to make myself look good by parroting the mainstream line, I’m happy to perform the public service of poking holes the intellectual dishonesty of pieces like this, tragically hopeless though it is to try to inject nuance into polarized discourse.

Like what you read? Give Junk Comments a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.