The Unluckiest Paragraphs – Why Parts of Medium Sometimes Disappear
medium.com
medium.com
On most webpages, if you click a link, the browser automatically handles
loading a new page. On Medium, we speed this up a bit with JavaScript. We send
a request to “https://medium.com/@ritasustelo/advertising-is-not-for-geniuses-
5d1ffbc505ac?format=json,” download the article text, and render it in your
browser.
What the hell is wrong with just serving flat html files, rather than making the browser parse a JSON blob? All posts are represented as a list of paragraphs. We give
each paragraph a unique name. The code to generate names is
a one-liner
Well, why do you do that? Does doing this make any sense at all?- Faster loading time. For most users, the bottleneck is the network and a JSON payload is typically a lot smaller than a fully rendered HTML page. This reduces the overhead (unless your users have crap CPUs and fast network connections - not the norm).
- Better separation of concerns. Your server becomes a dumb API and doesn't need to concern itself with presentation. Your UI can live in an entirely different repository and it doesn't matter which framework or language your backend is written in. Front-end developers only need to know about browser technologies (HTML/CSS/JavaScript) to build the UI. This reduces complexity instead of "needlessly" increasing it.
- Thanks to server side Javascript, it's relatively easy to have a fallback mechanism in place to do traditional server side rendering for web crawlers or browsers with Javascript disabled.
This is how things are going to be, now. Ad blockers will make rules, publishers will flout them, some normal URLs will be casualties.
...or do you really think them peculiar for loading SVG icons?
Well, they did. In the very thing you quoted:
> On Medium, we speed this up a bit with JavaScript. [...] format=json," download the article text
eg, they send what actually changed, probably highly compressed and cached, and not an entire new webpage. That's not super uncommon, and it's hardly weird or roundabout. We can discuss whether they've correctly identified the bottleneck (although, spoiler, they have), or whether it actually improves things for their users in real world conditions (probably), or if the technical overhead is worth it for something like Medium (debatable, but apparently they have the funding...), but it's not "bizarrely strange". It's a well known technique, and while maybe it's more common (and more sensible) to use it on a webmail app than a weblog, it's not black magic.
Doesn't make a lot of sense given that they have exhaustive lists of actual ad domains to go from, and you've got to think most advertisers are going to figure this out pretty quick and not call their ads "ad".
I'm not sure if this is the case. I concede that a team that owns both the blog and the tool has an advantage but many people use standard tools like WordPress or Jekyll. The teams behind those tools can solve those problems too. I believe there is some friction but hopefully it's not so bad.