In Defense of the Modern Web
dev.to
dev.to
I think it's a shame that frontend web developers have thrown themselves behind the SPA paradigm so hard that the notion of a JavaScript ecosystem that doesn't try to do pull _everything_ into its own domain is unimaginable. I'd love to see more mindshare go towards building libraries that are drop-in/"just add water" progressive enhancements for static sites.
[edit: minor grammar correction]
Are you thinking something like ShareDB? https://github.com/share/sharedb
As a person who is browsing the web, I do want server rendered pages, correct history of navigation, urls to match pages, a lack of refreshes, live collaboration with other users. What I dont want is a manual refresh to lose anything or bring me to a different page. And I want the site to work, and progressively fail if I have javascript off.
Most interactivity can still be server side. Look at google.com, as you type in a search query, and they return a static update with results matching what youve typed so far.
Ah - I didn't have anything quite that powerful in mind, more like fairly simple, browser-local enhancements to make interacting with regular old HTML pages more pleasant. For example a drop-in library that would save the state of a form and restore it on a refresh, like the old formsaver jQuery plugin. I would like to see an ecosystem of libraries like that again
Sounds like jQuery plugins.
Seriously though, I wish for a similar thing without the baggage. Maybe there needs to be a common interface defined for such "just add water" libraries.
I've long ago abandoned spaghetti mega-scripts and SPAs in favor of targeted JS libraries that extend HTML capabilities. They're not web components, they don't require some framework to manage, and my HTML works fine without them, but if I load the library and add certain attributes or tags to my markup, I get extra capabilities. The libraries don't require crazy tooling to manage, don't have extensive dependencies and so they facilitate steady incremental development.
I'm very happy with this approach and I'm reusing code I've written years ago for completely different projects.
Do you mean libraries like Turbolinks[1] and/or Intercooler[2] here? I'm interested in what libraries you use, and others like these which help "bridge the gap" between traditional and single-page sites.
[1] https://github.com/turbolinks/turbolinks [2] https://intercoolerjs.org/
[1] https://unpoly.com/ [2] https://www.morling.dev/blog/quarkus-qute-test-ride/
I'm a fan of these kinds of solutions. For my 100% static website, https://instant.page does make it feel instant. TurboLinks feels a little "heavier" and has a more complex interaction with other frontend code, but it works very well.
IIRC there were some old packages but these were unmaintained and didn't work with later versions of Turbolinks, so I ended up looking at Rails source and other examples. Basically making sure to handle redirects and headers correctly. You can see the webpack config in the same project, pretty much just standard setup with some tweaks for loading Stimulus controllers.
https://github.com/derbyjs/derby
https://github.com/derbyjs/racer
Sure, you can do this with AJAX, but so far there are no SSR + component-level hydration + AJAX frameworks that solve this out of the box.
Facebook is working on something similar though as Dan Abramov has hinted at on Twitter.
But if you have any amount of interactivity (forms, widgets, etc) SSR makes total sense. Specially with component-level hydration which means the duplication of content would be lower than traditional SSR. AFAIK Marko is the only framework that has this feature.
See this article for more info on this topic:
https://medium.com/@mlrawlings/maybe-you-dont-need-that-spa-...
Rich seems to be advocating for a JS middle-ground here, which I think is a great direction to go in for this kind of workflow.
Not everything is an app, and frankly I think we build a lot of non-apps as if they are apps because we enjoy the feeling that we've engineered something.
This is similar to other articles I've seen that draw a distinction between two choices: zero javascript vs full SPA. I think this is a false dichotomoy because most features advertised for SPAs (analytics, data/content preloading, transitions, optimized page loading) can be implemented for static sites as well. It would be nice to see frameworks that were more modular and interoperable because this would allow/give engineers the choice to decide which parts they want to be static and which parts they want to be dynamic.
I'm not sure if I agree with what you're saying though because you haven't provided examples of how the features of SPAs can be accomplished without JavaScript. Do you have references and examples?
SPAs are newer, so they must be better, right? /s
I'd like "web programming" to start with Vannevar Bush's As We May Think, then go to Licklider, Ted Nelson, then hypercard programming (hypertalk). Set up a BBS, a gopher site and then write HTML for NCSA Mosaic.
Read the RFCs and W3C standards, learn about Netscape's SSJS failure before touching nodejs, you know, serious academic scholarship. Maybe look at the failed TCL browser support, which has example snippets in the HTML 4 standard, understand why it didn't work, etc.
I think we'd get dramatically better results
How many sites actually do this? And how much additional bandwidth (and battery life for mobile devices) does doing this consume?
> We can provide better visual feedback that loading is taking place and a transition is about to occur. And we don't need to load the entire contents of the page — often, we can make do with a small bit of JSON because we already have the JavaScript for the page.
In my experience sites that do this are almost universally slower and less responsive than sites that just use normal links. Maybe that's just confirmation bias and I just don't notice it as much on sites that do it well, but a particularly egregious example of this is Reddit's current mobile site vs their old i.reddit.com mobile site (which I use exclusively (despite it missing a number of newer features and having a lot of minor bugs the newer site doesn't) because it's way way faster).
Yup. A car analogy: "Instead of waiting for the driver to turn the steering wheel before causing the car to turn, we put the car on the back of a flatbed truck that tracks driver behaviour and tries to predict their intent. Then we can start turning the flatbed truck a little bit sooner to improve user experience."
This seems to me to be the key phrase.
I sympathize with all the "JS has gone too far" people in this thread. I also hate bloated JS apps. But, "almost all SPAs are bloated trash" is a distinct claim from "SPAs are intrinsically trash".
In my experience it is possible to have lean, high-performance, accessible SPAs without too much developer difficulty. Svelte (created by the author of this article) is one framework in this space, although I think there are better approaches.
Do you investigate all the fast snappy sites you visit to confirm they aren't single page apps? What about the slow pages that aren't SPAs (most every news site)?
It seems like anyone who wants to dislike JS and/or SPAs can easily confirmation-bias their way into believing it.
Anyway, for fast SPAs, here is a useful comparison: the "RealWorld app" demo.
I would urge everyone to look at the Lighthouse audits for these three implementations:
React/Redux: https://react-redux.realworld.io/
Angular: https://angular.realworld.io/
Vue: https://vue-vuex-realworld.netlify.app/#/
Svelte/Sapper: https://realworld.svelte.dev/
Solid.js: https://ryansolid.github.io/solid-realworld/
This is just a demo, of course, but it is close enough to be representative. From just this simple demo we can already see significant differences: Svelte and Solid.js are much snappier. The author of the article, Rich, created Svelte.
Of course, this is just talking about performance, not yet getting accessibility, navigation, transitions, etc right.
The simple question as to where are all these inspiring SPAs that truly push the web to next levels...is completely unanswered.
We get docs sites, demos and blogs. Where when clicking on a link...wow!...it loads without a page refresh. Something possible using simple ajax some 15 years ago.
You probably don't need your js framework, your 10k npm dependencies, or your complex mix of server and client side rendering. Not every website needs an api and clients to consume it, and not everything needs to be an app.
The web is a success because it is simple, accessible, fast, and nobody cares how the server makes the html they are reading. Let's keep it that way.
There are definitely functionalities that are impractical to implement with server-side rendering and forms alone. Map widgets and drag-and-drop come to mind.
The issue I have though, is that the overwelming majority of web functionality can be implemented as server-side rendering.
The comparison is between server-side with a bit of js where required, and the proposed 'modern web' where js frameworks attempt to take over the entire experience server and client side so that they can remodel the world in their image.
Most websites simply don't need react and friends, even if they are more app-like than doc-based they still don't need it, and they certainly don't need to be a single page application (the best modern example of throwing out almost everything that is good about the web - urls, links, docs, stateless).
Believe me, you're preaching to the choir. Nor am I advocating for every website to have an API. But unfortunately we part ways here:
> The web is a success
The web is not a success. It's dying. Consumers vastly prefer native apps — one recent study (https://www.mobiloud.com/blog/mobile-apps-vs-the-mobile-web/) tells us that 90% of mobile time is spent in apps vs 10% in browsers.
If there is a site you use often enough it graduates to living in your phone. But the majority of what apps can do is never even touched.
I’d be much more interested in a breakdown of app usage, as I bet active time shifts more towards web
This one I'm always interested in. What is difficult about downloading an app?
Downloading an app is more personal, phone storage space is still a premium for many people. App devs don’t seem to care at all how big there app is. We yell at at web devs when their page is >1mb. I’ve tried downloading simple apps whose size are 400mb, what the hell are they doing? If I can visit their site that’s 1mb or download their app that’s 400x, maybe I’ll just visit the site and be on with my day.
You can criticize it, sure. But - you are using a computer 100% because of the web, not because of spreadsheet software.
Now, back to web vs. native. You just have people who prefer either. I exclusively use apps. I think the experience is better in every way, and I've never seen a web application deliver comparable experience to a native app. But, almost every native app is backed by a web server. And, some things I do want to remain web apps, like Wikipedia.
I think the web community overall looks at native apps like they are some weird, alien technology because they're completely blinded by what they build and what tools they use. Like always, if we understood why users enjoy native apps, we could learn a lot of things. I'd argue that we are learning that, which is why there are lots of SPAs. That doesn't mean that's the only way to build software, it just means that people do actually enjoy that experience.
There is some everything-looks-like-a-nail but that's not all. I'm making a native desktop app now which is slow going. Every platform I want to support is so different, and cross-platform tooling often requires branching and learning each ones quirks anyway.
Just making an Electron/ReactNative app is often the best of both worlds should a website not suffice. (Excluding concerns like battery life, app size, or memory footprint.)
Curious. Did you post this using a native app?
On my mobile I never access HN via the website, I use one of those apps.
If you remove time spent in those popular apps and their respective websites from the stats, the data would likely paint a vastly different story (that might not be in the best interest for a site that relies on pushing "Launching mobile apps for your WordPress site" to highlight ofc).
The advertising is so pervasive, so annoying, so invasive and so awful it just makes the medium unusable. The same trends are starting to creep into podcasting and video games and I just wish people would realize they are slowly destroying their own businesses with this garbage.
Does that really mean anything other than you can do more things with mobile devices than just browse the web? I might use WhatsApp on my phone, draw with Procreate on my iPad or play games. I don't see why any of those things should involve the web browser, but that doesn't mean the web is somehow dying.
I mean, to draw an analogy, it doesn't mean Netflix is dying if I use 90% of my time at home not watching Netflix.
EDIT: I do understand you can make web apps that work offline by jumping through enough hoops. But then again, why would you? Why try to unnecessarily shoehorn everything into the web paradigm?
Let's take an iPad drawing app that is super well integrated with Apple Pencil. What benefit would forcing it onto the web bring, considering the performance hit and usage of specialized hardware?
Or a recording app that I might use to take voice notes or record other audio. Why does that need to be a web application?
* platform agnostic
* can't be blocked by a central platform gate-keeper
* generally much smaller (download size) than native apps
* don't take up permanent space on your device (good for things you only use occasionally)
* always up-to-date
Personally I prefer native apps for tools I use frequently. Everything else I prefer the web.
* this is true-ish. It's not that they can't it's that they aren't. If Apple or Google just up and blocked a site in Safari or Chrome it's basically dead. "Technically accessible in Firefox" isn't exactly a selling point. You're also gate-kept by your ability to get a public cert.
* True but download size only really matters on first install. It's absolutely friction but not really something that I've ever seen people care about anymore. Pictures take up almost all of the storage on people's phones now.
* True but the trade-off there is that you have to download it every time. Native apps win in the long run if you use it often.
* Users have never cared about this. This is only a benefit to the very techy.
I'd rather see better cross-platform native tools than more web tools. The web is bloated, overloaded, and has a lot of historical baggage. That isn't to say it can't still be used well, but I still like seeing alternatives with innovation.
That depends, what is the usage pattern of browsers vs. everything else on the desktop computer? Because you can use the desktop computer for more things than browsing the web.
That's a very weird assumption to make considering that the web was intended for sharing information, not running applications. The fact that customers prefer native apps does not mean that the web is dead. The web is good for somethings. And native is good for others.
For ex., I read your article on a mobile webpage. Downloading an app for that would be madness. But trying to use a big webapp like jira on the mobile would be a study in madness. Hell, It doesn't work on the desktop well enough.
The bottom line is that the web is good for some things, native apps are good for some things. Instead of trying to shoehorn web everywhere, it would be better to use the correct tool for the job
What do you mean "prefer"? The correct word is pushed.
Many of the most popular apps are reliant on the web or web servers for their content (social media for example), and it's ok if some content is not on the web. Games for example are a special case which are better served by native code.
A marketer like the one doing those surveys is understandably going to be concerned with where the captive eyeballs are, and platforms do have a tendency to try to herd users into their walled garden, but in the long run I think the open web will win over corporate walled gardens.
Web apps are dying because the web isn't a good application platform. Google made a real good argument with Gmail and Maps, but unless you have their resources (even if you do, looking at Facebook here), it's very hard to create a great application experience on the web--for many of the reasons you write about in your post.
But I think that's fine. The web isn't a good application platform, but it is a good information platform. There's also other protocols beyond HTTP. Imagine if getting the most out of the internet didn't require millions of lines of C++, hyper-complicated JS JITs, layer upon layer on HTTP, and opening the door to the surveillance state.
For giggles, I just loaded HN on a 2011 MacBook Air. It took just under 2 seconds for the front page.
Then I loaded GMail on the same machine. 15 seconds to the front page. Plus, it came in with 21 errors ranging from invalid headers to invalid sources to cross-origin issues.
Essentially, you have purposefully asked the wrong question in order to lie to us using statistics.
Given how hard certain sites (fb, LinkedIn, reddit for a start) push their apps it is kind of understandable.
Please everyone remember though that using does not necessarily mean prefer.
I mostly loathe apps.
If the sites in the genres I care about remain, I am unaffected (except for, perhaps, economically in a bigger picture).
For example, I don't care if ESPN's app is favored over it's website. I don't care if various lifestyle magazines have apps. Lots of examples here, pick your own.
I spend my time on the web or in a select few apps like Discord, Hangouts, Signal, etc. Even then, I don't really care if the sites are optimized for mobile. I usually prefer when they aren't because most people do it poorly. Just make a nice website with appropriate viewports and non-fixed whitespace on the sides and it'll probably work out unless you're doing some fancy interactive stuff. In which case, I probably want it to be on a desktop anyway.
Consumers hate apps. The average they install per month is zero. 90% of their installed apps are completely unused. Almost any new app they do install has single usage, and is then abandoned forever.
- most people only install popular apps
- top apps in playstore are actively hostile to using their website.
Reddit, Imgur, instagram, snapchat, whatsapp, twitter etc. You name it. They either don't have a functioning mobile website or native only.
Svelte projects do not put 10k dependencies in the final bundle.
In fact when using Svelte you won't need many dependencies you typically need when using React:
- State management (MobX, Redux, etc)
- CSS stuff (classnames, CSS in JS, etc)
- Animation
Even on a simple use case like a synthetic benchmark Svelte is still the absolute leader in start-up metrics:
https://krausest.github.io/js-framework-benchmark/current.ht...
Also check the metrics for a real world project:
https://medium.com/dailyjs/a-realworld-comparison-of-front-e...
- The developers want to prove themselves with a new technology
- The site owner wants to make money, so adds are required
- The website needs to "verify identity" to cut down on fraud, so invasive trackers are added
- The finance team wants to cut down on infrastructure costs, so they want less done on the servers
- The user wants to do what they came for done, but may be frustrated by how the site slows down the browser
This tug-of-war is a lot of what leads to slow, resource-intensive, privacy-invading websites.
Mobile native developer? Might be something new you want to get familiar with every couple years, but really you'll likely be OK, career-wise, if you sleep on it for another year or two unless you actually need it. C++ developers aren't chasing brand-new frameworks to stay hirable, generally. Java and C#, most of the ads seem to be "have experience with [eight-year-old 'new' thing that's basically an ecosystem-wide standard now anyway], plus a bunch of much older things", and those two alone are a really high percentage of all software jobs.
Just why can't we improve the user agent instead of turning every website into an app that does its own thing to provide the UX?
For example:
> We can kick off requests as soon as the user first touches (or hovers) the link instead
There's no reason this couldn't be built-in to the user agent. It could very well pre-load pages before you even start scrolling around, or it could start loading as soon as you hover, or it could start loading as soon as you click. I get to decide, because I can configure my UA. People on data caps will be happy to turn it off. Meanwhile you can optimize your ugly slow service so that it processes requests fast enough that you don't need these hacks..
> We can provide better visual feedback that loading is taking place
Usually I get either crickets or a spinner or something went wrong if it's the javascript doing this. Again I think it is the user agent's place to give the user visual feedback (according to their configuration). I'd turn them off, because they're not useful. I'd rather have you spend time making your ugly slow service faster than implementing transition animations to "hide" the latency.
Native’s much more likely to be ok.
Chief problems are: web interface design tends to be much worse than native (even if they look nice on a screenshot), UI latency is bad and gets worse the more JS you throw at it, there’s more likely to be unhelpful functionality the developer’s accidentally created (selecting the text on a “button” rather then clicking it), and they’re more likely to have weird state-related fragility.
No, it's not. It's easy and you can do all that without an SPA framework. If you can't see this in about 5 seconds, you shouldn't be lecturing other about how to design websites.
Preloading hovered links can be done with a standalone library. AJAX can be done with another a standalone library. Removing extra crap from your page to facilitate faster AJAX can be done with a custom request header and a couple if-else statements on the server side. Best of all, this stuff can be added after you have a working website.
Couldn't it even be done in two lines with vanilla javascript? On hover fetch() the URL, then rely on the browser cache for when the user actually clicks?
What? The solution to making a website fast is to crunch analytics (presumably on the client and in JS, all of which has to be loaded beforehand for this to work) and then try to predict what the user is going to do on the website, anticipate it, and start loading, even when it might go waste?
Wastage of network bandwidth aside, Speculative Execution destroyed the chip performance in the last two years and opened up a whole lot of scary security holes, some of which may never be fully patched without performance hits. And the bright idea is to do that in the browser?
> I believe Gatsby will pre-load any link that's visible in the viewport by default$
If it does that, then no wonder that the original article was completely right. On a page with 10 visible links in the viewport, I will only navigate to one or maybe I won't navigate. Then why the hell is my battery, network bandwidth, etc is being used for it what is essentially 90% wastage?
In these discussions, I find defendants of these SPA designs to almost always point to vague points about "rich UI" or "highly interactive", or make up complete hypotheticals like this example of pre-loading likely-to-be-clicked links. Show me the code. Show me the crazy-fast link-click-predicting website that does this and loads faster than, say, HackerNews.
It's good to see the pendulum swinging back to some semblance of sanity on this topic. The past ~5-10 years of the SPA being the default choice has been a wild time. I couldn't be happier that it's starting to receive some widespread criticism.
https://hn.svelte.dev/ is a Sapper implementation of Hacker News. It uses the preload-on-hover/touch technique described in the article. In my experience it does indeed feel faster than Hacker News, despite basically being something I threw together one weekend
Which debunks one of the critical advantages of an SPA.
The other is transitions. Which are never implemented because it's just too damn hard. Instead you get a spinner, 17 API requests (instead of 1 Ajax request), and a giant fragment of the DOM replaced whilst you lose your scroll position.
The author isn't just a React apologist, but also seems to want javascript everywhere.
So much of this debate - sever side rendering, etc. - has to do with the inefficiency of DOM. Mobile and desktop UI toolkits aren't DOM for a reason. They do application UI and have application concerns, meanwhile JS is sitting in this weird Frankenstein ducktaped documents-and-apps markup world. An ecosystem that has to support a million (often competing) things, but all slowly, and with decades of legacy we can't break.
It's going to be interesting change of landscape when we have isomorphic Rust/Wasm delivering truly native web apps that don't render on top of the 30 years of DOM kludge.
The Rust community is just getting started and hasn't had a long time at this, but there's already some really impressive UI work being done in the browser with Rust/Wasm [1]. Once Rust frontend frameworks begin to arrive, it'll be a whole new ballgame. It's so damned fast.
The DOM seems slow, I think mostly because it requires translating between rendering systems - the representation of the html has to be updated, the styling has to be applied, and the change has to be painted on screen. This explains why updating a documentFragment as a batch operation is much faster than changing the dom directly in a loop.
God forbid. I happen to like adblockers, inspecting app DOM, and applying custom styles and features with browser extensions. I can customize even poorly-built web apps like Youtube and Facebook with enough poking around and custom selectors. It's great.
Don't bring native UX sensibilities to the web, or we'll retaliate by pushing Electron even harder for cross-platform native development. And yes, that is a threat. ;)
Every time this conversation comes up, I make the same point: the DOM is not a layout tool, the DOM is a user interface. The DOM forces you to give your users a pure-text representation of your current state -- it forces you to think of your current state as an XML-like data object before it allows you to think in visual terms. That's the point: your user interface is XML, not pixels.
Imagine if every native GTK app forced you to come up with a universal text interface that worked in terminals before it would let you add any of the weird keyboard handlers and unresponsive layouts and HDPI-unfriendly menus on top of it. That is how the web do.
This is weirdly lost on HNers every time this "debate" comes up.
Native apps are the wet dream of any website they complain about for having too many trackers and ads and data exfiltration.
The web browser is a fluke of history that gives users power that we don't have with native apps. Let's not be so quick to give it up just because you've never mitmproxy'd your phone to see what it's doing.
That is why I stopped consuming Reddit, Twitter, and Facebook - they aggressively push their shitty battery consuming apps that I don't want to use.
Nothing about TFA indicates that its author is a React apologist. Do those even exist anymore?
Google Sheets has used canvas for rendering for years.
Maybe reinventing the whole damn car on canvas isn’t a great idea either. I bet that the keyboard isn’t the only part that doesn’t work.
Flash was hated for this reason too: Breaking affordances. Imagine everyone reinventing their own UI framework on each app.
I don't like this argument. It's like saying that because C++ can do everything, we don't need to build a new language to fix problems inherent with the existing paradigm.
Rust is just getting started, so give it time.
DOM is overloaded, messy, and slow. We need an application UI toolkit similar to what Android and iOS provide.
The problem is that by the time you've finished building a WebGL layer that has the same accessibility features and component-level controls and custom shortcut support and extension APIs as the DOM, it will no longer be a snappy, fun, fast experience. What you'll end up with is a second implementation of a web browser that runs on top of a web browser, and that has to be downloaded fresh every time you visit a new website.
WebGL and Canvas frameworks are fast because they allow you to build an interface that does fewer things -- that only worries about pushing pixels to the screen. They allow you to avoid adding the overhead of app-agnostic universal UI components with predictable behaviors, or accessibility layers, or custom font support, or universal shortcuts for scaling, or responsive layout support.
And sometimes you don't need that stuff. Sometimes you do only care about pushing pixels to the screen, or you're doing something very specific that allows you to avoid thinking about edge cases. But if you're going to universally replace the DOM, then you do need to care about edge cases.
Keep in mind, Firefox is also running in C/Rust and rendering webpages using OpenGL. It's operating on the same bare-metal layer. The DOM is already written in low-level languages and rendered out with OpenGL. It's not slower than Canvas because they used the wrong tech stack, it's slower than Canvas because it does more stuff.
I'm very excited about WASM as a replacement for Javascript. And to their credit, that's what the Rust team is doing. For the most part, the direction that Rust is actually going isn't towards WebGL, it's towards getting good DOM access in WASM.
The future of Rust/WASM mostly looks like people writing code in the language of their choice, with speed improvements based on the fact that the language isn't high-level or garbage collected, and then using that faster, more comfortable language to manipulate the DOM, just like we always have.
Apart from "apologist" not really being a term conducive to constructive discussion, I think, the author is also the author of one of the main competitors to React (Svelte), and has often and strongly criticised it. (Which is not to say that he hates it, but just to point out that "apologist" isn't really correct, and thus that it could be that the article is triggering some defensive reflexes that might not be entirely justified.)
Quite the contrary.
The author has criticized React openly _many_ times.
He is also the creator of Svelte which mainly aims to reduce the amount of JavaScript web apps are using compared to React, jQuery, etc.
Many SPA developers rapidly move from project to project. Every once in a while, they learn yet another JS framework, and then hop between jobs to use that.
They never look back. They never truly need to take responsibility for a tech choice.
Try to hire an Angular 1 developer to work on 300K lines of code today. You can't. No skilled front-end developer would take on such a job with options to work on hotter tech.
Any SPA choice you make today will be completely obsolete in 3-5 years. 3-5 years, or even 10 years or more, is a normal life cycle for a serious web property. And not just obsolete, you'd have the hardest time getting the tool chain to still work at all.
The original developers don't care, they using tech N+5 now, somewhere else. They'll be very vocal how N+5 is vastly better than anything else, and really the only option for "the modern web".
Angular becomes a front-end COBOL in just a few years, not 3 or 4 decades.
There's more. A typical front-end architecture depends on a complex interwoven tool chain with a lifespan of at best years, sometimes even months.
Same for modules. It's normalized to have an absurd dependency tree of hundreds to thousands of inter-depending modules. The vast majority of which will be abandoned in a few years.
It seems that page transitions really are the main reason given for using JavaScript-everything for sites and simple applications that otherwise could have been built with some fast loading HTML and a couple of POST forms.
A good example are sophisticated forms with realtime validation, dynamic fields that depend on other fields, etc.
But let's look into the point made by the author regarding the inspiring example of Apple's app store UX, and trying to aim for that.
We, meaning as an industry average, will not achieve that level of UX no matter the stack. Because nobody can afford it. It requires a team of top designers, interaction engineers, dev, QA, etc.
That's the problem with the SC valley mindset. They assume every web property has this huge team of top engineers behind them, and that this is a status quo, and applies to the whole web.
They have no idea what bubble they are in.
In native apps, I'm a sucker for pretty transition animations, and I'd love to see those on the web.
But, every website I've ever seen with those types of fancy transitions for large pieces of content (as opposed to little on-page microinteractions) also feels slow, clunky, and heavy. As such, I've come to associate such transitions with slow, clunky and heavy web pages.
I'm not really a web developer, so feel free to tell me if everything that follows is stupid: It seems unlikely that our "current trajectory" can ever resolve this problem. Instead, we'd need an underlying technological shift in how browsers work.
Most large transitions are basically browser hacks—albeit ones we've used so frequently, and for such a long time, that they've come to be officially supported and accepted. To make them more usable, they'd probably need to work alongside the browser in some manner.
And JavaScript has laid claim to that throne which was once primarily contested by enterprise Java and .Net.
Some project starts and they decide to use an uncessarily complex framework (which may be well engineered for the cases it was developed for at the Facebook/Google scales of the world) then grab 3 more and glue them together using poor practices, then proceed to build all sorts of complexity ontop of that stack using poor engineering and typically non-standard practices.
New people join and voila, they immediately need to understand these 3-4 underlying complex yet well engineered systems and how they are poorly glued together before they can even begin to unravel the poor engineering practices that sit ontop of them so they can fix and extend them.
Parts of the application look well structured, other parts are incredibly confusing. Suddenly you need to go back and better understand some of the underlying frameworks leveraged so you can actually discern what's supposed to be going on which takes forever because that underlying framework is quite complex in and of itself.
In the end you're running around documentation page to documentation page from frameworks and looking at undocumented code someone wrote in between, consuming stupid amounts of time.
Someone built a big pile of technical debt and you just inherited it. Good luck, they've switched to another team, project, or employer and moved on before the mess unfolded.
Meanwhile, you're wondering why 90% of this exists for a product feedback submission form.
The modern web delivers some of that, but only accidentally. The modern web is all about delivering potential malware to me and expecting me to run megabytes and gigabytes of this code, all in order to … display pictures and text, something the browser has been capable of for over twenty years.
Now compare that to the rest of software where you don't have that control and you'll see software has always been in the state of your hyperbole about pushing malware to your machine that can always be making http requests that you can't see.
It's a bit sad that even technical people are only waking up to this when it comes to the web because they can finally see it with the browser's network tab, so they think it's just a web problem and begin advocating for throwing the baby out.
This is like saying a lightbulb turning on quickly is jarring. It's the expected, immediate behavior. If every lightbulb I used turned on with different durations and easing functions or flashed colors at me, or loaded a flashing placeholder while the lightbulb loaded, that would be jarring.
You'll be taken more seriously if you don't engage in meaningless hyberbole. You could recreate the open-the-reply-page-in-a-new-tab behaviour of HN (with the context-preserving JS enhancement for the non-middle-clickers) with a few kilobytes of JS if you're doing it right.
That is the crux of the problem. Why is there this obsessive need to recreate what is already available?
> with a few kilobytes of JS if you're doing it right.
As experienced with PHP developers in the dark ages, that never works. It will be a choice between easy and incorrect or difficult and right. The majority will never do it right for various reasons. And the web will loose in the eyes of the users.
For exactly the reasons stated: to both support in-line reply without the jarring page refresh, and to be able to open the reply form in a background tab.
And I think what Rich wants/is working on is making it both easy and right, because indeed, otherwise it will never happen.
I just shift-clicked reply, and it works quite well. I might add a rule to my sway config to make the "Add comment" windows floating :)
In the end, everyone is different and has different needs. That's why I like standards: everyone can set their user experience as they prefer it (or pick a web browser that chooses good defaults for them).
It's a reaction to the reality of the web, which is that Javascript is commonly used when it's entirely unnecessary, much more of it is often used than is necessary, and it's often used to abuse webpage visitors. Most on HN don't object to ajax-y bits of JS that make a page more pleasant to use.
I'm also kind of gawking at the screencast he uses as an example:
https://twitter.com/ryanflorence/status/1186675229621248000
Ryan Florence makes a fine point that his tool is being used to build things that don't benefit from it, but this isn't necessarily a good interface. It's pretty but it's just got way too much going on at once. How does anyone actually read in that context?
The lightbulb example is also not a good one. A lightbulb transitions between two states. An interactive application transitions between hundreds of states. Full page refreshes make each transition clunky and noticeable. Only programmers look at it and say "yea, that's fine," because we know how difficult a web browser is to implement. But end users don't care about difficulty. They care about the end result.
Have you tried the dillo web browser, for instance? It's refreshingly fast and snappy (including on my old atom netbook from 2008) to use.
I have had a subjective feeling for a while that some user interfaces felt "solid", almost tangible. To me, Windows XP does that. Windows 10 feels like a smokescreen next to it. There might be pretty colors, fancy gradients, but I do not feel like I directly control the UI anymore, I am forced to wait for an animation to finish, I have trouble determining where the window border is. And I've found it much harder to rely on my positional memory to navigate apps that have a smooth transition, like mobile apps.
This is not a rant against Windows10's UI (I have barely used it, and just use it to draw a comparison in the Windows family, you could also compare different KDE versions), but with contemporary user interfaces in general. That could even be said of some command-line interfaces. We're also used to progress bars, or worse: spinners. Trained to wait idle in front of our computers, while a dozen megabytes of frameworks are stuffed down the pipe so that the page background is just the right white shade (probably while I am using a dark theme, and the CSS rules to apply that shade probably only work correctly on Google chrome). That's what modern web feels like to me.
No, not just programmers. Also end users. It's a complete myth that the traditional link/page refresh method is jarring to users. It's perfectly normal and expected to click a link and to have it loaded in a reasonable time frame, without some weird transition in between.
We have had dimmable bulbs that are far less jarring for a long time and now smart bulbs can do the easing automatically when you flip the switch, and change color and brightness depending on time and environment.
It’s such a nice improvement. I don’t even notice until I turn it off and I realize that white light at night is piercing and yellow light during the day makes me sleepy. Or that 100% brightness in the morning and night is way too much.
I think it’s a case of not wanting to go back once you realize what you’ve been missing.
Sure the world you describe with flashing bulbs would be horrible but that’s not what it’s really like.
What you’re complaining about is the lightbulb taking 3 seconds to turn off and its toggle costing $100. Now that something nobody likes.
A browser that implemented a few semantic tags (including <img> and <video>), fonts, colors, and flexbox would be useful, secure, fast (even on slow devices/connections), and far easier to implement than the behemoths we have now.
Let the application web keep evolving, but specify a well-defined subset for sites that don't need all the features.
SPA as the status quo is a myth. It's a Fermi paradox. Where are they? Almost nothing of any importance is an SPA. You'd think that if they have such superior experience, they lead to superior business metrics, thus they are everywhere. Asides from true app-like experiences like Gmail, Spotify, the like, they're nowhere to be found. Not in places of significance. It's 2020 and Amazon continues to be old school page refreshes. Last time I checked they're doing quite OK. Even big parts of Facebook, the poster child of complex interactivity, continues to do full page refreshes in big parts of the experience.
Instead, SPAs are a startup default, not a web default. Big difference. And the way most are implemented, they don't live up to their potential benefits, instead deliver UX that is even worse than static:
- breaking back buttons - breaking scrollbars - rendering things that aren't interactive
These things don't have to occur, they can be solved in an SPA, but they do occur a lot in the wild. This matters. We live in the real world.
As somebody else here already mentioned, the article takes a completely wrong approach. It assumes some binary choice or outcome. The original point instead was that the web is not a single thing. It's a huge thing where different stacks are to be used for different use cases. This point is largely ignored, instead it is implied that SPAs should simply solve such use cases better, whilst continuing to be a default.
On the particular point of SPA links being typically faster/smarter: there's about 500 drop-in solutions to speed up static links. Which are usually not needed, because the point of such links being bad is overstated and lacks any user evidence. See my earlier remark on virtually all major websites using plain old links. They wouldn't if it was so bad.
Finally, a huge part lacking in this discussion is the accessibility of web development itself. The SPA web is an engineers web, it requires advanced programming skills, infrastructure, increasingly complex tools chains, and so on. If this was to be a true default (luckily it isn't), it would lock out the vast majority of people wanting to contribute to the web.
It's sad to see this sub culture of hardcore engineers with Macbook Pros thinking they own or represent the web or web development.
Some images on the web are poorly optimized, but that doesn't mean we should not have images.
The whole point of a SPA is to give a user a better experience. If on average this does not materialize in the real world, and often achieves the exact opposite, the entire concept fails.
Bad SPA implementations are the standard. Saying that it's possible to make a good SPA implementation doesn't change the real world outcome that most often, they don't deliver.
According to this article we should accept:
- Heavy sites that take a long time to load initially.
- Are sluggish and unresponsive when not on this year's flagship phone.
- Will probably break if the user leaves a tab open for too long.
Because:
- There's an opportunity to shave a fraction of a second off of your page load times if you want to utilize predictive analytics or extensive preloading to ensure the content request is already loaded in cache.
The modern web is just layers upon layers of hacks and it's ugly and slow.
I would recommend to anyone who disagrees to install the NoScript Add-on and run with it for 6 months. I did so and here's some things I've observed...
When I enabled NoScript:
- Most sites do not work without some Javascript that's been used to address Page reflow. They have a global display:none attribute that's removed after the entire page has loaded. All this discussion about page load times or responsiveness is BS when sites are hiding their site from you until it completely loads to avoid reflow.
- Most sites rely heavily on Javascript to do basic formatting that's trivial in CSS.
- Most sites use Webfonts loaded via Javascript
When I disabled NoScript:
- My Phone went from 60% battery at the end of the day to <20%.
- The Web is slow again.
- User hostile behavior like pop overs, auto-play video, and other garbage.
Well, I wrote the article, so I can say with some authority that you've badly misinterpreted it! Somehow I manage to build sites with exceptional performance that are snappier than the equivalent JS-free sites, using the techniques I talk about (and https://svelte.dev).
Yes, there are a lot of bad sites out there that abuse JavaScript. No, that doesn't invalidate the article's thesis; it supports it.
Perhaps but point from Tom MacWright's article is that we're over complicating simple things (e.g blogs) with complicated and heavy libraries and frameworks. Then when we encounter performance issues we attempt to mitigate them by layering on additional crap or spending significant time optimizing the crap out of needless complexity.
Your suggestion that full page loads are unnecessarily slow and cumbersome and that we can use predictive analytics, preloading and a slew of other techniques to get a faster response to a page load is the equivalent of building a Rube Goldberg machine to turn the page of a book "that much faster". Sure your techniques address one metric (i.e. response time) but they introduce all manner of other problems that then need to then be solved. For what?
> Somehow I manage to build sites with exceptional performance that are snappier than the equivalent JS-free sites.
Somehow you manage demonstrate that you completely misunderstood what Tom MacWright was saying. Back to my page turning analogy, I have no doubt someone could build a machine to turn the pages of a book "better" than I can. Does that mean everyone should have this miraculous page turning machine?
At the end of the day my local pizzeria doesn't need a multi-megabyte SPA application utilizing client side ML and predictive analytics for me to get the phone number so I can call in an order, but that's the modern web.
I used to think it was an oversimplification to divide the web into Documents and Applications. I thought it was more accurate to say it was a continuum, and using two different techniques was a sign that we still had not figured it out. After all, a blog post about programming might have an interactive example. An article about retirement might embed a calculator. If you try to categorize a site or even just a page as Document or Application, it gets fuzzy. But if you look at a page and just try to categorize it section by section, as Document or Application, it's easier. (Hence, Web Components make more sense to me.)
So anyway, most people spend some time surfing the web --- by that I mean visiting Documents. Clicking links from search results, to articles, to more articles. If you aren't using an adblocker, I can't imagine how you don't end up throwing your laptop against the wall. I ended up just turning off JavaScript for most sites, and the web looks more like how I think it should look. Every once in a while these people will post a rant, and it will resonate with most people.
But then an Application Developer will read it after a long day and say, hey, wait are you saying I should write my Application (like GMail) in jQuery? To be honest, Applications don't bother me the way overscripted Documents do. I almost expect them to be kind of slow. After all, even some Desktop Applications still have loading screens. So I don't mind so much if you're using React or whatever for your Application or even for that calculator embedded in the article about savings.
But for Documents --- like articles, blog posts, company home pages --- well, one thing I agree with SPA developers is that there could be less server-side rendering. These kinds of sites could often be compiled ahead of time into static HTML. Server-side rendering is better than SPA for these kinds of sites, but static sites are better than server side. I mean, who enjoys getting "Error connecting to MySQL database"? (Okay, that's rare.) I'm intrigued by the old-new JAM Stack :)
It's not a perfect parallel, but this reminds me of systems like Qt Designer, or Apple's Interface Builder/Storyboard, or Android's XML layout system. Those systems all essentially give you an "initial render" made with one technology (XML files created in some sort of visual GUI-builder program) and "subsequent interactions" made with another (C++/Swift/Java code).
My take is, however, that the web as we know it is going to be split in apps and websites.
Sites is stuff that works fine with an 'old classy' request->response method, stuff like blogs, newssites, wikis, information sites, simple booking sites etc. You can make a great living just doing that. Probably most content available on the web will fit in this category. However I think Wordpress and similar frameworks / libraries will continue to dominate this field.
Apps is stuff where you practically need a SPA, where there is no choice. Things like music players, photo editors, file managers, chat applications etc.
Old mom n pop shops will still be around and never need a SPA, but a lot of applications being ported to the web do need it. If you do old style websites, there is nothing wrong with that and it still works fine for a lot of stuff. But if offline capability is a requirement (as an example), it is very hard to make a compelling case without making a SPA.
I like both, I find the old style apps to be a lot quicker to develop but the SPA, PWA style app gives the user a much native feel which is important for a lot of apps.
Speaking of which...
> I'm not aware of any other platform where you're expected to write the logic for your initial render using a different set of technologies than the logic for subsequent interactions.
I'm not aware of the backend, the server side of many mobile application being written in kotlin (or java) or swift.
In fact, it's common for the server and the client to be written in different technologies.
Yes, I know that's not exactly what he means and in a native application, the application is in charge of the initial render. But he's criticizing APIs and I don't see how this statement can be possible without APIs unless he expects the backend to be in the same technology. Which, again, is not unusual for it not to be so.
Or we can say, they are implementations on how to achieve the same thing. The difference is performance.
SPA tech is a good thing for web sites that have little appy parts (like checkout processes, or maps). I'm not saying for the entire website, but just little focused parts. Can you imagine going back to (the old) Yahoo Maps now that Google Maps exists?
Are SPAs good for entire websites (like the new reddit?) Personally I like the new reddit over old reddit. But this is where your users are highly relevant. If you don't listen and choose SPA for millions of users of the public, you will probably get Feedback. You might be lucky and only 10% hate it, but it might explode in your face if that's a key 10% that encompasses influencers.
Being able be assured that you can find/hire folks to work on your tech stack is a pretty important concern for a business. Thus, it can make sense to go with a popular framework/language because it can help in that regard.