13 ms·
Modern JavaScript has made the web worse (2020)
- irrational 5y agoI’ve always assumed it went something like: the web became popular, lots of programmers from other fields moved to web programming since that is where the jobs were at, they brought with them all their cruft and complexity and forced them onto web development (regardless of whether it was appropriate or not), and thus we have the insane complex mess web development has become.
- soperj 5y agoI honestly think it's been the other way around. UI/UX has forced this mess. People wanting it to feel real time, even though it isn't.
- bobthepanda 5y agoI would go a level higher and say it is the commercial nature of the web today. The web ceased being only about hypertext documents in the strictest sense a long time ago, and what makes money and attracts consumers seems to be "app-like" experiences and not basic hyperlinked forums or web portals. And their ability to make money only creates more of them.
- bobthepanda 5y agothere's a couple of things at play * JS's history is all about "quick and dirty". jQuery in older times was meant to paper over the quick and dirty and give developers more convenience, and old JS without JQuery was pretty awful * we are asking JS to do things it was never meant to do; in particular, the desire for "app-like" experiences and SPAs. * JS is very backward compatible, which means old webpages can be archived, but also means that all the warts are still around. * JS interpretation depends on browsers, which means if you want to use some modern features you will have to use some kind of transpiling, polyfill, and or framework to get some consistent behavior on all of them (jQuery in older times, babel today), and the differences in browsers means that these adapters have to be mind-bogglingly complex a lot of times
- bkm 5y agoThis article is no longer correct as 'cache partitioning' in modern browsers stops CDN assets being reusable for different sites in cache.
- neximo64 5y agoFrom a developer point of view vs user point of view.
- paulpauper 5y agoarchive. is is great for bypass js, way better than script blockers
- 29athrowaway 5y agoThe 2005 web was a Boing 737. The 2021 web is a Boeing 737 Max.
- DominoTree 5y agoI mean I agree it’s hurt things but I think the “download big files bad” argument is far from why
- jagged-chisel 5y agoMy current employer just ran headlong into this assumption. Once your users are all on mobile devices and gathering in large numbers around single cellular towers, downloading big files is bad and generates a large number of complaints to customer support.
- robomc 5y agoWhat's this guy saying is "worse"? Just that there's a few extra MB of dependencies? What's bad about that?
- kevingadd 5y agoA huge % of internet users are on slow connections and cheap devices with slow processors/limited RAM, so "a few extra MB" of javascript dependencies can mean 1+ second increases in load time on every page load
- kingcharles 5y agoAlso connections with small transfer limits. I am stuck on a cell connection and the limits make these huge sites unuseable as they eat $$ just to browse them.
- robomc 5y agoIt depends on the site and the use case, but I'd have thought that if you do, say, 10 minutes of interactions with a complex application, every few days, a chunked and cached SPA payload, with fairly light fetch requests for json after the initial load, would probably result in less transfer overall than a standard website. And again, leaving marketing / advertising / analytics scripts out of the picture, the JS in both cases will be a tiny part of the transfer when compared to images.
- cerved 5y agolaughs in Mb/s
- jbergens 5y agoIt shouldn't be on every page load. The first will take more time but then you cache the js. More js may be loaded but it should not be a few extra MB per page.
- kevingadd 5y ago
- WatchDog 5y ago> If the major consumers of the highest used frameworks all used the same CDN for delivery and smaller websites that want to use those same framework followed suit this would greatly reduce wasted traffic across the web and make everyone faster. Except that browsers no longer cache across origins anymore, so this doesn't work, also there are just a huge number of libraries and versions, so even if they did cache it, it's unlikely to result in much benefit.
- XCSme 5y agoI wanted to write the same comment, the premise of the article is wrong: "if all websites link to the same resources, that resource will not be downloaded multiple times across domains".
- noahtallen 5y agoThe other problem is that JS bundlers will (attempt to) strip out unused code to reduce the final bundle size. Not possible if the library isn’t part of the build
- spacebear 5y agoAlso, that massively centralizes the Internet in a way that's not great. If one of those CDNs gets hacked or just goes down for an hour, it breaks every website that uses it.
- dagw 5y agoIt's pretty easy and should be best practice to add a bit of code that checks if you successfully downloaded the library from the CDN and falls back to grabbing it from your server if it failed.
- brundolf 5y agoAnd many sites now use their own CDN anyway. Maybe the move away from centralized CDNs is wasteful in the aggregate, but it's not responsible for any perceived reduction in site performance.
- afavour 5y agoIMO the biggest problem is that the industry became all about developer experience and neglected user experience. Doing an analysis of the JS bundled with many major sites is an utter horror show: React is big and bloated, alternatives like Preact exist but no-one cares. React provides The Best Developer Experience so that is what we shall use. GraphQL is the cool thing to use these days so we’ll throw in a giant client library along with all our query text. Sure, browsers handle REST out of the box but that’s not what works best for our developers. We’ll use CSS in JS despite the performance being worse, it’s what our team likes. We’ll bundle a giant CoreJS shim to all browsers even though the vast majority won’t need it. Running two builds is too annoying to set up in our workflow. The site loads fine on my MacBook Pro so why stress what Lighthouse says? So on and so forth. For years I’ve heard that this isn’t a problem because all the extra developer productivity means they can move so much faster. It’s been long enough now that I’m comfortable dismissing that argument as nonsense. And many users are essentially trapped: for example, I bank with Chase and their web site is absolutely atrocious. I talk to friends and they say the same. But the UX of online banking is very rarely a reason for anyone to change bank so the product folks aren’t going to push for performance. It’s something developers have to proactively care about and as an industry we just don’t. I hope eventually we see the industry change but for now it really feels like no-one cares. We’re prioritising the speed of the shovelling while ignoring the quantity of shit.
- swsieber 5y agoDeveloper time == money. There is always a time vs end user experience tradeoff, even with physical goods. I think it's part of a bigger trend towards (more prolific) crappy stuff generally. I do think there is space for tools that improve the user experience whilst not regressing on easy of development.
- afavour 5y ago> I do think there is space for tools that improve the user experience whilst not regressing on easy of development. Agreed. I feel like I spend 50% of my time on here promoting Svelte which is wildly out of whack with how much I actually use it but to my mind it’s a great example of a tool that prioritises developer experience and user experience without compromise. There is hope.
- PeterWhittaker 5y ago> this is bad for consumers, this is bad for you How? Why? Efficiency? My company does complex cloud and on-prem web-based apps, JS front and back. These inefficient frameworks make our developers more productive and allow us to design, deliver, and fix fast. Storage is cheaper, bandwidth is cheaper, processing cycles are cheaper, all are cheaper than developer time. And these powerful frameworks give us great speed in iterating new features, which makes our customers happy. The article is too focused on efficient use of computing resources at the expense of ignoring developer costs and customer satisfaction.
- blakehaswell 5y ago> great speed in iterating new features […] makes our customers happy For me this is a leap. I can't think of many examples of software which I use where new features have actually made me happy. Normally it's just change which forces me to learn something new while I'm in the middle of trying to accomplish something actually productive. I think our industry over-estimates the value of "new features". But in my experience 90% of new features provide neutral or negative value. If—instead of a new feature—the software I used released a performance improvement, then that would actually help make me more productive.
- PeterWhittaker 5y agoI don’t mean new features in the frameworks, our customers don’t care (and don’t know what frameworks we use, AFAIK). They care about the features in our products and the frameworks we use allow us to do cool fast.
- cerved 5y agothere are lots of publicly available feedback channels, should be possible to verify your hypothesis
- chmod775 5y ago> My company does complex cloud and on-prem web-based apps, JS front and back. Then you've certainly run into power users. Chances are browsers can load and display a 2MB server-generated HTML table faster than the DI system in your 5 MB angular app can start all the required services to be ready to launch your pagination component. However once it is ready it may be quickly apparent that users would be much more productive using that giant table and CTRL+F than a laggy angular app that would struggle even handling that much data at once in an idiomatic way. Of course I am making this up to illustrate a point. However I use "one giant HTML table" as a sort of bar to meet when developing in modern frameworks. If with this insanely complicated and large array of tools I can't even do better than that (faster to implement!) competing solution, I might as well not bother. That "a bunch of large server-rendered HTML tables" just so often happen to be the previous solution that was in place, and power users are likely to complain if we do worse, is just the cherry on top. To do better we often have to avoid certain things that would be considered modern. Like not putting lots of empty space in our layout, no server-side search that would introduce too much (pointless) latency compared to client-side, and some un-idiomatic stuff to actually handle large[1] amounts of data without change-detection/updating in our framework of choice eating user's CPUs for breakfast. [1]: The amount of data/elements at which change detection in idiomatic Rust and Angular becomes slow wouldn't have been considered 'large' 15 years ago. Though obviously people then had to put thought into this stuff and it certainly wasn't automatic.
- kristopolous 5y agoThe author is correct but not for that farcical reason. Here's some real ones. It encourages the following: A URL that is now less Universal than ever, pointing to an application more than a piece of content Content that is not self contained in a single document so it is hard to archive for the future Content that is not served with the page nor containing a universal reference so it is hard to scrape and catalog A profound inability to inspect websites because they are now transpiled via frameworks and emit something obtuse and only machine, not human readable Content that is now in a non-generalized method of access so instrumenting it to fit it for different purposes (the "Free" part of "information is meant to be free") is now fragile and dubious And more controversial: The careful separation of concerns of the Javascript (Controller), HTML (Model), and CSS (View) gets tossed together and entangled in a single stream of hybrid languages where they no longer are separated. Instead people rely on less rigorously made tools to achieve the same ends with increased difficulty, less reliability, and less functionality - all cost and no benefit.
- threatofrain 5y ago> A profound inability to inspect websites because they are now transpiled via frameworks and emit something obtuse and only machine, not human readable IMO, the setting where open source communities are likely to grow is the right place to share code. This is also the setting where code is most likely to be understood, as understanding a codebase is very hard. Sharing code is not just a matter of dumping original source code to the public, and I think the use case around ordinary users examining source code is very, very niche. And how should compiled-language communities like Rust handle the issue of sharing code? Should they distribute the original source code with the expectation that their users shall compile on their end? Is that the right way to share code, or is that just dumping code to the public?
- hattmall 5y agoI don't think it's ordinary users examining the code. The issue is develops figuring out bugs in their own projects. You try to trace why one thing isn't working and after many hours of digging through things in developer tools you realize two or more of the massive JS libraries someone needed to import for a single function doesn't work with another in a specific use case. This is like 80% of my time and rarely does the person who decided to import the library have any in depth knowledge of it's working. Fairly basic websites today are importing hundreds of thousands of lines of unnecessary code to achieve rather basic functionality.
- city41 5y agoIt's been bleak for a while, but I think we are coming round the bend. For example Next does a pretty good job of code splitting and offers rendering solutions from 100% client side to 100% static, as in no React runtime at all. Building a performant Next site that only pulls in the JS it needs is quite doable now. React server side components seem at least interesting here. I still have no experience with them but they do at least claim to tackle some of these issues. As I understand it other frameworks like Svelte and Vue have been exploring these ideas too. I think the bleakness will continue and there will be a long tail of it. But I really do think better websites are coming and in many cases are already here.
- austincheney 5y agoAs a JavaScript developer who has been doing this work since before jQuery became popular I sadly agree. It appears there is an arms race to the bottom, as in how low can we lower the bar of acceptability for prospective employment candidates. I can remember back in the day at Travelocity they couldn't hire JavaScript developers to save their business. A $100 million business and the darling of the travel industry could not hire competent front end developers at all. Its how I became a developer, involuntary reassignment from designer. I can also remember Travelocity trying to solve this problem with GWT (Google Web Toolkit). This mistake of an application compiled Java to JavaScript for people who probably should not have been writing either. Its all good so long as the code never needs changes or updates at which point Java developers wanted JavaScript developers to fix their obfuscated code. How hard could writing this rinky dink language possibly be? Back in those days there were some actual challenges, but they were an inch deep and a mile wide. There were many technical areas to own, but only two separated the grossly incompetent from the barely employable: * Cross browser compatibility (IE made this more challenging). * The DOM. Then, just as now, tree models broke the souls of many software developers. I have never figured this out, because elementary schools are able to explain abstract concepts as tree models to children, but many adults cannot and will never understand the idea on even the most primitive level. jQuery came and saved the day. No more walking tree models. Everything is now a chained method or a CSS selector through a very slow Sizzle engine. Now everybody and their dog could add events and text to a web page so long as they could read the jQuery API. In hindsight none of this is surprising in the least. The surprising part is the compensation. Back in the day when the work was hard front-end developers were paid next to nothing. You were much better off being a Java developer where you could barely have a pulse and earn 2-3x as much. As the problems got easier and the number of available candidates blossomed the compensation surprisingly went up... slowly.
- Timothycquinn 5y agoI remember my management trying to get me to take over a GWT based spreadsheet like app for managing FMEA's. The developer only used it because he did not now JavaScript and had no desire to learn. It was developed with zero thought into debugging. Needless to say, I punted that app over to another developer to handle as I saw it was going to fail miserably after the first demonstration and my initial questions to the developer. That project was an abject failure after the company spent hundreds of thousands of dollars at it.
- recursivedoubts 5y agoI agree, and I'm trying to do something about it with two no-build libraries: https://htmx.org https://htmx.org - an 11k library that pushes HTML forward as a hypermedia, making things like AJAX, SSE and CSS transitions available directly in HTML https://hyperscript.org https://hyperscript.org - a 20k library that replaces jquery/javascript with an inline, HyperTalk inspired syntax Both can be included on a site without any build infrastructure, and are attempts at bringing the joy of hypermedia and the joy of scripting, respectively, back to the web.
- synergy20 5y agoThey're both server-render(e.g. django) oriented, am I right? SPA makes things complicated, server-render does not handle all user cases either, is there a middle ground: that I still can manipulate DOMs on the client side but not like SPA that goes all way in. That is, something likes jquery(the best/simplest API ever even after ES6), but with virtual-DOM. Not sure if Mithril etc fits the bill.
- recursivedoubts 5y agohtmx is SSR-oriented: it is all about exchanging hypermedia with a server, but making that more expressive so you can implement things like Active Search within that paradigm: https://htmx.org/examples/ https://htmx.org/examples/ hyperscript is a client side scripting DSL that attempts to improve on javascript/jquery with an event-and-DOM-oriented syntax: <input type="text" placeholder="Search..." _="on keyup if the event's key is 'Escape' set my value to '' trigger keyup else show <p/> in #quotes when its textContent contains my value">
- avidphantasm 5y agoMy hope is that the goal is/will at some point be for the web “standard library” provided by the browser will some day be rich enough so that you won’t need frameworks and would only need very few libraries at all. I really want a batteries included standard browser library. Does anyone anywhere (WHATWG, W3C, etc.) share this goal?
- thelazydogsback 5y agoI think it's much simpler -- it's about the focus on design over usefulness. I really don't care if the u/x looks like someone's weekend VB project as long as it does what I want in an obvious, discoverable way. Some of the worst things in web (and desktop) u/x seem to come from the design-side of the house and are more about some 1950's design ethic of what would look good in a magazine layout, rather than treating the computer as a tool that gets shit done. (Of course, some sites _are_ magazines, and they get a pass...) I feel the same about iOS apps -- they are all adventure games. And in-place editing on a phone? Just fill the whole freaking screen with a big editor window in a giant font where I can target the cursor with my fingers, and let me submit it to the field when I'm done. And get off my lawn! :)
- SV_BubbleTime 5y agoIt’s been a pain sometimes when I try and figure out why something isn’t working… but if you are at all technical I really recommend NoScript!
- noahtallen 5y ago> The organic evolution of the web today has made the web worse not better and caused incredible amounts of waste I think this is a very subjective take. There is also a strong argument that the web is much better today because of modern frameworks and technologies. The web has shifted from being a place for basic content and documents to a full-blown application platform. 10-15 years ago, if a certain application was only built for (say) macOS, well, tough luck! You won’t be able to use it. Today, many popular applications can be used in the browser on any device and any operating system. (Examples like full office suites including MS office and Google docs, or photo editing apps, or music streaming platforms, or video conferencing.) That’s a pretty incredible advantage and improvement to the general state of software, and it’s a very strong improvement for users who no longer need to worry about incompatible software or installation processes. I would argue that this advancement would not have happened without frameworks. Or at the very least, it brought about frameworks. Since the web platform itself is not designed for applications, any large application will probably end up writing some sort of abstraction on DOM rendering and state management, just to make it halfway maintainable. So if we want web applications, which are very beneficial in many circumstances, frameworks and tooling are a part of that. Of course bundle size is still a problem to worry about. It’s a problem inherent to the benefit of the platform. Typical software can make the bundle as big as they want, and you download and install it once. The web platform forces you to care about the size in a way that just isn’t necessary for other platforms. “Modern JS” is really not what is making the web worse. What’s making the web worse is ads, tracking, platform-lock-in, big monopolies, censorship, spam, poor content safety practices, etc. Like, of course you don’t need a big framework for your blog or basic content site. It’s all about choosing the tool for the job. Half the time, the blogger probably just wanted to play around with a new technology. It really doesn’t matter that much for small little projects that are just people playing around. Bundle size is important when you have a big enough user base and really have a need to optimize for poor internet connection and slower devices — but it’s just bundle size. You’d get even bigger bundle sizes without using modern tools like webpack. The bundle size comes from the larger types of apps we’re building now that we didn’t used to build, not from web frameworks specifically. IMO, that makes bundle sizes an important, but relatively small aspect of “problems related to the web.”
- adriangrigore 5y agoIn my opinion the solution was always progressive enhancement, but things went crazy with JavaScript: The Good Parts and especially Node.js which IMO is a huge hack. I built https://mkws.sh https://mkws.sh as a solution to at least static site generation. It can be enhanced with a Makefile but for now it's simple enough. I don't believe static site generation is a JavaScript job, and to be honest, I don't believe JavaScript belongs on the server side.
- superkuh 5y agoModern javascript was created by megacorporations and it is entirely designed for their use cases. The w3c hasn't really been involved since 2018 and whatwg, and so the DOM, is corporate controlled. Emcascript itself even more so. There's an easy solution though. Just don't use javascript to make your personal websites. The corporate web can wallow in it's own filth and decay for all I care. If the humans on the web make websites without JS the web can be, and is, still great.
- brundolf 5y agoThis doesn't line up with my experience. IME these are the major drivers of web "slowness" for different types of sites: 1) Client-side-rendered apps that haven't embraced hydration of pre-rendered HTML suffer for it. Not because the JS is necessarily too large, but because it blocks the content from being visible. This would be bad even with a small bundle. Luckily this is an easy problem to solve today, but not every site has done so. 2) Many public-facing sites are afflicted with marketing scripts. I've seen sites with (I kid you not) several times the amount of marketing JS (by weight) as they have actual functionality-giving JS. The actual devs often don't even have control over these scripts (thanks to Google Tag Manager), and even if they do they probably don't have a say in what can be removed. 3) Complex sites/web-based tools are a separate beast. You're not optimizing for first-visit, you're optimizing for responsive interactions. This has even less to do with bundle size, and often not even much to do with JS itself. In my experience the limiting factor on these sites is usually reflow (DOM/style changes).
- FractalHQ 5y agoThis is a solved problem for many of us. Svelte, for example, has arguably unparalleled DX as a framework AND compiles hyper performant, tiny bundles with server rendered pages that load faster than you can blink! I think we’re past a lot of this now that we have frameworks like Astro and Sveltekit, and WASM for more heavy lifting.
- jbergens 5y agoI think the bigger problem is that many sites are built like SPAs even though they are more of a document centric web site. For actual applications a SPA is fine.
- vjancik 5y agoHe says Modern Javascript but what he really means is Modern JS Frameworks (React and others). Don't use a framework if you don't need it, or use a framework and pre-render. Frameworks being large and taking a long time to parse isn't the fault of JavaScript or NPM.
- mrozbarry 5y agoThis general topic comes up often, and the top reasons usually end up being: - JS development has a low barrier to entry, so there is a wide/diverse range of developer skills and knowledge - Most (webpack) tutorials don't cover build optimization, like tree-shaking, especially entry level, which is normally what people find to "just get the job done." - There are too many options for frameworks for people to make _good_ decisions, so they often fallback to _popular_ decisions This isn't even a recent problem. I have a few clients that wanted to use old-school template packages, like metronic, and that is a massive bloated build, and yet it's basically jquery+bootstrap with a handful of libraries. The biggest thing is, as professional web developers, we have a responsibility to the end user to make a web page load fast and be usable quickly, and I think we often over-look that. I don't care if your framework is a no-build thing, or uses webpack/rollup/etc., the real thing is if a user doesn't have to download 50MB of javascript for a single page, especially if the end result of that page is considerably less than 50MB worth of text, styles, and images. The flip side is, most clients just want their project done quickly so they can make money. There's nothing wrong with that, but it can't be at the expense of their users, and developers should be able to give good consultation and advice to their clients about the trade-offs of libraries/frameworks/build tools/etc. and the impact they will have on the end-users. Personally, I like building without extra build tools. `script type="module"` is great, and smaller frameworks (my go-to is hyperapp, but there are several others) are often not awful to grab a local es6 copy and toss it in your public web directory, import it, and go to town.