Hacker News new | ask | show | jobs
by niknetniko 1772 days ago
> These apps [single page web applications] also tend to feel snappier because page loads are not required for every request.

This isn't my experience at all, especially when network conditions are not great. The browsers has error handling and a progress bar. Single page web applications often have bad or no error handling and you have no idea if the request failed, the code errored or something else went wrong. You need to refresh the whole page if something goes wrong, which results in having to load a ton of JS every again, negating all possible savings in time and data usage.

8 comments

One of my real pet hates is software developers who assume everyone's running their software on an excellent internet connection. Badly written SPAs are the worst offenders but I also pretty much gave up on any sort of regular gaming because pushing these enormous 10-20 GB updates over a sluggish connection just became insufferable. Add that to the constant and shameless fleecing of customers that's apparently the norm now and the enjoyment to effort ratio is just too low to bother with.
> One of my real pet hates is software developers who assume everyone's running their software on an excellent internet connection.

That could be said for a lot of assumptions developers make. Everyone has 32GB of ram, everyone has an SSD, everyone has an i7...

It is an old problem, but like almost everything else in computing for some reason it seems to have become much worse since about 2010.

The spread of capabilities is bigger now.

In 2000 a developer might have been developing on a Pentium 3 with 128 MB of RAM, but they could reasonably expect their audience to be using at least a 486 with 16 MB of RAM because that was the minimum spec for IE4.

Now you're stuck with trying to impress people with a Ryzen Threadripper and 64GB of DDR5, but your webapp still has to support everyone's iPhone 7 (with 2GB to share with iOS and everything else they have running) for as long as Apple does.

What I think is even more different is that someone with the 486 in 2000 was used to the idea that they wouldn't be able to run some software, but unable to run a website? Unheard of, it's just broken.
Apple still supports the older iPhones. For example, the iPhone 6 that doesn't get the latest iOS version anymore (stuck with iOS 12) is still supported by regular security updates (the last iOS 12 update was 54 days ago).

Apple supports (at least security wise) probably more devices than you think.

I was working on a proposal for a client who wanted to build a marketplace, but most of the vendors had low-end tech equipment, and he went with someone who had a lower quote. My biggest caution was that a limited number of developers actually understood what to do with slow internet connections and old tech. Marketplace failed... ignorance sometimes is the worst thing in people who believe that it works on my machine and will work on everyone else's.
> One of my real pet hates is software developers who assume everyone's running their software on an excellent internet connection

Maybe it's a process problem, not a developer problem. Like management prioritizes a dozen analytics trackers and ad partners without any tooling for performance testing on a range of devices.

I guess my language was a bit imprecise, by "software developers" I meant "people involved in the software development process" rather than the specific role of the person writing the code. I guess I should have said "software companies" or "companies developing software". Managers definitely deserve their share of the blame for demanding user-hostile bloat too, likely more blame than the developers.

On the developer end (as a developer myself) we definitely deserve some of the blame for embracing things like Electron with such zeal in my opinion. I don't care how much memory a developer's workstation has, there's still a lot of hardware in use that can't take the bloat. I'm not saying everything has to be a native app written in vi against an original print of The C Programming Language as Brian Kernighan and Dennis Ritchie wrote it in 1978 or it's automatically shit, but something like React Native for the desktop would be far less horrible in terms of resource usage I reckon.

It could be that the customers most likely to pay are on more recent hardware. So why bother catering to everyone else if there is no return on investment.

Or for free software, chances are it is add supported. So push as many ads and trackers until the churn rate gets too high or competitors take market share.

Or more generally, maybe the design just follows the money.

Could also be reverse: why pay for software that won't run on your computer anyway?
Absolutely, that's a calculated decision that companies make. It is fully expected that a certain market segment is not interested in being a customer at a given price point. Market segmentation is often done by OS version or device hardware profile.
An SPA requiring a backend connection is quite simply a distributed computer and all the usual caveats about those including network availability apply.
Counter point: Often I am faced with doing it right or doing it within budget for an activation that is designed to live for a few weeks only. I aim for 100% compatibility with different hardware, OS, browser, user experience, client expectation and non suicidal business practices.
> One of my real pet hates is software developers who assume everyone's running their software on an excellent internet connection.

