by TeMPOraL · 11y ago · 0 comments
Just imagine you're going to the newsstand to buy a newspaper, and instead you get a package containing blank sheets of paper, a microfilm scanner and a roll of microfilm, with instructions telling you to go home, scan the film and print the content yourself. You'd be on fire. You'd write to the publisher, asking them what the fuck they're doing. Even ignoring the additional time and money you'll have to spend printing the newsppaper yourself, it surely must be cheaper to print it all with industrial machines than making an equal amounts of goddamn microfilm and scanners for it! Economies of scale and stuff.
And yet this is normal on the web. Prepping content for client-side JS generation takes similar amounts of time (if not more) to just rendering the page on server. And then they have to send a) the content, and b) JS to render it, which takes more space than a rendered page, and then every client has to render it on its own. They're wasting electricity on every goddamn step of the pipeline, from servers through the network to the client. It's like electricity is free so they can all show everyone a giant fuck you, because hey, if it's free then let's waste it all.
Ok, I got carried away. But my point still stands. Dear JS-first website maker - I'm not willing to view your ads until you start covering my electricity bills for all the coal that got wasted on your idiotic client-side-rendering contraptions.
And with modern tools, there's no reason that anything — even a highly interactive app — couldn't be prerendered on the server.
I'm with you 100 percent when it comes to "I can't read this text document because it needs 45 JS libraries to render," that's stupid. But it's probably stupid because it's over-engineered, not because it uses the browser.
I feel like this is going to become a bigger and bigger debate in the coming years, and I'm eager to be proven wrong, or at least understand the other side. But if I'm building the next great web-based spreadsheets application (I'm not), my immediate and overwhelming success is going to be WAY easier to manage if the majority of my code is being executed on the millions of computers calling in to use it, not on the three servers running in my auto scaling group. Why WOULDN'T I pick that option?
For one reason, because that one computer can usually do it (or at least most of it) once, and instead you're forcing millions of people to redo the same computation themselves. That's just... wrong.
> But if I'm building the next great web-based spreadsheets application (...) Why WOULDN'T I pick that option?
Well, in this case this is the right way, because you need to dynamically interact with data entered by the user (in this case, people usually make another error - they send data to server that there is no need for; but that's another topic. [0]). You're writing a web application. But a web site, like landing pages, blogs with articles, etc. have exactly zero reasonable needs for rendering everything client-side. It's just making the same compute millions of times because someone was too lazy to compute it once.
[0] - actually, it's not. One could notice that most of the problems with current web come from two things: sending the code that should stay on the server to the client, and sending data that should stay with the client to a server.
I was more disagreeing with the concluding assertion that "with modern tools, there's no reason that anything — even a highly interactive app — couldn't be prerendered on the server." There's no reason it couldn't be, sure, but it's way harder when the clients are just as capable -- and, once things start getting busy, probably even more capable.
There was a giant multinational hamburger chain where some bright MBA figured out that eliminating just three sesame seeds from a sesame-seed bun would be completely unnoticeable by anyone yet would save the company $126,000 per year. So they do it, and time passes, and another bushy-tailed MBA comes along, and does another study, and concludes that removing another five sesame seeds wouldn't hurt either, and would save even more money, and so on and so forth, every year or two, the new management trainee looking for ways to save money proposes removing a sesame seed or two, until eventually, they're shipping hamburger buns with exactly three sesame seeds artfully arranged in a triangle, and nobody buys their hamburgers any more.
I don't think it's analogous to a developer taking advantage of modern consumer hardware to do the work computers were designed to do, because it's not necessarily a worse product you're delivering. If your internet connection is spotty, it's likely a better experience in some ways. It just seems like people have these brilliant machines capable of executing all of this code (more or less) out of the box, but we're treating them as thin clients because... why? Because some people won't upgrade their OS/browser? Because the method of delivery is the same one that's used to inject banner ads and flashy video ad thingies? If that's the case, then it seems like the whole "server-side rendering" option is getting to sound pretty good for advertising, too. Then where are we?
Whether or not to take this approach is to be determined on a case-by-case basis. Some tools are too interactive and have too tight a feedback loop to make any sense without javascript. A spreadsheet is an example where I'd probably choose to break support for no-javascript, but it's less clear-cut than, say, a CAD application. An example where I'd opt to support clients without javascript is a todo-list application, or a twitter-like.
Of course, this has always already been the case! That's why we don't stream our webpages as images (or video, if you need to scroll), but instead offload the work of rendering a graphical representation of the symbolic HTML representation to the client-side browser.
It's a pretty solid idea (apart from the Browser Wars), and one of the ideas that made the WWW viable.
The ridiculous part, however, is where people somehow decide that we should wrap more and more and yet another layer of abstraction onto it.
It's not that web servers have grown less powerful and therefore need to offload more work onto their clients. The demands on web servers are higher today, but they've also grown more powerful, and we came up with some pretty clever scaling technologies to deal with those higher demands. But offloading code execution in the form of client-side JS is not really one of those, in practice.
Yes, the idea could technically be used to accomplish that and make less work on the server side, but really, take a look at this page, or any (bloated) page like the problem we're describing; That's not what's going on here, it's about the same amount of work on the server side, nothing's being offloaded, just more work on the client side.
At least the Flash-only-interface websites that plagued the web 10 years ago offered us UI elements that weren't possible in HTML back then (for better or worse), but today's JS bloat truly doesn't add anything that can't be done in a much leaner, less client resource-intensive way.
Even your spreadsheet example. Sure, run the calculations client-side, that only makes sense, no need to throw out JS with the bathwater. But what sort of calculations are we talking about, realistically? For a medium spreadsheet, a few hundreds of summations and multiplications. Nothing of the kind that should make a 5-year old computer even blink. But whatever these types of apps are actually doing they manage to crawl the jankscroll already even on an empty document, let alone when you try to use it.
And large bitmaps are rather bandwidth inefficient, and inaccessible to boot.
I don't mind markup. I mind tech that doesn't include fallbacks, and I mind people using Turing-complete languages for things that can easily be done using a less powerful language. (Turing-complete languages tend to get abused by people to the point that people want them to be executed quickly and with little memory use (which means that the language implementation gets complex, and hence buggy {simple laws of probability}), and almost any vulnerability can generally be exploited by a suitable script in a TC language, and TC-languages can be used to do unexpected things.)
HTML is decent. HTML+CSS is worse than HTML (for the same reason that COMEFROM is worse than GOTO). Markup is better than HTML in many ways, or rather most formal specifications of Markup-like languages are better than HTML. (Unfortunately, most variants of Markup aren't specified beyond "do what I do")
I've been tempted for a while to write a Markup browser. (Mop? Markup-Over-tcP? )
That's the entire reason why js and html and friends have become so popular. You essentially have full applications that have been developed by people who recognize that the bottleneck wrt to a networked application's responsiveness is not cpu cycles and memory in 2015 but internet latency. It's sufficient here to send a small text file and have the client fill in the gaps and have the client ajax for updates than have the server do the heavy work. I think you argued elsewhere, this is a waste of processor time redundantly rendering content, and thus, a waste of energy needlessly (as in real energy, from electrical into waste heat). As a tree hugger, I have to admit I find that argument somewhat compelling. I think a balance needs to be struck between user experience and use of resources. It might be your balance line lies further towards the "saving of resources" than mine's does.
That doesn't mean that websites shouldn't use javascript — I'd not want to use a todo list application that forces me to reload the page on every click — but it's still useful to support that functionality, because some day I might need to access my todos from an environment where I can't use javascript for whatever reason.
People claim that it's too much work to support something so niche, but if you architect your application well, using progressive enhancement, you get support for no-javascript environments, plus a ton of other stuff like server-side prerendering for latency reduction, accessibility, SEO, text-based browser functionality — all virtually for free.
Not that this should be applied everywhere dogmatically, it's not worth supporting no-javascript environments or scrapers in your browser-based photo editor.
It would be even better if servers would return raw data in xml format, with a linked xslt transform to convert it to a structured document, and css to manage the presentation with javascript to control the interactivity, but that idea died long ago, but some modern applications are finally replicating most of the good parts of that system.
I was more wondering what you meant by prerendering things, because even when one opens an html page in your browser which is on your local drive, the client is doing rendering (typesetting, and such). That is an extreme...so, it sounds like you were asking for a return to the pre-ajax internet, which you say here that it doesn't fit everything.
So I think we don't really disagree here, I could have misunderstood you?
<rantyrant> So from a personal standpoint, if I'm on your sales page, I want to know what you're offering, and why I should be intrested in what you are offering. I'd be fine with that being a plain html site with nothing but a few paragraphs and some bullet point lists. Maybe a table or two as well, and a link to somewhere I can give you money.
Now the last thing I need is for that part of the page to zoom in, wiggle around or do any other bogheaded things a designer with just enough jQuery to be dangerous could think of whilst they're being "creative" with it.
Now from a marketing perspective, this is incredibly stupid. A sales page is a machine for turning prospects into customers. There's a single design purpose if there is one. If someone come over and tried to paint flowers on the tip of my soldering iron, I would cut them. If someone decided to replace my PSU with a music box because the music box looks a lot better, I would not be pleased.
So why did it ever become a thing to do that to one of the most essential parts of your business? The part you point your advertising money at. The part that can very well be the difference between you going the way of the ipod or the way of the zune. Go nuts on your About page if you really have to keep your designer busy, have your faces zoom into it and spin and put the text into maquee tags and what have. But please, for the love of god, don't, don't ever do that to your sales page, because you're wasting my time and your money on that.
I blame marketing professionals with an IQ of 50 and designers with delusions of grandeur, CSS3 on the holster, jQuery in their hands, trigger happy on anything customer facing, spreading more $ signs through the site than the rap business.
</rant>
The separation of back-end and front-end, via the exposure of APIs on the backend, has led us to a world where the front-end requires a bit more thought, on how to represent and transform the data to render the content and theme correctly.
Why? Modularisation & de-coupling = greater maintainability + rule of single-responsibility is better applied. This will become more and more the case with the widespread adoption of microservices.
In this specific case, we could argue against the few lines of JS that provide a nice effect upon entering the page, but you can't argue about de-coupling and breaking down the mammoth codebase.
(Once again, I'm writing about web pages, not web applications (and no, a blog is not a web application).)
Modularization, decoupling, "rule of single-responsibility", etc. are meant to produce simpler, more maintainable code and better, slicker software. But instead, they're taken out of context and abused. Modern web codebases are getting more and more complicated, not less. What people are doing today is not good engineering. It's the architecture astronautics' equivalent of Kerbal Space Program.
There seems to be a force that always pushes technology to crud up with bogus features until the brink of usability.
Probably caused by the fact that developers tend to develop on above-average machines, and therefore will always target slightly above-average requirements, dragging everything upwards.