r/javascript • • Feb 24 '20

The economics of of JavaScript - Your single page JavaScript app probably doesn't make you as much money as its old-school alternative. Sorry

https://mcarter.me/posts/the-economics-of-javascript
0 Upvotes

11 comments sorted by

15

u/ghostfacedcoder Feb 24 '20

Oh god, another "won't someone think of the children?" article about JS's costs. Let's just cut to the chase:

What if the JavaScript is slow to arrive? What if the JavaScript doesn't load at all? What if the JavaScript isn't interpreted as intended by my browser? What if a cached version of the JavaScript is loaded that isn't compatible with a new API? What if the user has JavaScript disabled? What if the user's connection is really slow, and data requests initiated by the JavaScript fail to respond? What if the user is using a very underpowered device that can't handle the JavaScript? What if the user has a browser extension installed that interferes with the JavaScript?

What if all those are a bunch of cases I don't care about because they matter to less than 0.1% of my visitors ... and what if the author's claim that they do matter (and actually make the site less money as a result) is backed by absolutely nothing at all, whatsoever.

The article provides no justification, anywhere, for the central claim of the title. In other words, it's not much more than some hysterical whining about "won't someone please think of waht happens when the user disables Javascript on their own computer and then doesn't understand why no site works!?!?"

4

u/duxdude418 Feb 24 '20 edited Feb 24 '20

Agreed. I never understood supporting the case of JavaScript being disabled. That’s like expecting WPF apps to work without having the .Net runtime installed. It’s part of the requirements for using the software.

Can you give a paired-down, HTML-only experience? Sure, but at what cost? And at what loss of functionality?

-5

u/monican_agent Creator of CypherPoker.JS Feb 24 '20 edited Feb 24 '20

I never understood supporting the case of JavaScript being disabled.

That's not suggested anywhere in the article. Also, you're suggesting that the casual user should have the technical insight to understand that the website is not functioning as expected because maybe they have JavaScript disabled. In other words, if my website seems broken, that's on them.

It begs the question: who are you coding for?

Can you give a paired-down, HTML-only experience? Sure, but at what cost? And at what loss of functionality?

That's what the article is asking too, only from another angle: Can you give a bloated and slow Javascript-laden experience? Sure, but at what cost? And is the additional functionality worth it?

Maybe it is, maybe it's not, but refusing to ask these questions before embarking on a project practically guarantees that you're producing less than the absolute best that you're able to.

Ultimately that's what the article is saying ... weigh all the obvious options before jumping in. At least that was my understanding.

5

u/ghostfacedcoder Feb 24 '20 edited Feb 24 '20

That's not suggested anywhere in the article

It's not only in the article, it was in my quoting of the article ... literally just the parent of the post you were replying to:

What if the user has JavaScript disabled?

And as for:

the casual user should have the technical insight to understand that the website is not functioning as expected because maybe they have JavaScript disabled

No, casual users should not require technical insight, but even so this is the same tired straw man argument people always make in these discussions.

In practice, if you disable JS in your browser, it's not like just one site is going to fail. Every site you visit will be broken, because virtually every site on the web uses JS.

Even if you know NOTHING about web tech whatsoever, and even if your cat walks across the keyboard in just such a way so as to disable JS without you knowing ... you're very quickly going to see the problem is on your end, not the sites'.

1

u/monican_agent Creator of CypherPoker.JS Feb 24 '20

Every site you visit will be broken...

Not necessarily: https://www.webdesignerdepot.com/2018/01/8-sites-that-work-just-fine-without-js-thank-you/

But that's hardly the whole web so let's say, out of fairness, that most sites require JavaScript. Unfortunately, you're still focused on the single case where a user has disabled JavaScript (or had it disabled for them).