It's not the developers' job to assume anything about users. It's the project managers'.

Infinite scroll pages are the worst with this..

You scroll and scroll, and scroll, and every time you reach some level "down", another section is loaded, then at one moment it stops. Something somewhere fails, no more new sections, no way to continue from that point, only a full refresh and a huge scroll down.

Which wouldn't be nearly as bad if they gave you an offset parameter, or updated the offset parameter in the URL which they almost never do.
Hello Patreon.
> the code errored or something else went wrong. You need to refresh the whole page if something goes wrong, which results in having to load a ton of JS every again, negating all possible savings in time and data usage.

Not to mention that some SPA doesn't maintain state, and all the sudden one need to jump through the the process all over again. Personally SPA seems to try reimplement a lot of browser feature all over again in client side JS.

I think it's just like anything that's gotten popular. SPAs are all over the place now, which means there are plenty of bad implementations along with the good ones. But generally you only notice the bad ones due to frustration. This isn't SPA-specific IMO. I've seen plenty of server rendered pages/sites that were also poorly done back when those were more the norm. Heck, I still help maintain a set of CGI scripts that are horrible and slow.
I agree and I hate two things about SPAs.

- Works terrible in bad networks.

- And the thing I hate the most is the shifting of images, links when the page is still loading. But this may be a implementation issue.

As is common when people rant about SPAs, your dislike (at least as written here) is not actually about SPAs but other things

> Works terrible in bad networks

Yes, software traditionally works shitty under bad network conditions unless the developer actively tests under bad network conditions or has previous experience of handling bad network conditions. This is as much true for anything developed ever that touches a network.

> the shifting of images

This is simply developers missing to add width and height attributes to their <img/> elements. This has been happening since the dawn of the <img/> element and is unlikely to disappear. Also has nothing to do with SPAs, same happens with server-rendered HTML.

> unless the developer actively tests under bad network conditions > This is simply developers missing

That's the whole thing. SPA = state. It requires a lot of dev time to properly handle everything. With stateless applications, you can simply refresh your browser.

The sluggishness is not only because of bad network conditions, but it's multiplied by the huge application that has to be sent over the network, application initialization, and the many subsequent network requests.

> The sluggishness is not only because of bad network conditions, but it's multiplied by the huge application that has to be sent over the network, application initialization, and the many subsequent network requests.

A "huge" application can be broken up with code splitting/dynamic imports. Initialisation can be seeded with serverside data or saved in browser storage between pages.

The only semi-unavoidable part is the "subsequent network requests", but even these can be sped up with caching, batching, etc.

> It requires a lot of dev time to properly handle everything.

But yeah, these things take effort

The network requests could be done with more intelligent apis

But if you take everything into account, you can also develop a really good native app.

This is not reality.

>Yes, software traditionally works shitty under bad network conditions

not everything is equally affected by bad network conditions, SPAs generally are very badly affected by bad network conditions, indeed what is a bad network condition for an SPA might be acceptable for a traditional static page.

SPAs can be built to work well offline. I've written them myself. There is nothing inherent in an SPA that make it poor at this, quite the opposite. SPAs have excellent tooling for offline use.

A SPA's network dependency or robustness totally depends on the product's design. Some types of applications lend well to offline first (anything where the user owns their content/data, todo, notes, documents, pictures, etc). Others are much more dependent on fresh data. Which pretty much means anything big enough it's unreasonable to replicate it to the device.

I'm a fan of "offline first" design and have been a proponent at various companies. To the point where I can build the feature in at very little additional cost if it is considered and decided in the design phase. Bolt-ons patterns are messy.

However, the reality is that very few customers see this as a significant advantage. Which means that it doesn't really translate to market success. If budget is the #1 priority I can't in good conscience advocate for offline first unless it's going to offer a significant win for the company somewhere.

I’m asking this from a genuine place of curiosity, because last time I checked a few years ago the answer was “terrible”. Has the “save a file locally and load it again later” story for SPAs improved any?
There is no universal local file system API, so "terrible" might be a reasonable description of this.

