News for hackers. Stuff that matters.
Re:In spite of an increase in Internet speed, webpage speeds... by cactus2093 on Tuesday August 04, 2020 @06:53PM (#24055367)
This type of anti-big-js comment does great on Hacker News and sounds good, but my personal experience has always been very different. Every large server-rendered app I've worked on ends up devolving to a mess of quickly thrown together js/jquery animations, validations, XHR requests, etc. that is a big pain to work on. You're often doing things like adding the same functionality twice, once on the server view and once for the manipulated resulting page in js. Every bit of interactivity/ reactivity that product wants to add to the page feels like a weird hack that doesn't quite belong there, polluting the simple, declarative model that your views started off as. None of your JS is unit tested, sometimes not even linted properly because it's mixed into the templates all over the place. The performance still isn't a given either, your rendering times can still get out of hand and you end up having to do things like caching partially rendered page fragments.

The more modern style of heavier client-side js apps lets you use software development best practices to structure, reuse, and test your code in ways that are more readable and intuitive. You're still of course free to mangle it into confusing spaghetti code, but the basic structure often just feels like a better fit for the domain if you have even a moderate amount of interactivity on the page(s). As the team and codebase grows the structure starts to pay off even more in the extensibility it gives you.

There can be more overhead as a trade-off, but for the majority of users these pages can still be quite usable even if they are burning more cycles on the users' CPUs, so the trade-offs are often deemed to be worth it. But over time the overhead is also lessening as e.g. the default behavior of bundlers is getting smarter and tooling is improving generally. You can even write your app as js components and then server-side render it if needed, so there's no need to go back to rails or php even if a blazing fast time to render the page is a priority.

Re:In spite of an increase in Internet speed, webpage speeds... by andrepd on Tuesday August 04, 2020 @09:06PM (#24056230)
>The more modern style of heavier client-side js apps lets you use software development best practices to structure, reuse, and test your code in ways that are more readable and intuitive.

Sadly, this is probably where the core of the problem lies. "It makes code more readable and intuitive" is NOT the end goal. Making your job easier or more convenient is not the end goal. Making a good product for the user is! Software has got to be the only engineering discipline where people think it's acceptable to compromise the user experience for the sake of their convenience! I don't want to think to closely about data structures, I'll just use a list for everything: the users will eat the slowdown, because it makes my program easier to maintain. I want to program a server in a scripting language, it's easier for me: the users will eat the slowdown and the company budget will eat the inefficiency. And so on.

Re:In spite of an increase in Internet speed, webpage speeds... by heisenbit on Wednesday August 05, 2020 @04:39AM (#24058549)
> Making your job easier or more convenient is not the end goal. Making a good product for the user is!

This is a very limited perspective. Let me give you an enterprise software perspective:

1) Software maintenance costs. Better maintainable software allows more services to be delivered with a smaller budget.

2) Software is never finished. Ability to respond to new or changing user requirements matters to users and is perceived as part of the quality of service.

3) Software is going to be maintained by someone else. If they can not maintain it then users have to go through another iteration done by another team (best practice: fewer features, but at least the implemented features have more bugs).

Re:In spite of an increase in Internet speed, webpage speeds... by austincheney on Wednesday August 05, 2020 @05:00AM (#24058667)
> 1) Software maintenance costs. Better maintainable software allows more services to be delivered with a smaller budget.

Better is not the same as easier. This is such an equivocation fallacy since both of those terms are highly subjective. Maintenance costs are measured in numbers and not some imaginary developer ideal of job security.

