JavaScript growth and third parties
speedcurve.com
speedcurve.com
That sounds like saying "living is the leading cause of death".
I mean, I don't particularly like JS, but it seems like we decided long ago that plain documents and links won't cut it. Everything, apparently, needs to be a rich web application with huge images and a gazillion of ads.
Why is that Javascript's fault?
And it's not really "living is the leading cause of death"; most of that JavaScript is superfluous garbage - ad scripts, trackers, bloated frameworks. You don't need this for a page to serve a socially useful purpose. You just need someone in your company with enough clout, who's willing to say, "out of respect for our users and for engineering as a practice, we will not partake in the latest iteration of the insanity that is the modern web".
You don't need JS to "serve a socially useful purpose" most of the time, as well.
As I said, it seems we decided that everything needs to feel like an app.
95%(yes, I'm probably exaggerating) of the actual value of the today's websites could be plain documents with links to each other.
But try and suggest to anyone you're gonna have a company presence site(or anything for that matter) with no JS at all, and see where it gets you.
But my comment applies to apps as well - just because you need to write actual software, doesn't mean you should throw away sensible engineering, and produce a bloated, user-hostile, spying & battery-devouring monster. Yet this is what seems to be coming out of most web shops these days.
Now convince the client that they don't need to track every single possible click of the user - as they experience their "journey" through the site...
...convince the client that all those experience designers effusing about that "emotional layer" they added to that user journey didn't really result in 30% more engagement with the brand - as evidenced by exactly that same user tracking - convince em XD isn't just mouthing a load of horse shit. I mean - why do all the folks in XD dress in black all the time anyway. Would someone run a focus group on that please?
Funny thing is - I don't even know if they are all full of shit or not. Maybe all this is all necessary - maybe not. I don't even know and I build this stuff for a living. Client seems happy so meh...
But yeah - these large JS bundles aint the cause of these large JS bundles... ahem - I mean these slow sites...
In the post Flash days I was accepting of pushing JS use as far as possible but the fragmentation and complexity that seems to just have become implicitly accepted is just something I'm much happier looking at from a distance than wanting to ever get involved in again.
The fact that it's more difficult setting up a JS project than it is for, say, Scala which is itself a pain in the ass speaks volumes.
JS allows various levels of complexity. From inlining JS inside script tags in an html file or requiring a js file in the script tag to transpiling cutting-edge JS (or dialects/supersets of JS) with sourcemaps, minification, code-splitting, etc.
The latter end of the spectrum is reasonably complex; the former is ridiculously simple. I wonder if same can be said about Scala.
EDIT: As I wrote this comment the title here was edited to directly reflect the nature of my comment.
For 99% of the web a markup language with triggers and async loading could have been enough to implement menus, upvote posts, post login forms, and so on.
The mainstream libraries are fast and optimizable (Angular/React/Vue/etc). Other, not so much.
This is a very weak argument.
* many 3rd party resources are not cacheable or may have bad policies
* caches may be more often cold then you expect. most apps still cache large combined blobs, which will invalidate with each release.
* pure JS size has still it's impact on performance
* caching won't magically cut all network roundtrips which you need due to architectural reasonsAnd it is: "still its impact"
I am constantly surprised at the number of sites that should be totally static (e.g. a local restaurant's menu page) that display nothing at all when I visit with JavaScript disabled.
Can someone who actually makes websites explain why this has happened? Is this about varying screen resolutions and aspect ratios in the era of phones and tablets? Can't you just use CSS instead?
There is no pushback on it because as long as it works, people are happy and continue paying. And none of the clients test with js disabled.
Devs use it because the moment the client needs something somewhat dynamic, some js will need to be included anyway so you might as well use your usual stack.
Basically "why do people use js where HTML does the trick" is the same question as "why do people use python where c89 does the trick"
But the web evolved to be way more than being a dumb content delivery pipe, it's an application development platform bypassing the underlying OS.
So ask yourself, if you need well behaved image galleries, do you need JS? Yes. Do you want to avoid page reloading to navigate? You need JS. Do you want login/form validation? You need JS. Need an inline calculator? Update content from the server? Monitor the progress of a long lasting server job? Add any logic to a shopping cart?
And these are very simple use cases, web apps are needless to say changed the way we ship apps and they all rely on JS.
I'm very much in support of offloading as many tasks to CSS as possible, but JS is hard to avoid if you want to do anything beyond static content delivery.
Reminds me of emails and newsletters. Yes, they have many legitimate uses, but that doesn’t change the fact that a large part of them are just plain crap.
I feel like both sides of the debate are refusing to admit the other side might also have some valid points. Which admittably seems to be the theme in all of the internet.
But it can be done right. dev.to is a great example of an interactive web application with all the bells and whistles, yet it still performs better than most static sites.
I have no idea why they would do that. It looks like a misconfigurated preprocessor that thinks each fragment is a doc of its own. I vaguely recall something about them open-sourcing the frontend, so I might look into that...
https://github.com/thepracticaldev/dev.to/blob/master/app/vi...
> Browsers are very resistent to garbage markup
Miraculously so! Anything I would have attempted to design would have crapped its pants at the look of this markup, but browsers heroically manage to display it as if nothing weird is happening. I take my hat off to their resilience.
PRs welcome. :)
The cause is split pretty evenly between web developers who don't care about what they build enough to learn how to do it well, and companies who employ them letting them do that rather than pushing them to improve, and client's who don't understand what they've bought well enough to complain.
Everything is like that though. It's not limited to websites. Everything has problems, and it's always someone's fault. Developers tend to notice websites because we use them a lot and (some of us) think it's just laziness on the part of the website dev, but if you were an electrician you'd see problems with powertools, or a nurse you'd see issues with drug companies, and so on. The world is imperfect.
I used to be a full-stack developers, trying to balance my apps/pages just right between the server and browser side. But lately it's much easier to just focus on building APIs and let the front-end devs deal with all the interaction, forms and other user-facing stuff.
The interesting question, then, is what horribly wrong incentives are at work to make web developers accept slow sites (and other trends of bad design like "dark UI patterns" and data collection).
I am constantly surprised at the number of people that explicitly disable JavaScript to make their lives difficult in 2018.
My point is, JavaScript makes it easy to build nice websites at scale. Plenty of CMS platforms (like Wix.com) use JavaScript by default.
If 99.9999999% of people are fine with JavaScript, then why should a website cater to your need by providing a version specific to people who disable JavaScript?
> build nice websites at scale
> at scale
What? Might as well mention ML & blockchain while we're at it.
If site is not interactive, it doesn't _need_ JS.
If it does need JS, it more than likely needs _sprinkles_ of it.
Also, interactivity almost always gives better UX than static websites, if it's done properly by a professional website builder like Wix or Squarespace. So there's not much to hate it except maybe a few MB of extra code that you need to download.
I can't think of any good use cases for static websites in 2018, except maybe blogs in pure plaintext or old fashioned forums. Even HN has JavaScript for that little bit of interactivity (collapsing comments).
This sounds like double-speak. That's not what at scale refers to, even allowing a very loose definition.
How the HTML is generated is moot. Server side templates had re-usability at a "component" level. iFrames exist, redirects exist.
I'm not saying all JS is bad. I'm saying too may new people seem to think JS in and of itself is magic and there is no other way to generate/manipulate the DOM or talk to other computers.
I'm bailing out of this conversation now because you're heavily conflating HTML, browser functionality and www fundamentals with website builders(i don't know why you felt the need to qualify it with "professional")
> Even HN has JavaScript for that little bit of interactivity (collapsing comments).
Yeah no, "even HN" works perfectly with JS blocked. JS for HN is an enhancement, not a requirement. They understand how the web can work...
Many web developers are familiar with React, Angular, or other front-end frameworks; they are familiar with the deployment process, and the tools around it. If they need to build a website, they will use these tools, regardless of the requirements of the website.
I'll by the lazy developer / uninformed business owner explanation or the flash cancer analogy, but the tracking explanation seems a little far-fetched.
I get that Facebook, Amazon, Apple, and Google are all running ad networks trying to track me, and that globally this accounts for most of the bloat.
I'm trying to understand the dynamic that causes what should be simple static websites to use JS in such a way that they display no information at all when JS is off.
Developers seem to have forgotten progressive enhancement entirely and just piled more and more JS in to the first page load. Consequently users complain about JS, but JS itself is not the problem. There are patterns for building websites that are fast, in terms of both literal download and rendering speed and the perceived speed the user feels. We 'just' need better developers who actually care about the sites they build.
For most people, the intuitive thing is to look to successful companies: Google, Facebook, etc. The problem here is two fold: (1) operating at scale often has requirements that supercede making individual pages fast for individual visitors and (2) massive market dominance/semi-monopolies/vendor-lock-ins means these companies don't really need to compete on perf. See Facebook.com/gmail.com as lovely examples of some of the worst performance on the web.
You're right that one can make a webpage fast with correctly implemented js, but I disagree that people can make webpages fast en masse with correctly implemented js; dissuading the use of JS is much more likely to have a positive effect than expecting people to somehow spontaneously learn how to write good js.
Here is a cached version that works: http://webcache.googleusercontent.com/search?q=cache:https:/...
I should have realised, but it's the first time using that hosts list has ever stopped a website I've wanted to go to from loading, so I didn't think of it.
And yes, why wouldn't I? My 50Mb/s cable modem can download the fully featured Fastmail (500K) 13x faster than GMail. That's how bandwidth works.
It's kind of sad because it was the only webapp that made sense to me.
Javascript is an INSANELY GREAT way of implementing rich clients; the best I've seen in my almost half-century in the trade. (Progress. Duh.)
The modern clients (browsers) now have compilation right. V8 and its competitors are astonishing. But as always we have to get the distribution right: security, caches, progressive and async loading, agendas under control (meaning justified amounts of third party stuff).
We all know plenty of slow Python, C and C++ programs.
I think there are some general "laws" that dictate this
1. all things that are programmable will be programmed at some point
2. all programs, no matter what language, we become as slow as the users will tolerate
> Third party growth in terms of JavaScript size is more alarming. First party JavaScript doubled from 53 KB to 106 KB. Third party JavaScript octupled(!) from 32 KB to 258 KB.
one more reason to use NoScript
https://www.nngroup.com/articles/law-of-bandwidth/
Given that HTTP2 will be more and more available, the number of requests isn't a problem either. Global, fast CDN-s are thing for a while.
What would be worrying about client side JS is needless use of heavy frameworks, like Angular, CPU hogging tracking scripts or lame ads, dark UX marketing widgets.