There is a Chrome-only local file system API.

Generally SPAs are limited to browser provided storage like IndexedDB.

I have implemented plenty of SPA (for years) that use the pattern of A) allow the user to download their current state as JSON/EDN and then B) allow the user to upload a new state from JSON/EDN file and continue from where they last downloaded their state.

This has been easy to implement for as long as I can remember, so not sure why'd you say it's terrible. What stopped you previous times?

Why do you write <img/> in authoritative tone? It's not 2000 anymore where we pretended XHTML or polyglot HTML is a thing. It's particularly odd to see that old cargo cult idiom (or, worse, with additional random spaces) used in a post lecturing users about HTML5-era SPA supremacy.
I don't know what you mean, self-closing tags are part of the HTML (5) standard: https://html.spec.whatwg.org/#self-closing-flag
? What's wrong with XHTML? <img /> is clearer than <img> for anyone familiar with XML, and XHTML documents are easier to parse (e.g. can be processed with XSLT stylesheets).
Nothing wrong with XHTML per se (did an internal site using XSLT in early/mid 2000s), but XML/XHTML has been on the way out for the better part of this millenium on the web at least. If you're developing web content and/or browser apps, you should know HTML IMO, and XML is the least of your concerns. Not looking forward to apps mixing XSLT and JavaScript ;)

Can't stand "<bla />" though with that pointless/clueless space. The only place where I've encountered these are older JSP, FreeMarker, or Thymeleaf/Spring MVC apps (ugh).

JSX (React's default markup language) expects all tags to be closed, and self closing tags are valid. If you spend a significant time writing React apps (with JSX) then it becomes pretty second nature to write self closing tags. It's not exactly XHTML (I can't think of any other of XHTML's idioms it uses).
"- And the thing I hate the most is the shifting of images, links when the page is still loading. But this may be a implementation issue."

Thats just bad design.

So at least in this aspect, bad design sense to have gotten a lot easier.
I suspected that too, but I do not know enough about these reactive frameworks to be 100% sure. But as a user of such apps, it is absolutely frustrating.
To stop jumping you need to explicitly size yet-to-load sections. Without JS this means giving images explicit sizing, with JS this means any section can be dynamically loaded and, therefore, jump. So good design takes into account dynamic loading and places size bounds accordingly.

Reactive libraries/frameworks don't explicitly make this worse or better, except their presence implies a high chance of dynamic loading and, therefore, more opportunity for bad design. In addition most component libraries fail to communicate /who/ needs to size a component and if it is ever dynamic. It really doesn't help that most 'official' examples fail to resolve these issues.

Something endemic to SPAs.
A truly intolerable thing about SPAs and JavaScript is that regular HTTP caching of images and fonts had to be limited because JS APIs can be and are used for fingerprinting, driving the whole web thing ad absurdum.

Switching off JS/fingerprinting doesn't really help either since it'll just disproportionally benefit Google's stronghold on web analytics even more.

Fingerprinting is not just JS. Fingerprinting is possible just using CSS rules alone.

The bigger issue, which seems to be what you are complaining about seems to be the gaping hole in privacy provided by 3rd party storage/resources. That is not a particular problem with SPAs, and can even be exploited without JavaScript.

I'm not sure where you're coming from regarding Google and web analytics. When 3rd party storage is gone (or partitioned) it sounds like everyone would be on the same page in terms of what data they can collect.

"shifting of images"

So much truth, not once I was trying to click on some image that had link underneath, and it suddenly moved to some other place and I ended clicking something different.

Exactly. The only time I felt the supposed "snappiness" is for documentation websites (so mainly text) that pre-fetch all links.
Yeah, especially when it's multiple sequential loads, so instead of a large HTML blob it takes forever. Usually with 270ms+ if it's US East (from Australia).
Exactly.

A flawless SPA backed by a flawless API that produces responses in tens of milliseconds is superior to the old ways.

But a trash SPA backed by an API that produces responses eventually if ever and requires me to open the browser's developer tools to find out what happened? You can keep it. Old-school frameset sites are better than that.