Re:In spite of an increase in Internet speed, webpage speeds... by aryonoco on Tuesday August 04, 2020 @10:10PM (#24056607)
Code that is easier to read is easier to maintain and easier to debug. Code that is easier to read and more intuitive will, more often than not, result in a better product and better experience for the users.
Re:In spite of an increase in Internet speed, webpage speeds... by bananaface on Wednesday August 05, 2020 @04:10AM (#24058376)
I disagree with the premise. "Readability" is an excuse people use for writing slow code. It's not an inevitable tradeoff.

Like, most of these people are not saying, "we could do this thing which would speed up the app by an order of magnitude, but we won't because it will decrease readability." They have no idea why their code is slow. Many don't even realise it is slow.

My favourite talking point is to remind people that GTA V can simulate & render an entire game world 60 times per second, 144 times on the right monitor. Is that a more complex render than Twitter?

Computers are really fast, it doesn't take garbage code to exploit that.

Re:In spite of an increase in Internet speed, webpage speeds... by adamsea on Wednesday August 05, 2020 @09:44AM (#24060655)
IMHO it’s in part because of what I assume are different business models between a game like GTA and many / most businesses where a website / web app is core to their product.

Different business models result in different environments in which to conduct software engineering; different constraints and requirements.

IMHO constant and unpredictable change (which I assume happens less for games like GTA) is one of the big differences, as is the relationship between application performance and profit.

But I like what you’re saying and would love to see that world.

Re:In spite of an increase in Internet speed, webpage speeds... by Semiapies on Wednesday August 05, 2020 @11:07PM (#24067785)
How long does it take to start up GTA V on your computer?
Re:In spite of an increase in Internet speed, webpage speeds... by bananaface on Thursday August 06, 2020 @04:28AM (#24069115)
More than a website that preloads its structure into the cache and then transfers blocks of 280 characters, a name & a small avatar, rather than gigabytes worth of compressed textures.

Is the difference because GTA has more "readable" code?

I have other games that do load up quicker than Twitter, which I do think is damning, but it's not really the point I'm trying to get across here.

Re:In spite of an increase in Internet speed, webpage speeds... by Semiapies on Thursday August 06, 2020 @06:22AM (#24069648)
Well, the "less readable code"—ie, the goddamn mess that a lot of game code is, slapped together barely under deadline by staffs working 80 or more hours a week—is part of why AAA games like GTA have so many massive bugs requiring patches immediately after release.

But then, you brought up GTA and games, which aren't even apples and oranges with a website. Websites—even the Twitter website—don't require GPUs or dedicated memory, they don't have the advantage of pulling everything from the local hard drive, and yet they actually work as designed, not merely in a low-resolution, low-effects mode on computers more than a couple years old.

And while I wouldn't point out the Twitter home page as remotely fast for a web site, have you actually even looked at it recently? It shows a lot more than just a few tweets and avatars. It's got images, embedded video, etc.

Re:In spite of an increase in Internet speed, webpage speeds... by bananaface on Thursday August 06, 2020 @07:07AM (#24069879)
This is a dumb argument. My point is that readable doesn't imply slow, and "readability" is not actually the reason slow things are slow, most of the time. I don't think you even disagree with me.

There's definitely another discussion to be had about why web tech is so disastrously slow given what computers are capable of, but it's not worth having here. We're never going to settle that one, and regardless if you are a web guy, you're stuck with JS.

>It's got images, embedded video, etc.

Bad excuse IMO. Lazy load them.

Re:In spite of an increase in Internet speed, webpage speeds... by gowld on Wednesday August 05, 2020 @01:02PM (#24063023)
I don't have 8GB RAM to dedicate just to Twitter.
Re:In spite of an increase in Internet speed, webpage speeds... by hkt on Wednesday August 05, 2020 @09:46AM (#24060673)
GTA V has graphics card requirements that, I suspect, may be quite large compared to Twitter. Although it is worth noting that GPU acceleration in the browser is increasingly a thing: https://support.mozilla.org/en-US/kb/upgrade-graphics-driver...

That being said, I don't think it addresses the problems with client side applications, although it may allow more complex ones.

Re:In spite of an increase in Internet speed, webpage speeds... by peacefulhat on Wednesday August 05, 2020 @12:27PM (#24062618)
Websites like Twitter are not render bottlenecked. Even a software rendered game from decades ago like doom is doing more on the screen than Twitter.
Re:In spite of an increase in Internet speed, webpage speeds... by _jal on Tuesday August 04, 2020 @10:53PM (#24056834)
A: "Your restaurant's food tastes terrible."

B: "Nutritious, healthy food will ensure the longevity of my customers, thereby maximizing lifetime customer revenue."

Re:In spite of an increase in Internet speed, webpage speeds... by lyjackal on Wednesday August 05, 2020 @10:12AM (#24060939)
I think a better analogy might be telling a restaurant to cut down their oversized menu so that they can actually make at least one good meal
Re:In spite of an increase in Internet speed, webpage speeds... by d3nj4l on Tuesday August 04, 2020 @11:40PM (#24057059)
That's an awful analogy
Re:In spite of an increase in Internet speed, webpage speeds... by bb88 on Wednesday August 05, 2020 @03:16AM (#24058088)
I just logged into nest for the first time on a new laptop. It took 15 seconds to load and get to the screen to change the temperature on the thermostat.

Then I refreshed the page and it still took 10 seconds to reload.

I'm sure their code is also relatively bug free.

Re:In spite of an increase in Internet speed, webpage speeds... by pc86 on Wednesday August 05, 2020 @07:49AM (#24059757)
It's actually pretty good analogy, when you're searching for an analogy of something being technically accurate while missing literally the entire point.

Making your code "more intuitive" does not result in a better product. Making a better product does. The argument is that software development is one of the few jobs where the employees' experience seems to be equal or more important than the client experience. Sacrificing a restaurant goer's experience (taste) because it makes the restauranteur's experience (customer LTV) better is a decent analogy.

Re:In spite of an increase in Internet speed, webpage speeds... by newsbinator on Wednesday August 05, 2020 @10:22AM (#24061076)
A: "I enjoy your restaurant's food but my chef friend said your kitchen is inefficient".

B: "As long as you enjoy it, and we can keep making it for you at the same quality you enjoy, we don't care how inefficient our kitchen is".

Re:In spite of an increase in Internet speed, webpage speeds... by nybble41 on Wednesday August 05, 2020 @06:22PM (#24066250)
A: "Okay, but the new place next door serves identical food with a more efficient kitchen, at lower prices you can't match without making significant changes. If you don't improve efficiency somehow you'll start to lose customers."
Re:In spite of an increase in Internet speed, webpage speeds... by AnIdiotOnTheNet on Wednesday August 05, 2020 @09:50AM (#24060700)
Then please explain why the increasing trend in developer convenience is correlated with the decline in user experience.
Re:In spite of an increase in Internet speed, webpage speeds... by aeontech on Thursday August 06, 2020 @05:17AM (#24069340)
It’s a false correlation.

Because the universal rule is that 90% of everything is terrible, including software. Corollary rule is that work expands to fill all available time, and software expands to fill all available resources.

If you go back to before the ascent of age of front-end frameworks, you would find that there were still tons of sites that were slow and poorly performing, despite running entirely in server-side technologies.

Something that made Google incredibly appealing when it first came out was it’s instantly-loading front page with a single search box and a single button. This was in drastic, shocking contrast in the age where every other search engine portal had a ton of content on it, including news, stock tickers, and the kitchen sink.

In the end, unless the developers of the sites make performance a priority, it makes absolutely no difference what the tech stack is. The problem is that companies don’t prioritize it.

Re:In spite of an increase in Internet speed, webpage speeds... by r0b05 on Wednesday August 05, 2020 @02:02AM (#24057710)
I wholeheartedly agree.

Maintainable code can quickly and easily be extended into new features for the customer.

Unmaintainable code usually results in a ton of support tickets and late nights hunting and fixing bugs that originated from deploying into production that day. This leads to heartache and frustration for the customer.

The customer comes first, yes. Good maintainable code, is a way to achieve this goal.

Re:In spite of an increase in Internet speed, webpage speeds... by syats on Wednesday August 05, 2020 @05:43AM (#24058896)
The article this thread is about clearly shows that your second statement is not true.
Re:In spite of an increase in Internet speed, webpage speeds... by ictebres on Wednesday August 05, 2020 @09:12AM (#24060408)
Page loading speed is not the only concern the users have.
Re:In spite of an increase in Internet speed, webpage speeds... by midrus on Thursday August 06, 2020 @01:50AM (#24068436)
Tell this to Reddit developers
Re:In spite of an increase in Internet speed, webpage speeds... by lowwave on Wednesday August 05, 2020 @09:02AM (#24060316)
One can make code more readable and intuitive and making a good product for the user.

I have done both in heavy server side rendering using templates and SPA rendering on the client side. It all comes down to your user base and the devices/browser they are using, if they have an aversion toward running JS in the browser.

By using JS on the server side, you can maintain quite bit of logic on both server and client side. If you are doing web development, why not make it the same. Yes, one shall not trust the client validation, but many people find JS validation to be more user friendly than a form submit.

Re:In spite of an increase in Internet speed, webpage speeds... by octodog on Tuesday August 04, 2020 @10:50PM (#24056816)
I find this comment a bit odd. It seems clear to me that code that is easier to write, reuse, test and maintain saves time and money that can then be spent on building a better product. Do you disagree?
Re:In spite of an increase in Internet speed, webpage speeds... by pjmlp on Wednesday August 05, 2020 @01:46AM (#24057621)
How does that help sell more pizzas per day?

Blunt example, however that is what matters to a customer that just commissioned a web site for pizza delivery.

Re:In spite of an increase in Internet speed, webpage speeds... by hombre_fatal on Wednesday August 05, 2020 @08:07AM (#24059901)
Then again, my decision to order a pizza doesn't hinge on whether I have to wait an extra 5 seconds for the initial payload.

But it does hinge on how good the delivery website is though. If you haven't been to a pizza website in the past 10 years, let me point out they are complex with interactive drag-and-drop build-your-own-pizza wizards. Better client-side tech helps build those features to sell more pizzas.

How does your envisioned alternative help sell more pizzas than the heavy-client approach that pizza corporations have decided on?

Re:In spite of an increase in Internet speed, webpage speeds... by AnIdiotOnTheNet on Wednesday August 05, 2020 @09:54AM (#24060747)
> Then again, my decision to order a pizza doesn't hinge on whether I have to wait an extra 5 seconds for the initial payload.

Really? Because personally I find I tend to do more business with places that have interfaces that don't make me want to beat the developer with a wrench.

Re:In spite of an increase in Internet speed, webpage speeds... by pjmlp on Wednesday August 05, 2020 @08:29AM (#24060057)
By making use of APIs that deliver ready made HTML snippets via WebSockets, with on device caching.
Re:In spite of an increase in Internet speed, webpage speeds... by laumars on Wednesday August 05, 2020 @03:14AM (#24058080)
It’s even more important in that case because writing a pizza delivery website isn’t a complex nor new problem so doesn’t need a complex solution.

But to answer your question, if you write clean code then when that company expands it’s operations it is easier for you (or whoever next gets commissioned) to later expand on that site to add more restaurants, thus then allowing your customer to sell more pizzas.

Re:In spite of an increase in Internet speed, webpage speeds... by pjmlp on Wednesday August 05, 2020 @04:07AM (#24058364)
That is definitely not a feature that requires JavaScript, if you now want to pick on my example.
Re:In spite of an increase in Internet speed, webpage speeds... by laumars on Wednesday August 05, 2020 @02:20PM (#24063880)
> That is definitely not a feature that requires JavaScript

You’re right it doesn’t but I thought the context had drifted from that topic and onto code quality.

If we’re talking strictly about JS heavy sites then I’m definitely in favour of the less is more approach. There’s times when it makes sense having JavaScript trigger restful APIs rather than have the entire site rendered on the server side. The problem is JavaScript often gets overused these days.

I could write an essay on where I think modern tech has gone off the rails though.

> if you now want to pick on my example.

That’s a strange comment to make considering you presented the example for discussion. Of course people will then “pick on” the example, in fact you’d be the first to moan about a straw man argument if people cited a different example.

Re:In spite of an increase in Internet speed, webpage speeds... by brailsafe on Thursday August 06, 2020 @07:13AM (#24069912)
Which engineering discipline's primary concern is user experience?
Re:In spite of an increase in Internet speed, webpage speeds... by almostdeadguy on Tuesday August 04, 2020 @11:15PM (#24056938)
One of the truly differentiating factors for good software engineers is being able to recognize when your habits are in harmony with the objectives of the project you're working on. And on the meta-level, developing the sense for how to keep them in harmony with the trajectory of a project which will likely prioritize different things at different points over its lifespan.

Propensity to change is one of the most common features I've found in software projects I've worked on in my career and most software engineering "best practices", as conceived by the authors of opinions about these things, are usually strategies for managing rapid change. i.e. structuring code so it's amenable to change, understandable to the maintainer who inherits your code, has guardrails around important invariants and guarantees via assertions and tests, etc.

The details of how (and to what degree) these things should be done are highly contextually sensitive, and that is where the dogma of "best practices" can start to interfere with creating a good user experience. But I find it a little eye-rolling when people talk about hygienic software development practices and user experience as though they are in opposition. Tests, legible code, flexible structure, etc. are enablers of good user experience, because they're what allow us to change products to fit the needs of our users. They're what allow us to ship things that people can use without them exploding.

The tendency toward asset bloat on the web and just the general use of cheap-in-development-costly-for-the-user solutions (scripting languages, inefficient data structures, verbose serialization formats, piles of dependencies) is definitely an industry problem, but I think its naive to attribute these decisions to lazy devs or devs trying to make their jobs more convenient. In my experience there's two common causes for this state of things:

1. In all seriousness, the nature of capitalism. In reality, most businesses don't actually care about the majority of prospective users. They care about a couple narrow segments of users, and if those users happen to be equipped with hardware to handle this kind of inefficiency (i.e. if they're first world clients on desktop or high end mobile devices with 4G access), the business largely doesn't care. Responsiveness, low resources consumption, low energy impact, etc. are fungible engineering goals if they don't negatively affect your sales objectives.

2. The org hasn't figured out how to incentivize responsiveness, low resource utilization, etc. as objectives. Software developers get requests to focus their efforts on all different manner of criteria, and the without designing incentivization schemes and feedback loops that orient toward these objectives, there is no particular reason why they'll be inclined towards them.

Re:In spite of an increase in Internet speed, webpage speeds... by john-shaffer on Tuesday August 04, 2020 @11:14PM (#24056933)
> I'll just use a list for everything: the users will eat the slowdown

"Premature optimization is the root of all evil." You often should use a list until you've identified a specific performance issue. The list isn't the problem. Not actually optimizing is.

Re:In spite of an increase in Internet speed, webpage speeds... by account42 on Wednesday August 05, 2020 @04:37AM (#24058537)
Choosing the right data structures and algorithms is not premature optimization.
Re:In spite of an increase in Internet speed, webpage speeds... by john-shaffer on Wednesday August 05, 2020 @10:37AM (#24061243)
I agree if you know, e.g., that the list is going to contain thousands of items or is going to be iterated over in your inner loop. That's not premature optimization, that's just common sense. Hence the qualifier "premature".
Re:In spite of an increase in Internet speed, webpage speeds... by pdimitar on Wednesday August 05, 2020 @07:35AM (#24059638)
> You often should use a list until you've identified a specific performance issue.

Identifying a JS performance issue is something that almost no company ever does unless revenue is obviously threatened (and even then many fail to act). So IMO it pays off to do a little bit of premature optimization in JS land.

Re:In spite of an increase in Internet speed, webpage speeds... by hazz99 on Wednesday August 05, 2020 @02:01AM (#24057704)
> "It makes code more readable and intuitive" is NOT the end goal. Making your job easier or more convenient is not the end goal. Making a good product for the user is!

I think the end goal is more about balancing the value you can create with the budget you have. It's an optimization problem.

If I can deliver 80% of the value for 20% of the price, I will do that.

Re:In spite of an increase in Internet speed, webpage speeds... by foepys on Wednesday August 05, 2020 @02:51AM (#24057972)
Until somebody comes around and sells the 100% product for a 50% markup and enough people value completeness and UX more than their money. See Apple's MacBook Pro and iPhone.

Another example: I absolutely hate Amazon Prime Video for its UX and bugs they didn't fix for years (like asynchronous audio). So even though Prime is significantly cheaper in Germany, I rather pay for the more expensive Netflix instead.

Re:In spite of an increase in Internet speed, webpage speeds... by hazz99 on Wednesday August 05, 2020 @05:57PM (#24066068)
Yes, but low end notebooks would still exist. Different customer segments.
Re:In spite of an increase in Internet speed, webpage speeds... by simion314 on Wednesday August 05, 2020 @04:22AM (#24058442)
I agree with you that it makes sense from a dev point of view but what about the users?

Imagine all restaurants and cooks in the city decide that from tomorrow they want to make their job easier so they will drop ingredients, hygiene and processing quality with 80% so they will work less and make more profits. The ones that won't follow the new way will be put out of business because they will have more expenses and the lazy ones can put some of the new profits evangelizing the new ways making it look cool.

Re:In spite of an increase in Internet speed, webpage speeds... by hombre_fatal on Wednesday August 05, 2020 @08:16AM (#24059956)
People's decisions actually do hinge on those restaurant examples, though. Gross food? Hair in your meal? Horrible service? Restaurants can't get away with that due to stark business and reputation penalties. People will simply never come back.

Quite a different scenario than all websites taking an extra few seconds to load.

In fact there's very little a website can even do to turn off customers like a restaurant can. Imagine if HN took 10 seconds to load. Who cares? There's no "HN across the street" that I can go to that hinges on a 10 second wait time.

Re:In spite of an increase in Internet speed, webpage speeds... by adamsea on Wednesday August 05, 2020 @09:47AM (#24060679)
You’ve just described fast food!

Except of course it’s not the workers but the business decision-makers plus economic environment/pressures that make the decision.

Re:In spite of an increase in Internet speed, webpage speeds... by hazz99 on Wednesday August 05, 2020 @07:36AM (#24059649)
No, they will serve different customer segments and the market will split into the various strategic positions it can support.

It’s just a different business model. Less value, less expensive, higher volume. More value, more expensive, lower volume.

In your example, one of the restaurants become McDonalds and another becomes a gourmet restaurant. They compete differently.

Re:In spite of an increase in Internet speed, webpage speeds... by simion314 on Wednesday August 05, 2020 @08:20AM (#24059981)
Right, so a native fast application would have a niche of users that care where the apps made with electron will have a larger user base because it will be cheaper to create for the developers but users will pay with lectricity and frustration.

My issue is that you can market some cheap food like "our food is cheap but good enough, come here to save money" where with software is "our software is slow,buggy,eats your battery - use it because we are lazy and we want to use latest coolest language to put on our CV".

Sure when I do a proof of concept toy project I will be lazy and use whatever I like, if I share it it will be free = I have a problem with big projects say a news site that has millions of users and your laziness(or using latest cool stuff) affects such a giant number of people.

Re:In spite of an increase in Internet speed, webpage speeds... by hazz99 on Wednesday August 05, 2020 @09:12AM (#24060396)
There’s no moral obligation to make incredibly efficient and streamlined software. Solving the problem and proving sufficient value is usually enough.

Sure, they might get displaced by a competitor in the future - but by then they’ve probably got a large user base and a warchest to compete with. Slack is a great example of this.

If it’s software that’s life critical, then maybe, but that’s a small minority.

Markets and buyer preferences are always changing - I think it’s better to be agile (ie high developer velocity with talented product managers) to be able to detect and capture these shifts.

Re:In spite of an increase in Internet speed, webpage speeds... by bananaface on Wednesday August 05, 2020 @04:22AM (#24058440)
Slack has a budget of multiple millions, RipCord has a budget of zero, and one programmer who works on it in his spare time. Which is faster?

Polishing RipCord so it looked indistinguishable from the Slack client wouldn't be that expensive. I would argue its much more "they don't know how" than "they are making a business decision not to."

Re:In spite of an increase in Internet speed, webpage speeds... by hombre_fatal on Wednesday August 05, 2020 @08:25AM (#24060026)
That should only remind you that people care about a lot more than just performance.
Re:In spite of an increase in Internet speed, webpage speeds... by bananaface on Thursday August 06, 2020 @07:13AM (#24069910)
Why would I assume this particular failure is a choice?
Re:In spite of an increase in Internet speed, webpage speeds... by munk-a on Tuesday August 04, 2020 @07:09PM (#24055490)
I'd add that the OP was advocating for static HTML which is, in this day, unsellable to a lot of clients. I love producing static HTML server-side and in house a lot of our internal tools get written like that and operate fine.

Additionally I feel like there was an implication that in such a setup the client would be doing hard processing - i.e. aggregating a raw data set on the fly - I've seen this done and it's terrible in most circumstances and it certainly isn't the norm. The server can do the heavy lifting and then hand things off to the client to do all the minor display adjustments like localization, adjusting for timezones - display stuff.

A well written front-end can provide a far more responsive page by using over-fold only rendering that the server is mostly ignorant of. Both sides of the product should be independent systems setup to treat the other as foreign I/O pipe where data is just being requested and returned.

Re:In spite of an increase in Internet speed, webpage speeds... by userbinator on Tuesday August 04, 2020 @08:07PM (#24055865)
The more modern style of heavier client-side js apps lets you use software development best practices to structure, reuse, and test your code in ways that are more readable and intuitive.

I have seen phrases like that being used to (over)sell something so many times that I feel suspicious and doubtful whenever I see them --- Enterprise Java™ is sold using similar verbiage, and yet I'd never want to work with it again. Some of the worst codebase I've worked with --- ridiculously indirect and abstracted --- were created and described with such terms.

I'll take spaghetti code over whatever dogmatically following "best" practices produces. The former "flows", while the latter "jumps".

Re:In spite of an increase in Internet speed, webpage speeds... by sequoia on Wednesday August 05, 2020 @10:28AM (#24061137)
> Every large server-rendered app I've worked on ends up devolving to a mess ... that is a big pain to work on.

I can honestly say the same about every large SPA style app I've worked on and I've worked on several. Rewrites are the norm in the JavaScript arena because code devolves into a complicated mess then people look at it and say "It's just a JS app–there's no reason it should be this complicated!" Then they rewrite it with the latest framework magic, rinse, and repeat.

EDIT: I have to go further and (respectfully) say this comment I'm replying to is a load of BS. It's responding to a big pile of data saying that pageload speeds are not faster today with 'well that's not my experience.'

The other aspect of this comment that sets me off is what I'll call the "you don't have to use JSX to use React" type rebuttal. With this type of rebuttal, you respond to complaints about the way 99% of people use JavaScript by claiming that it's not strictly necessary to do it that way, despite the fact that "that way" is how everyone does use JS as well as the way thought-leaders & framework authors suggest you use it. It's responding to real-world conditions in workplaces with a hypothetical-world where JS is used differently than it is today.

This type of argument always shifts the blame on to individual developers for "using JS wrong." When 90+% of people are "using the tool wrong" there is a problem with the tool and it's not reasonable to shift the blame to every user who's trying to follow the latest "best practices."

I wish we could acknowledge the facts of the JS ecosystem (like those presented in this article) rather than deflect with "not all JavaScript apps..." when mostly what you're talking about is demos & contrived speedtests, not real-world applications.

If 'ifs' and 'ands' were pots and pans, we'd have no need for a tinker.

Re:In spite of an increase in Internet speed, webpage speeds... by bob1029 on Tuesday August 04, 2020 @07:40PM (#24055696)
We side-step large parts of this argument for our more complex business UIs by leveraging server-side technologies like Blazor.

We also recognize that by constraining some aspects of what we are willing to support on the UI that we get profound productivity gains.

Hypothetically, if we wanted some animations in our server-side blazor apps, we could add some new methods to our JS interop shim for explicitly requesting animation of specific element ids. We could also conditionally adjust the CSS stylesheets or classes on elements for animations on round trips of client-triggered events. Putting an @if(...){} around a CSS rule is a perfectly reasonable way to get the client to do what you want when you want. In this model the client has absolutely zero business state. When you go all-in with server-side it means you always have a perfect picture of client state from the server's perspective, so you can reliably engage in this kind of logic.

There are compromises that have to be made. The above is not a perfect solution for all use cases. But, it does demonstrate that with some clever engineering and new ways of thinking about problems that we can get really close to meeting in the middle of several ideal philosophies all at the same time.

Re:In spite of an increase in Internet speed, webpage speeds... by chrischattin on Tuesday August 04, 2020 @10:43PM (#24056779)
> The more modern style of heavier client-side js apps lets you use software development best practices to structure, reuse, and test your code in ways that are more readable and intuitive.

This reads like vague marketing speak. In reality SPA/front end JS frameworks do the exact opposite - violates all kinds of software best practices like duplicating logic server/client, creating brittle tests, conflation of concerns, etc, etc. SPA's front end JS frameworks are an anti-pattern, imo.

Re:In spite of an increase in Internet speed, webpage speeds... by hombre_fatal on Wednesday August 05, 2020 @08:34AM (#24060098)
SPAs treat the browser just like any other client. If anything, it's more design-/architecture-consistent.

- iOS speaks to your JSON server.

- Android speaks to your JSON server.

- CLI speaks to your JSON server.

- Desktop GUI speaks to your JSON server.

- Other machines speak to your JSON server.

Meanwhile...

- Browsers use browser-specific html endpoints to utilize a historical quirk where they render UI markup sent over the wire that the server has to generate, and now you're dealing with UI concerns on both the server and webclient instead of just dealing with biz-logic and data and the server.

I find it very hard to see how this is somehow what avoids duplicating logic on server/client and conflating concerns.

Re:In spite of an increase in Internet speed, webpage speeds... by chrischattin on Wednesday August 05, 2020 @01:09PM (#24063094)
I think you’re confusing the view layer with adding an entire SPA/JS framework where you duplicate the data model and offload business logic to the client vs a standard req/resp and rendering html/json or even JS from the server. It’s much much cleaner to do the latter. This is speaking from hard earned experience building web apps over the last ten years.
Re:In spite of an increase in Internet speed, webpage speeds... by robertoandred on Tuesday August 04, 2020 @11:59PM (#24057138)
On the contrary, a traditional server-side/jQuery hybrid is what results in duplicated templating and logic. A SPA at least has everything in one place.
Re:In spite of an increase in Internet speed, webpage speeds... by anhner on Wednesday August 05, 2020 @05:53AM (#24058950)
Sounds like you mostly had experience with old style server side development (like php with no frameworks maybe?)

Have you tried building an app with a more modern framework, like Phoenix or Blazor? You won't even need to write a single line of javascript. All business logic is on the server (no duplication of models) an can be easily testable.

In my experience, SPAs tend to get overly complex, and they mix (and duplicate) business logic with UI logic.

Re:In spite of an increase in Internet speed, webpage speeds... by michaelcampbell on Wednesday August 05, 2020 @10:01AM (#24060821)
> This type of anti-big-js comment does great on Hacker News and sounds good, but my personal experience has always been very different.

And yet, here we are, with a complete article devoted to the opposite effect.

Re:In spite of an increase in Internet speed, webpage speeds... by astura on Wednesday August 05, 2020 @04:39AM (#24058551)
I've worked on (non-SPA) webapps that are old enough to vote and I just have to disagree with this assessment.

Beyond that, most websites are not webapps, most are serving up static or near-static content so most websites shouldn't be designed and engineered like they are complex webapps that are doing heavy data processing.

Re:In spite of an increase in Internet speed, webpage speeds... by mattgreenrocks on Wednesday August 05, 2020 @01:07PM (#24063074)
This might be the root cause of the "goopy" feeling I get working on web apps. I couldn't get away from it so I just gave up on web apps entirely.

So much of web tooling seems to aim to perpetuate the conceptual model of the web instead of daring to improve on it. Declarative views, for instance, are a breath of fresh air: instead of trying to put a JS/Python/Ruby coat of paint on the same ideas of what a web app should be, they aimed at trying to reduce a view to its essential complexity.

In a sense, being too in love with the web keeps you at a local maximum because you think web programming should be HTML/CSS/JS only.

Re:In spite of an increase in Internet speed, webpage speeds... by kohlerm on Wednesday August 05, 2020 @02:03AM (#24057711)
IMHO the solution is a smart combination of server and client side rendering. Client side rendering in my experience tends to increase the number of requests, especially if you are using a microfrontend approach. More requests means more latency, unless all request are running in parallel, which is not always feasible. Note that with regards to latency the speed of the web did not change much and won't change much anytime soon (at least noton the desktop)With Vue and some other frameworks the complexity of this approach became acceptable in the meantime.
Re:In spite of an increase in Internet speed, webpage speeds... by Joeri on Wednesday August 05, 2020 @02:17AM (#24057798)
Every bit of interactivity/ reactivity that product wants to add to the page feels like a weird hack that doesn't quite belong there, polluting the simple, declarative model that your views started off as.

This doesn’t need to be the case though. There have always been server-side frameworks which generate the client-side parts for you automatically, so you can mostly avoid writing any javascript even for the interactive parts. Check out rails/turbolinks/stimulusjs (used to build basecamp and hey.com) or the TALL stack (increasingly popular in the php community) for modern day examples.

Re:In spite of an increase in Internet speed, webpage speeds... by midrus on Thursday August 06, 2020 @01:48AM (#24068428)
It is unfair to compare the careless jQuery spaghetti that was pretty common time ago with a client side framework such as React regarding maintainability. If you put some effort (which I'm convinced is a lot less than the effort we put to build SPAs) into doing the "sprinkles" right, it can be as maintainable as the SPA or even more, with the added benefit of not sending so much crap to the end user. There are modern approaches to this (Turbolinks, stimulus, Unpoly, Intercooler, etc...), no need to do manual JQuery manipulation anymore. Pair it with Node, and you still have a pure JavaScript solution without wasting the user's CPU, memory and patience.
Re:In spite of an increase in Internet speed, webpage speeds... by pdr2020 on Tuesday August 04, 2020 @10:04PM (#24056575)
They don't understand the original tradeoffs that led to client-side only applications.

Let them experience the pain of rebuilding that old wheel :)

Re:In spite of an increase in Internet speed, webpage speeds... by chrischattin on Tuesday August 04, 2020 @10:39PM (#24056759)
The original tradeoff was mega-cap FAANG companies trying to offload processing power to the client. There never was an organic open source push for SPA's or front end JS frameworks. They add a ton of tech debt and degrade the UX. Premature optimization and anti-pattern for everyone but a handful of companies, imo.
Re:In spite of an increase in Internet speed, webpage speeds... by com2kid on Wednesday August 05, 2020 @12:52AM (#24057348)
The old world was having a complex web stack that included strange templating languages hacked onto languages that were sometimes invented before HTML was even a thing (see: Python) that spat out a mix of HTML and JavaScript.

Then there was the fact that state lived on both the client and the server and could (would...) easily get out of sync leading to a crappy user experience, or even lost data.

Oh and web apps of the era were slow. Like, dog slow. However bloated and crappy the reddit app is, the old Slashdot site was slower, even on broadband.

> They add a ton of tech debt and degrade the UX.

They remove a huge portion of the tech stack, no longer do you have a backend managing data, a back end generating HTML+JS, and a front end that is JS.

Does no one remember that JQuery was used IN ADDITION TO server side rendering?

And for what its worth, modern frameworks like React are not that large. A fully featured complex SPA with fancy effects, animations, and live DB connections with real time state updates can weigh in at under a megabyte.

Time to first paint is another concern, but that is a much more complicated issue.

If people want to complain about anything I'd say complain about ads. The SINGLE 500KB bundle being streamed down from the main page isn't taking 5 seconds to load. (And good sites will split the bundle up into parts and prioritize delivering the code that is needed for initial first use, so however long 100KB takes to transfer nowadays),

Re:In spite of an increase in Internet speed, webpage speeds... by Slartie on Wednesday August 05, 2020 @02:31AM (#24057870)
> Oh and web apps of the era were slow. Like, dog slow. However bloated and crappy the reddit app is, the old Slashdot site was slower, even on broadband.

Just those that attempted to realize every minuscule client side UI change by performing full page server side rendering. Which admittedly were quite a few, but by far all of them.

The better ones were those that struck a good balance between doing stuff on the server and on the client, and those were blazingly fast. This very site, HN, would probably qualify as one of those, albeit a functionally simple example.

SPAs are just a capitulation in the face of the task to strike this balance. That doesn't mean that it is necessarily the wrong path - if the ideal balance for a particular use case would be very client side heavy (think a web image editor application) then the availability of robust SPA frameworks is a godsend.

However, that does not mean it would be a good idea to apply the SPA approach to other cases in which the ideal balance would be to do much more on the server side - which in my opinion applies to most of the "classic" types of websites that we are used to since the early days, like bulletin boards, for example.

Re:In spite of an increase in Internet speed, webpage speeds... by Sukera on Wednesday August 05, 2020 @01:56AM (#24057664)
> Oh and web apps of the era were slow. Like, dog slow. However bloated and crappy the reddit app is, the old Slashdot site was slower, even on broadband.

Which reddit app are you talking about, the redesign or old.reddit.com? I ask because the old version of reddit itself certainly wasn't slow on the user side, iirc reddit moved to the new SPA because their code on the server side was nigh unmaintanable and slow because of bad practices of the time.

> Time to first paint is another concern, but that is a much more complicated issue.

That's the thing though, with static sites where JQuery is used only on updates to your data, the initial rendering is fast. Browsers are really good at rendering static content, whereas predicting what JS is going to do is really hard..

Re:In spite of an increase in Internet speed, webpage speeds... by com2kid on Wednesday August 05, 2020 @01:24PM (#24063244)
The new reddit site on desktop is actually really nice. Once I understood that it is optimized around content consumption I realized how it is an improvement for certain use cases. Previously opening comments opened either a new tab, or navigated away from the current page, which meant when hitting back the user lost their place in the flow of the front page. The new UI fixes that.

Mobile sucks, I use RIF instead, or old.reddit.com if I am roaming internationally and want to read some text only subreddits.

> That's the thing though, with static sites where JQuery is used only on updates to your data, the initial rendering is fast. Browsers are really good at rendering static content, whereas predicting what JS is going to do is really hard..

Depends how static the content is. For a blog post? Sure, the content should be delivered statically and the comments loaded dynamically. Let's ignore how many implementations of that are absolutely horrible (disqus) and presume someone at least tries to do it correctly.

But we're all forgetting how slow server side rendering was. 10 years ago, before SPAs, sites took forever to load not because of slow connections (I had a 20mbps connection back in 1999, by 2010 I was up to maybe 40, not much has changed in the last 10 years) but because server side was slow.

If anything more content (ads, trackers..) is being delivered now in the same amount of time.

Re:In spite of an increase in Internet speed, webpage speeds... by reciprocity on Wednesday August 05, 2020 @06:01PM (#24066099)
New reddit makes it easier to push ads; any other motivation for its implementation is an afterthought. There's plenty of valid criticism that can be levied against the claim that the redesign is "superior" by default. And I think often we confuse amount of information with quality of information exchange. Due (mostly) to the ever increasing amounts of new users that it desires, you could easily make the point that the quality of content on reddit has nosedived. Optimizing for time on site is not the same thing as optimizing for time well spent.

Reddit as a company obviously wants more users; a design that lets people scroll on through images ad nauseam is certainly better than a design that is more information dense, so if that's something you'd cite as an example of "better in certain use cases" then I agree, otherwise there's plenty of reasons to use old.reddit.com from an end user's perspective.

The concept of Eternal September applies.

Re:In spite of an increase in Internet speed, webpage speeds... by astura on Wednesday August 05, 2020 @05:31AM (#24058838)
Even if everything you said was true (it's definitely not!) that doesn't explain why the web is bogged down with entirely static content being delivered with beefy JavaScript frameworks.
Re:In spite of an increase in Internet speed, webpage speeds... by com2kid on Wednesday August 05, 2020 @01:32PM (#24063331)
10 years ago it was static content being delivered by ASPX, JSP and PHP, with a bunch of hacked together JS being delivered to the client for attempts at a rich user experience.

It still sucked. It just sucked differently. I'll admit it was better for the user's battery life, but even the article shows that it was not any faster.

Re:In spite of an increase in Internet speed, webpage speeds... by tomp on Wednesday August 05, 2020 @04:45AM (#24058584)
The original trade-off was having a non-sucky web email client.

GMail, the first real "client-side" app, was so far beyond Hotmail / Yahoo Mail in usability that it's hard to even phantom ever going back.

Re:In spite of an increase in Internet speed, webpage speeds... by astura on Wednesday August 05, 2020 @05:11AM (#24058715)
I don't know where this misconception came from - XMLHttpRequest was invented by Microsoft for use in Outlook Web Access, Gmail was essentially a copy of that.
Re:In spite of an increase in Internet speed, webpage speeds... by tilolebo on Wednesday August 05, 2020 @08:36AM (#24060115)
True! I remember using OWA in my university around 2003, before the first invites for Gmail went out.

You could switch to the horrendous non-Ajax interface.

I never realized that before, always thought Gmail was the first Ajax webapp.

Re:In spite of an increase in Internet speed, webpage speeds... by tomp on Wednesday August 05, 2020 @05:40AM (#24058881)
Ah, maybe. I didn't use OWA back then... And even now it's pretty shit (compared to GMail), so ...
Re:In spite of an increase in Internet speed, webpage speeds... by arexxbifs on Wednesday August 05, 2020 @08:08AM (#24059911)
The first web versions of Outlook were plenty fast and usable on my then workstation (PIII 667 MHz w/ 256 meg). In fact, a lot of the web applications made 15 years ago were fast enough for comfortable use on Pentium 4 and G4 CPUs, because most used combinations of server-side rendering and vanilla JS. It was painful to develop, sure, but the tradeoff in place now is severely detrimental to end users.
Re:In spite of an increase in Internet speed, webpage speeds... by Raptor22 on Tuesday August 04, 2020 @10:36PM (#24056737)
What were the tradeoffs? Genuinely curious.