There are tonnes of sites that have JavaScript errors that can sometimes completely prevent content from being loaded (since it's often loaded by script). Pop up your JS console and look at the errors and warnings here on Reddit, for example.

So when you say:

you're very quickly going to see the problem is on your end, not the sites'

...you're being extremely short-sighted. If poorly-written JavaScript fails in my browser, or my browser is a couple of versions behind (often the case in corporate environments) and doesn't support the latest ES version that I'm using, or the JS is not handling remote API errors properly and just failing silently behind the scenes, how is that a problem on my end?

Should I go and make code fixes by hand? Should I demand that corporate IT upgrade everyone's browsers so that I can get on some site I want to access? Should I launch the debugger and monitor web traffic to see why API calls are failing, and even so, what am I supposed to do about it?

It worked for you when you were developing it so obviously the problem is with what I'm doing, right?

This is not a straw-man argument, it's the result of decades' worth of writing web apps and having them thoroughly tested. It's the result of coding intended for use by others, not writing to my own myopic standards and expecting people to conform to them. That kind of thinking is one of the major problems with software development.

Let me ask you a question: when you code (I'm assuming you do), do you minify your scripts before sticking them on a production web page?

If you do, you're proving my point. Why are you bothering? A 100K raw script only takes an extra second on a measly 1M DSL connection. Who cares about the user experience of people on slower connections ... if they want to access your site, they should fork over more money to their ISP for faster speeds and if they live in a region where that's all they can get then they should move! Sounds reasonable.

If you don't, you're basically implying that everyone who does minify their code (which includes pretty much all the major framework and library developers), are just wasting their time in order to capitulate to the needs of a small minority. And why bother testing code when it works perfectly well on the developer's machine? What a waste of time! The user needs to make sure that they have JavaScript enabled and after that ... no other problems can possibly exist.

Yup, I'm convinced.

/s

3

u/wrtbwtrfasdf Feb 25 '20

I just code everything for iOS since those people account for 95% of my revenue. Anything I can do to help IE11 die a quick death, the better.

1

u/monican_agent Creator of CypherPoker.JS Feb 25 '20 edited Feb 25 '20

Don't get me wrong, IE11 has been the bane of my existence for many years. The only reason I would ever even try to write for it is because a client or boss absolutely demanded it (usually to support large corporate clients).

Mister Horse was most clear and succinct when he said: "No sir, I don't like it!"

Luckily that hasn't been an issue for a while now.

But I think you've kind of helped to make the point that the article was making. Because you limit yourself to Apple mobile, you're potentially missing out on an additional 5% of potential clients. Granted, it might not be significant for you, but that doesn't change the fact.

Similarly, by requiring JavaScript, you may have created a site that limits certain users; maybe it's because they have JavaScript disabled, or maybe they're using an older browser, or maybe their connection is slow and they don't have the patience, or maybe there are syntax errors introduced by third party libraries (updated without your knowledge), or maybe the performance is horrible on older/mobile hardware, etc.

If the site is the source of your revenue, you would necessarily be making less than if you made it more compatible / lighter.

It might only be 1% of your users affected so ... meh, who cares ... but the fact remains that you could have that additional 1% if maybe you didn't use JS. Add to that the fact that the site would probably be easier and faster to code (just HTML/CSS), and easier to maintain, and now the revenue jumps a little higher since money that would've been spent on JS development can be used on something else. After all, profit isn't just revenue, it must also factor in costs.

In the end it might not be worth it. Or maybe you've thought about it and there really is no better way to do it than through JavaScript. Okay, fair enough. But how would one know unless it's part of the consideration in the first place?

The counterarguments appear to be:

Don't bother thinking, just slap any and all JS in there and if it causes problems that's the users' fault...let them deal with it!

If it takes longer to develop a site and therefore costs more money, let the suckers (client / company / me) pay for it. Who cares?

Hell, why bother compressing images or optimizing code performance? My 10 MB landing page loads fine from my localhost and runs fine on my dev machine so it's everyone else's fault if they're "having problems" with it.

And why should I even think about future maintenance and updates? My project will be perfect and complete for ever and ever so why spend a second of my time thinking about things that'll never happen?

...

Am I the only one that sees a problem with that attitude? Seems bizarre that I would even have to argue against these things. Even more bizarre that my arguments are being downvoted and the stuff above is being upvoted.

Looks like critical thought, informed planning, and consideration for the user are terrible taboos. I must have slipped into upside-down crazy world at some point during the last few days.

Anyway, that's what I took away from the article, and I think it's something that every developer should do before jumping into a new project and blindly strapping in every JS framework they can think of.

1

u/wrtbwtrfasdf Feb 25 '20

The 5% I miss out on doesn't matter. I mean they do, but to account for them would be suboptimal and a pyrrhic victory.

In the casino business, they have a term for it 'whales'. You give them everything they want because they are your primary revenue stream. Google pays Apple ~$2 billion a year to remain the default search engine on iOS. It's because iOS users are like little money pinatas. Hell they'll even buy a $999 monitor stand.

0

u/monican_agent Creator of CypherPoker.JS Feb 25 '20 edited Feb 25 '20

No, I get it. Why put in more effort for fewer returns?

The point was, what if you put in less effort (for example, no JavaScript), and you also managed to capture that additional 5%?

You'd get the whales and the minnows, and you've spent less effort / time / cost.

Maybe this is not viable because your project requires JavaScript, and tailoring it to support that additional 5% is just not worth it. But what if it was? Does it make sense to spend more effort by forcing JavaScript in there only to exclude 5% of a potential user based while spending more time and effort?

The article is saying: consider these options before starting out.

Everyone else here is saying: screw that ... spend more time and effort in order to receive fewer returns because ... JavaScript!

You telling me that you don't support anything outside of iOS because they make up 95% of your customers also entirely missed the point -- why wouldn't you consider the possibility of getting 100% coverage for LESS time and effort?

It's mind boggling that this is going right over everyone's head for some reason.

Maybe re-doing existing work would be MORE effort. Maybe JavaScript IS necessary to do what you need to do, and supporting browsers outside of iOS would require extra effort. In these cases, OF COURSE it would make sense to stick with the 95%. but you've not said anything that suggests that you've given it any consideration, which is all that I'm saying.

And now I've far exceeded the cost/benefit ratio of this conversation. If people stomp their feet like five-year-olds to avoid even a moment of critical thought and demand that spending more effort / time for fewer returns is the only possible solution, they're obviously too far gone for me to convince otherwise.

Have a good one!

0

u/monican_agent Creator of CypherPoker.JS Feb 24 '20 edited Feb 24 '20

I didn't get this sense from the article. Maybe the title is a little misleading -- the site makes less money because it costs more to develop and maintain (i.e. profit minus cost), or: why spend your time / money implementing JavaScript when a simple HTML/CSS site will do?

Even if you're using existing libraries, that's an extra step (i.e. cost), that may not be necessary, not to mention possibly increasing the "price" of maintainability later on. These are development and maintenance costs, not necessarily costs to the user.

Developers should be certainly be asking themselves what the upside of including JavaScript is? What's the downside? Is the trade-off worth it?

Maybe JavaScript is necessary (as the article states), but often it's not. Developers should definitely be concerned about such things, not simply slapping code in willy-nilly (actually extending additional effort) just because "who cares about a minority of users?", or it's the cool new thing, or "that's how things are done".

A lack of concern for both the development/maintenance costs as well as the impact on users produces bloat, increases complexity (i.e. errors), reduces usability (non-standard interfaces, problems printing) ... and for what?

I've been a professional developer for 20 years (coding for longer), and when I try to load a site and something goes wrong, the first thing I do is disable JavaScript. This almost always allows me to see the content (and much more quickly), which is really what I wanted anyways. In other words, JavaScript was the main culprit preventing me from accessing what I wanted, and it provided me with zero benefit. The developer could've saved their client/company some money and time, while providing a much better experience to the user.

-5

u/Kronendal Feb 24 '20

Completely agree. As a person who's recently had to scrape some pretty bad js sites this is hitting very close to home.

Just give me consistency, I really don't mind about the rest.