JavaScript whatisjasongoldstein.com

Help! None of my projects want to be SPAs  ↦

There’s a lot of wisdom in this post alongside some opinions that I find myself nodding along with:

My strategy for dealing with the absurd pace of change in web development has been as follows: ignore 99% of it and see if it goes away.

While we cover (and talk about) new technologies on a daily basis here at Changelog, that doesn’t mean we adopt everything that hits our radar.

Given the hype cycle, it works pretty well. Mongo isn’t exciting anymore, Angular 1 is dead, CoffeeScript is obsolete, I haven’t heard a word about Meteor since it launched…

These are all specific technologies. But what about the Single Page App pattern in general?

Back in the early days of SPAs, some people argued that it would be faster to only pass the data you need as JSON than to render whole pages. Nearly a decade later, this is almost never true.

He goes on to explain how he’s building a side project SPA-style and all the repercussions of that decision. Really insightful stuff here, please do click through and read for yourself.


Discussion

Sign in or Join to comment or subscribe

2019-02-17T10:10:21Z ago

Great find!

Surely I must be missing something. Surely the billions of programming hours that have gone into all these new things aren’t in vain.

Sadly, that’s the actual state of things in web development. Both frontend and backend trends are largely driven by hype and marketing campaigns.

I must be getting old but since last year I’ve found myself looking more into the history of computing and learning about the problems software engineers were tackling decades ago. A great way to get a glimpse into that past is to read Turing Award lectures - https://amturing.acm.org/lectures.cfm

Reading those lectures makes your mind operate on a whole different level. They make you realize that there are a lot of hard problems in software still, and arguing, for example, whether this in JavaScript should be bound or not in a callback won’t help solve those problems in the slightest.

2019-02-17T18:28:25Z ago

This article sums up my feelings on web frontend and SPAs also. It feels like there’s a huge amount of investment gone into SPAs and Javascript-first apps, so the tooling there is solid and there’s a great developer experience. But that can’t be the only way to build stuff with HTTP and HTML/CSS/JS. Other models that put more weight on the backend have been neglected (is templating still the state of the art?!).

But there’s a feeling you have to get with the program and do the SPA thing.

The Pinboard clone loads 400 bytes of HTML, followed by 36kb of javascript, and 35kb of data from the API. The JS bundle alone is more than 7x the weight of the rendered page, can’t be called until the first HTTP request completes, and still has to make an API call.5

I think this could be improved though, even under the current model. I believe something like GraphQL can transform datasets server-side to send only exactly what the page needs. And the JS bundle? 36 kb is very respectable, if you were using React it would be 10x that. But only because we’re obsessed with bundling! Back in the day we had these things called ‘shared libraries’ (like glibc) which multiple apps could share. Then your compiled program would contain only the bits that make it special. On the web, every website is delivering their own copy of ReactDom! Put that on a CDN! Give it cache headers! The browser can even cache the parsed code! It would be so much faster! I don’t know why this isn’t the norm.

0:00 / 0:00