Live data from Hacker News

The absurd complexity of server-side rendering

gist.github.com

91–100 of 395 posts

Re: The absurd complexity of server-side rendering

#91
post #30

I already know I'm off my rocker (and my lawn with that phrasing) but I really wish the browser supported Python as a language instead of Javascript. I can pickle Python, send it to a client, and run it. Combine that with everything else Python 3 has brought to the table and I'd have a language that runs client side that I can depend on and that I love.

I'm giving Haxe a try for that reason. It's not python however.

Re: The absurd complexity of server-side rendering

#92

Earlier quoted context omitted.

I have colleagues using Laravel, and there's nothing muddy-ball about their apps at all. Their code is tidy, modern, readable, and clearly maintainable. In terms of practical effect, frameworks influence developers more than languages do.

The idea of using a "framework" in a language that gets completely reloaded on every new request doesn't make sense - at least I thought a framework was something that wrapped your own code and presented an event loop, etc. You'd want a "library" if you just wanted to improve on the original low quality PHP database connectors and such. But PHP developers always did seem to have inappropriate jealousy over unrelated…

You sound like me, but ten years ago. :) I used to have a similarly negative and narrow-minded perspective about PHP, but my colleagues and their outstanding work have enlightened me.

Re: The absurd complexity of server-side rendering

#93
post #55

Earlier quoted context omitted.

I'm not sure what about two bundles causes a huge level of complexity. Granted, I use Next.js, it does all of this out of the box. SSR is fast, it's provably faster than client side rendering for first load. You can optionally do client side hydration, so the time to meaningful content is fast from SSR, and subsequent page loads are done SPA style (if you want). It's never a fair comparison, but Stackoverflow is enti…

> Also, all forum software, which is SSR, despite being 20-30 years old, is usually faster than a SPA. Only because crap tons of hardware got thrown at the problem. I remember when forums were multi-seconds to load each page. It sucked. People complain about reddit a lot, but even on mobile, the reddit website is fast. It may be janky at times, but navigating between comments on stories is under a second, loading mor…

> I remember when forums were multi-seconds to load each page. It sucked.

You mean when you had the same internet speed 10 years ago, right...?

Re: The absurd complexity of server-side rendering

#95

How can a small site like HN possibly work when SSR is so complicated?

SSR isn't the classic model of server rendering. That one is easy. SSR is Javascript client code that also acts as cached server-side pre-rendering with subsequent hydration on the client.

It's confusing I know.

Re: The absurd complexity of server-side rendering

#97
post #53

Earlier quoted context omitted.

I have colleagues using Laravel, and there's nothing muddy-ball about their apps at all. Their code is tidy, modern, readable, and clearly maintainable. In terms of practical effect, frameworks influence developers more than languages do.

When people say they use "PHP" for webdev I recall BBOMs of flat files and raw SQL. Historically speaking, "PHP" does not necessarily imply "PHP+Laravel" or any other sane framework. OTOH if someone says they use "Python" for webdev I assume Flask/Django/etc.

I think you've summarized it well: people tend to make technical judgments based on preconceived and historical notions, in spite of evidence to the contrary. :)

Re: The absurd complexity of server-side rendering

#98
post #39

The common mistake teams make getting started with server-side rendering for React is thinking that your entire backend has to be contained in a single JavaScript bundle. Instead, use any language you want to set up your APIs and business logic. Then set up a fully independent pool of servers running Node.js whose only job is SSR. This setup skips over every problem the author mentions.

When I realized what the OP was describing, it honestly caught me off-guard. I had never heard of anyone attempting to colocate their API server and their Fastboot/Next.JS server in the same Node instance. Node is single-threaded. If you try to run lots of different things within the same Node VM, a runaway CPU-bound loop in your frontend can wind up causing the backend to lock up. Bad failure mode.

If your API server is separate from your Frontend server, you don't just make maintaining it more reasonable (the "server colored functions" are now a strict subset of the "client colored functions"). You also get operational flexibility: run the Frontend server in an edge function system [1], while running the API server alongside your DBMS. Isn't that what edge functions are for?

[1]: https://news.ycombinator.com/item?id=31084301

Re: The absurd complexity of server-side rendering

#99
In this thread: people confusing server rendering (like your old PHP) with SSR (same Javascript codepath for client and server, i.e. Next.js)

One is easy, the other is the definition of leaky and crappy abstraction. This article is about the latter technology.

Re: The absurd complexity of server-side rendering

#100

Earlier quoted context omitted.

I have colleagues using Laravel, and there's nothing muddy-ball about their apps at all. Their code is tidy, modern, readable, and clearly maintainable. In terms of practical effect, frameworks influence developers more than languages do.

This was my PHP experience with CodeIgniter 15 years ago. Nothing new under the sun.

That's good, I think? I'm not claiming that Laravel was the first or the best PHP framework, just that they were using it. (Admittedly I assume it's a reason their code is so well organized.)
Post reply on HN