6 ms·
The amount of energy wasted due to poor caching strategies alone could power small countries. Made far worse by the current trend to maximize code readability a
by bryans 5y ago
The amount of energy wasted due to poor caching strategies alone could power small countries. Made far worse by the current trend to maximize code readability and organization by using as many dependencies as humanly possible for even the simplest of tasks.
- onion2k 5y agoMade far worse by the current trend to maximize code readability and organization by using as many dependencies as humanly possible for even the simplest of tasks. The current trend is to maximize readability in development and then to use a build pipeline to remove as much of that readability as possible and optimize for size in production. There is only a very loose relationship between what code looks like when you're writing it and what actually pops out of a compiler or bundler to go to production. You could write something close to plain English these days (literate programming with something like Observable), with a ton of dependencies, and still get a reasonably well-optimized website after a bundler does some tree-shaking, dead code removal, transpiling and minification. It's complicated, sure, but your complaint here is the exact reason why it's complicated. We want to easy to write and understand human-optimized code for dev, and to use that to deliver an Internet- and browser-optimized bundle to the user. The step in the middle of those is complex.
- kiba 5y agoIt's not about the readability of code on web pages, but the fact that web pages are unnecessarily bloated in the first place. Even static page generators seem a bit too complicated at time.
- onion2k 5y agoI see this argument a lot on HN, but whenever I look at web pages (which is pretty much all day, every day) I don't see very much that could be removed without radically changing the user experience. I understand that some people don't believe reactive single page apps, that are device responsive, that have accessibility features, and that are localized for different languages are a good idea, but if you do think those things are what you want to deliver then websites aren't "bloated". They're just big. They do lots of things. The argument is less about the code and more about people railing against what the web is these days. Fair enough if that's the case, but at least make the argument that you don't like modern websites rather than try to hide it behind a claim it's about code optimization. The only exception to that is adverts. There's a ton of code delivered in websites that isn't necessary, and it's mostly for displaying ads and tracking people so the ads can be optimized for better conversion.
- catmanjan 5y agoThe ui would have to change, but the experience doesn't need to - news sites should just be tables, not art gallerys
- phist_mcgee 5y ago"should be" That's a subjective opinion. What if people who read the news want to read it like an art gallery?
- _3u10 5y agoArt gallery is super complimentary, art galleries are generally curated. Whatever the modern web is is the opposite of taste. It kind of makes me want to get a giant ink jet plotter and set it up at an art gallery printing tweets / tiktoks / etc and instead of a catch bin for the prints it just goes directly into a shredder.
- clavicat 5y agoI see a lot that can be removed without substantially altering the user experience. Just compare Hacker News to Reddit, or Nitter to Twitter.
- _3u10 5y agoHere's how to make a SPA that isn't shit. https://instant.page/ https://instant.page/ https://github.com/turbolinks/turbolinks https://github.com/turbolinks/turbolinks or turbo/hotwire/stimulus. They are bloated as fuck. Go to an interview for any react job and they'll ask you about what to do when react fucks up the DOM with all its bullshit. Try making an HTML page that is just HTML and see how many millions of elements you have to have on the page until it starts acting like react. React/Angular/etc are just bloat. It's like seeing a "modern" iOS app with Dependency injection and asking yourself how often this team swaps out the database on its iOS to make DI necessary. Like what do they have in the back, a Wheel O' Database and spin it every week to find out what DB they should use until next week?
- Ekaros 5y ago
- _3u10 5y agoThat stuff isn't readable. It's mostly garbage. If you don't need to make 20,000 devs work together in a chain gang, why even bother? Here's the platforms you need if you're not 20,000 strong: https://motherfuckingwebsite.com/ https://motherfuckingwebsite.com/ http://programming-motherfucker.com/ http://programming-motherfucker.com/ https://github.com/brandonhilkert/fucking_shell_scripts https://github.com/brandonhilkert/fucking_shell_scripts http://vanilla-js.com/ http://vanilla-js.com/
- codethief 5y agoYou're missing one link: https://bettermotherfuckingwebsite.com https://bettermotherfuckingwebsite.com :)
- onion2k 5y agoThat stuff isn't readable. It's mostly garbage. Arguments like this do you no favors. There are hundreds of thousands of developers using React today. They aren't all wrong. There are legitimate reasons to use it, it works very well, and code written with it is not 'garbage'. It certainly has its flaws too of course. However, while any website that's using React appropriately could be written in vanilla JS instead, after a while the code would start to look like a poor quality React implementation. This is obvious, because what React is doing - abstracting the process of inter-component communication, and giving developers tools to solve common problems within components - is actually very common in app development. Leveraging React rather than reinventing that particular wheel is a good idea.
- codethief 5y ago> Arguments like this do you no favors. […] There are legitimate reasons to use it, it works very well, and code written with it is not 'garbage'. Did you take a look at the links OP posted? I interpret their comment very much tongue-in-cheek.
- bryans 5y agoYou paint a very utopian picture, but that's just not how it works in the real world. Throw a dart at a map of both startups and large companies, and you'll find full dependencies included in otherwise small scripts. Sometimes those dependencies will even get included in multiple files, because Google convinced a generation of developers that "above the fold" was the most important thing in the history of the web -- even though Google themselves abandoned the concept almost immediately. The focus these days is on tooling instead of code, and that has resulted in fragile infrastructures serving massive amounts of code in order to provide relatively little functionality for the end user -- all because we'd rather use some extra cheap electricity than actually learn how to write highly-performant code. I'm really not sure why you view that as a positive.
- faeyanpiraat 5y agoI don’t get how including dependencies multiple times is related to “above the fold”, could you clarify?
- bryans 5y agoThe method that most frameworks and developers use to accomplish any form of "above the fold" reactivity, is to chunk portions of a page, where each of those chunks gets its own renderer, of sorts, and whatever other dependencies that particular section of code might need. It's incredibly easy to either accidentally include large dependencies within each chunk, or repeat a dependency across multiple chunks, or to accept it as a problem to throw money at -- because it's far cheaper to expand infrastructure than to increase hiring, and way more palatable to the financial team when the buck just gets passed on to the consumer. For some reason, it has never really bothered project managers that just "throwing money at it" is entirely antithetical to the point of "above the fold."