News for hackers. Stuff that matters.
Re:In spite of an increase in Internet speed, webpage speeds... by amw-zero on Tuesday August 04, 2020 @10:47PM (#24056797)
It probably wasn’t the first, but the first notable SPA I can think of is Gmail. Do you think that architecture was just decided on by some noobs right out of school? Since it was novel at the time, probably not. That leads me to believe (along with my own anecdotes and observations) that there are real benefits to SPAs. Are there trade offs? Of course. But there are benefits too.

The idea of an SPA is only strange in the web dev community. An SPA is equivalent to a native app client - they are long running, stateful processes that communicate with a backend. That architecture has worked for decades, and there are things that you can do as a result of having that stateful process that you simply can’t do with server rendering, like caching response data to share with totally unrelated view components later on in the application. You also get to use a real programming language to design your front end instead of living within a template language, which no one acknowledges as the biggest hack of all time. Template languages exist precisely because HTML is not a sufficient UI tool in all cases.

Re:In spite of an increase in Internet speed, webpage speeds... by another-dave on Wednesday August 05, 2020 @03:47AM (#24058253)
Gmail is probably the example that I hold up as an SPA gone awry — on a new machine & T1 broadband you can still get _very_ slow loading times to open the site at all.

& what it's serving you in the end doesn't feel like it's heavy lifting in this day & age — a subject line & preview of your first N emails — I think the site could be much more responsive if they had a JS enhanced page (e.g. using it for their predictive text) rather than an SPA.

Re:In spite of an increase in Internet speed, webpage speeds... by SteveMoody73 on Wednesday August 05, 2020 @04:19AM (#24058422)
GMail has gone downhill massivly since it first started. I Can read the entire contents of a mail and go back to inbox and it still shows the email as unread. Closing the gmail tab usually comes up with a prompt saying it's busy and am i sure i want to close tha tab. I would consider it as an example of how not to write a SPA these days
Re:In spite of an increase in Internet speed, webpage speeds... by hnick on Wednesday August 05, 2020 @05:42AM (#24058888)
If we're comparing things to how they were just a few years ago, Maps has been far worse to me than Gmail lately IMO.
Re:In spite of an increase in Internet speed, webpage speeds... by amw-zero on Wednesday August 05, 2020 @05:29AM (#24058819)
I made a comment elsewhere about page load time not being the only dimension of performance. Page load time’s importance gets amortized across the length of the whole session. You should always try and minimize it, but in an application like Gmail you’ll be using it for minutes at a time. Each subsequent interaction is now quicker because there doesn’t need a page refresh.

Page load time is one dimension. We get really hung up on it.

Re:In spite of an increase in Internet speed, webpage speeds... by another-dave on Wednesday August 05, 2020 @05:51AM (#24058936)
I agree with your reasoning but not how it applies to Gmail :)

I'm always hazy on the term amortized, but my understanding of it was the opposite — in that, you should try to chunk up as much as possible. If you are using Gmail for a longer period, having to wait for functionality like advanced search or predictive typing is less annoying as the extra time you need to wait is a smaller portion of your session overall. Plus, these things may have lazy loaded by the time you come to use them.

On the other hand, if you just wanted to reference an email quickly — e.g. I often need to dip into email quickly, for example, if I've travelling and have booking confirmations / QR Codes / PNRs etc. in starred messages in the inbox — you'll notice any extra load time so much more.

So to me, feels preferrable to have as small as possible initial load time, then extra functionality progressively loaded in the background.

I do agree for something like Netflix for example that a 'big load up front' is probably preferrable. I'm 'in for the long haul' as I'm going to be watching something that's at least 30minutes up to a feature length film, so a few seconds extra load time is negligble.

Re:In spite of an increase in Internet speed, webpage speeds... by amw-zero on Wednesday August 05, 2020 @11:06AM (#24061609)
When I said “amortized” in this case, I just mean that the cost of the initial page load is spread out throughout the length of the session. Like you said, if you just want to quickly open an email then close the app, the session time will he short and the page load cost will be a large percentage of the session time.

I’m having trouble comprehending some of your sentences (there’s some running on going on). So I don’t understand what you mean by “waiting for advanced search” - is that better or worse in the multi page world? I think it’s worse. With an SPA, all of the UI navigation can happen on the client, which is as quick as possible (no server round trip). The actual searching in an SPA would be via an API and you get a nice spinner in the meantime, again with no page load. All smooth UI transitions which indicate to the user what exactly is happening. No blank page while a new page is computed without knowing what exactly is going on.

Re:In spite of an increase in Internet speed, webpage speeds... by another-dave on Wednesday August 05, 2020 @01:02PM (#24063032)
sorry writing while eating lunch earlier so no doubt could be phrased better :)

What I was trying to get at was that there are lots of "optional extras" that seem to get loaded up front at the moment that would be better if they were progressively loaded.

I think you see that a lot with SPAs in a way that you didn't when JS was used to 'progressively enhance' sites rather than for all interactions.

I don't think it's a problem of SPAs by definition — you could engineer an SPA to progressively load what's needed, and make the first load very slimline & then only load additional features while idle or on request, which is why I think GMail is a bad example. For example, I've just tried logging into Gmail in a fresh Firefox window (no cache) that I set to throttle to a "regular 3G" connection speed in the browser. It took literally 30s to load (with one email in the inbox).

Re:In spite of an increase in Internet speed, webpage speeds... by amw-zero on Thursday August 06, 2020 @07:40AM (#24070062)
Gotcha. React Suspense is trying to be the best of both worlds. It allows you to load code for components on the fly, when they are needed, and not all up front.
Re:In spite of an increase in Internet speed, webpage speeds... by missblit on Wednesday August 05, 2020 @12:41AM (#24057297)
Gmail has a "basic view" that works without JavaScript, just good old fashioned HTML forms and hyperlinks and server-side state.

Though it's more or less static feature wise, if it weren't for the updated logo you'd never be able to tell it was written within the last decade.

Re:In spite of an increase in Internet speed, webpage speeds... by WillPostForFood on Wednesday August 05, 2020 @12:06AM (#24057173)
there are real benefits to SPAs.

Yes, but a lot of the benefits of SPAs and the libraries needed to work on them accrue to the developers, not the users.

Re:In spite of an increase in Internet speed, webpage speeds... by dsjoerg on Wednesday August 05, 2020 @12:17AM (#24057220)
It's funny to think of developers and users as two distinct constituencies with distinct interests. I had thought any good developer, by definition, would do what's best for the user. Therefore the interests of both groups are the same.

But I suppose you're right that the average developer is their own damn person with their own interests which can only ever partly align with their customer's.

I suppose there are actually three parties, all distinctly interested: the programmer, the employer, and the end user. The programmer wants to get paid and do "good work". The employer is actually a multipart entity: management and investors, each of which have distinct interests. The end user is not a single such person but a mass of individuals, each with a different set of interests.

This is getting messy!

Re:In spite of an increase in Internet speed, webpage speeds... by TheSpiceIsLife on Wednesday August 05, 2020 @01:07AM (#24057445)
The individual end user can also be multiple distinct groups, some simultaneously:

Parents / caregivers / guardians and their charges, who can be further split in to children, teens etc etc.

Re:In spite of an increase in Internet speed, webpage speeds... by amw-zero on Wednesday August 05, 2020 @10:47AM (#24061374)
Some benefits are for developers. And some are for the users. For example, many users, particularly ones who care about the look and feel of things, prefer when there is a smooth transition between screens in response to their actions.

You simply can’t do that with server rendering (barring hacks like Turbolinks, which are just approximating SPAs).

Re:In spite of an increase in Internet speed, webpage speeds... by WillPostForFood on Wednesday August 05, 2020 @07:17PM (#24066662)
I agree, and I'm more critical of heavy front end Javascript frameworks that are part and parcel of SPAs. Things like the Turbolinks hack you mention, IMO, provide the best user experience, especially fast initial page load. But that can be messy to develop, so we end up with Angular or React which smooth the development issues, but make pages fat and slow for users.
Re:In spite of an increase in Internet speed, webpage speeds... by chillfox on Wednesday August 05, 2020 @12:58AM (#24057397)
Sure, SPA is the correct technology for certain applications, but not for every damned website.
Re:In spite of an increase in Internet speed, webpage speeds... by dzhiurgis on Wednesday August 05, 2020 @12:03AM (#24057160)
So why are we conflating web apps vs web sites exactly?
Re:In spite of an increase in Internet speed, webpage speeds... by TheSpiceIsLife on Wednesday August 05, 2020 @01:08AM (#24057453)
Most people who aren’t involved directly with web development just call everything a ‘web page’, or ‘the web’.
Re:In spite of an increase in Internet speed, webpage speeds... by amw-zero on Wednesday August 05, 2020 @05:32AM (#24058839)
Because that’s what everyone else does when saying that the performance characteristics of the two should be evaluated in the same way, e.g. page load time.
Re:In spite of an increase in Internet speed, webpage speeds... by TheSpiceIsLife on Wednesday August 05, 2020 @01:02AM (#24057419)
> Gmail. Do you think that architecture was just decided on by some noobs right out of school? Since it was novel at the time

This is Google we’re talking about.

Does fit the caricature.

Re:In spite of an increase in Internet speed, webpage speeds... by simonw on Tuesday August 04, 2020 @10:57PM (#24056858)
SPAs are a good fit for webmail. They are a bad fit for many other projects.
Re:In spite of an increase in Internet speed, webpage speeds... by hobs on Tuesday August 04, 2020 @11:54PM (#24057114)
And 99% of the time all of that is pure YAGNI.
Re:In spite of an increase in Internet speed, webpage speeds... by reaperducer on Tuesday August 04, 2020 @11:33PM (#24057029)
Was Gmail always an SPA? My recollection is that it was a regular web site when it launched, and went SIA when everyone else did.
Re:In spite of an increase in Internet speed, webpage speeds... by xenomachina on Wednesday August 05, 2020 @01:15AM (#24057482)
Gmail has been a SPA since launch. There were some pre-launch versions that were not, and it has always had a plain HTML fallback mode.

I believe there may have been some major changes to the way it did the client-side rendering a few years after it launched. The original version was more ad hoc, since it was pretty much the first time anyone (at Google, at least) had built a real SPA. Later they built tools and libraries, and developed a more systematic way of doing things. (I was at Google during that time period, but never worked on Gmail.)

Re:In spite of an increase in Internet speed, webpage speeds... by Legogris on Wednesday August 05, 2020 @01:24AM (#24057520)
While Outlook Web Access (2000) was earlier, Gmail (2004) and Google Maps (2005) were definitely instrumental in establishing AJAX and the SPA pattern (though the term SPA came much later I think).