3 ms·
I tried—I really did try—to use server-side rendering for every project I've worked on. I find it really unpleasant when I hit a site, like a blog or something,
by matthewmacleod 9y ago
I tried—I really did try—to use server-side rendering for every project I've worked on. I find it really unpleasant when I hit a site, like a blog or something, which has almost entirely static content and yet it still rendering it locally. The experience is objectively worse, and I had no interest in making that the case for my users.
But there's a middle ground in practice. Public-facing website that users might hit from a search engine? Obviously render it on the server, and if required progressively enhance it. Something more akin to a web application? Server-side rendering makes everything slower and more complex without benefiting any users. If you aren't using Node on the server, it's even more complex.
I really hate that this is the case. I had this firm idea in my head – "every URL is an HTML page, and users should be able to take that URL and request it using Curl or whatever, and see the content of the page". In practice, we were developing a highly-interactive, domain-specific application that relied heavily on client-side scripting to be realistically useful for users. There were no users without JS that I was able to find. We were doing a huge amount of work to follow a rule of progressive enhancement, that in practice slowed down the experience for users and, benefited nobody, and made development ~ an order of magnitude harder.
- hartator 9y agoCan you elaborate? My understanding is just having the initial version of your components server-sided rendered, not all of it. Then JS takes over when it's loaded. It shouldn't change much to your existing code.
- matthewmacleod 9y agoYeah, in theory it's pretty simple. If you're using Javascript on both the server and client, it's definitely easier. But I guess I'm conflating server-side rendering with "pages that don't require Javascript to work", which is definitely more work.
- meesterdude 9y ago> If you aren't using Node on the server, it's even more complex. stopped reading after this. clearly just babble with no real argument to be made.
- matthewmacleod 9y agoI'm sorry if I wasn't clear, but I don't think it's an argument without merit. I mean that if you want to build a UI in the manner described in the article—where you essentially use a JS UI framework to render the application server-side, and subsequently make it interactive on the client side—then doing so without the server being Javascript is more complex. I have direct experience of doing this – I built a complex web application that used this approach from within Rails. Essentially this replaced Rails built-in template renderer with a JS environment running in V8. It was pretty cool, in that it meant writing templates once and having them server-side rendered but also interactive on the client side – but it added a huge amount of complexity. Is there something I was babbling about that I missed?
- meesterdude 9y ago> then doing so without the server being Javascript is more complex. why? What does the server being javascript do for you that no other server can do to reduce the complexity?
- matthewmacleod 9y agoIt allows you to use the same tools to render the user interface on both the server and the client. For example: write a UI using React components, render a static version on the server, and use those same React components running in the browser to render an SPA using the statically-rendered template as a seed. The options if you are not using javascript on the server are less appealing - calling out to a JS interpreter to do your templating, or building duplicate templates for server and client side, or trying to sprinkle interactive client magic on the page after it’s been loaded. They’re all possible, but they are more complex than “one set of templates rendered everywhere” - what people were calling “isomorphic” I suppose, though it’s a silly term. Have I clarified? You seem unusually upset about what I thought was a relatively minor aspect of my initial post.
- meesterdude 9y ago