Hacker News new | ask | show | jobs
by reaperducer 3077 days ago
> there has always been good reasons to avoid running code in the browser unless there is a good reason

From what I hear from the junior devs, what they're teaching in school these days is that as much of the site as possible should be offloaded to the client device in order to free up server resources.

The mindset is that everyone in the world has unlimited massive bandwidth at all times, along with the latest gear; and if you don't, you're an "edge case" and should be ridiculed.

3 comments

Honestly, I believe the exact opposite is true. Why should you make your users and their batteries work harder to get what they want? Somebody comes to our website with a task in their head, and fundamentally our goal is to help them complete that task as quickly as possible. "Offload as much work to the client as possible" does not help our users complete their tasks faster. It makes life easier for dev teams by having servers that focus on APIs, reusing js code to create native apps, etc. But in the vast majority of cases it does not help the user, even if done perfectly. No, it's not faster because "no whole page reload" and yes, it does break expected browser behaviour unless you are extremely, unreasonably careful. The only exception is if you're building Google Maps or something extremely "appy" and need to have an alternative to the app store, for some reason.
I'm saddened by the possibility that this is what they teach juniors these days. This approach is, IMO, borderline unethical.

Offloading to the client device in order to free up server resources quite often means taking the load your server could handle once and multiplying it millionfold, once per each of your million visitors. In other words, your product just started to burn a million time more electricity than necessary. We should call it by its true name - externalizing costs - with all the negative baggage associated with that phrase.

as much of the site as possible should be offloaded to the client device in order to ~~free up server resources~~ decrease latency.

Network is much slower than CPU. It's ironic you deride the assumption that everyone has unlimited bandwidth and then suggest that the solution is to send every user interaction through the network.