by userbinator · 10y ago · 0 comments
(I'm speaking of the demo, not the actual site describing it --- although I thought it would be hosted with itself.)
As for the idea of turning static content sites into client-side JS-rendered apps, that gets a strong disapproval from me. Why? It's needless complexity (instead of generating the HTML once and storing it on the server, every single visitor has to regenerate it on their machine), bad for accessibility, and very much against the principle of the Web that information should be easily linkable and retrievable. I can understanding using JS to do "app-ish" things that wouldn't be possible with static pages, but this is reinventing the wheel and making it square.
Yep, and the worse offender seems to be Quora that seems to have its main page receive all its data from java script (which as a side effect makes scrolling annoyingly slow). But it's probably on purpose since they are preventing copy/pasting so it's impossible to quote text from their website without linking to them in some way.
That's only true if you use 'view source'. If you open up dev tools, all of the elements are rendered in full and live updated as they change.
Client-side rendered apps are quickly becoming every-where rendered apps. They can now work isomorphically, on the desktop, and on mobile.
> every single visitor has to regenerate it on their machine
This is a false premise. For server-side view rendering, the view is tightly coupled to the data. The majority of the payload will be made up of dynamically generated (and non-ideal for caching) HTML structure. When all the user really needs is data.
Rendering apps on the client-side allows fetching partials and content data piecemeal, which is ideal for caching. Views can be cached at the HTTP layer, directly in the app, or both. This will be especially useful once HTTP/2 (ie connection persistence) are in common use.
-----
We're moving past the days of the static web. Especially, now that it's trivial to pull data from many different sources on the client-side.
What really never make sense was rendering the view on both the server-side and client-side (often times using 2 view template engines). Fortunately, that practice is becoming less common.
> They can now work isomorphically, on the desktop, and on
> mobile.
So can plain HTML. Without any needless scripting. > We're moving past the days of the static web.
We are not. Maybe you are, we can wait till you come back. > Especially, now that it's trivial to pull data from many
> different sources on the client-side.
HTML is even more trivial.The latest app frameworks decouple client-side application logic from the view rendering layer. Meaning you can use the same application logic on your web app as you use on mobile EXCEPT the view on mobile will be rendered natively. Not through a hacky, slow, inconsistent embedded web view. Native native.
If the approach is successful as the framework devs expect, mobile app development (and the app ecosystem as a whole) will go the way of the dinosaur.
Pulling data from many sources on the server requires proxying requests to third parties and providing inline caching of the responses for performance reasons. Despite the fact that the source you're proxying to likely already implements their own caching strategies.
Have fun addressing bugs caused by cache invalidations when you're dealing with multiple caching layers.
Not to mention the increased memory/computation footprint incurred from hosting the equivalent of a database view of an entire third party service on your backend.
Or, you could just request the data directly on the client side.
That's what I mean when I say 'reduced complexity.' Unless you consider setting up CORS whitelisting and some AJAX requests to be really difficult. Then, carry on.
client side rendering + json apis on the server are the holy grail of openness (esp with an MIT licensed client)
Because... those never lie. /s
For a blog or CMS this is probably not the case. The majority of the page is going to be the same for all users. Maybe you have something at the top of tbe page showing the user is logged in, and admin links to edit it, but that's probably about as dynamic as you will get.
> Rendering apps on the client-side allows fetching partials and content data piecemeal, which is ideal for caching
Yes.. but why? 99% of websites aren't going to have enough traffic that this would cause load issues on the server. On the client the browser probably does a better job of caching pages than you could.
For something more complicated that a blog or CMS you need to think about security. It's not a trivial task to cache something and securely serve it to only people who have an active session and are authorised to view it.
Rendering the content via JavaScript is slower than just having it in your HTML. It's true that JS execution has become insanely fast, however, initial JS execution is not as fast, because it requires that JIT to kick in. Even if JS execution becomes infinitely fast, you still have to work with the DOM, which is horribly slow and there are no known ways to make it fast. Google, Yahoo and others have prove with hard numbers that users care about speed, even when we are talking about milliseconds.
I highly recommend doing some research on how browsers and caching actually work before falling into the pit of false belief.
Also, tricks like that are what users generally recognise as speed - similarly Twitter's optimistic xhr submission appears to work instantly, then goes off and actually does it's thing retrospectively.
Fwiw I think a fully client side js cms app is a moderately rubbish idea for a variety of reasons, but js rendering of dynamic content absolutely has merit.
It's a little more nuanced than slamming somebody's 'pit of false belief' because they like client view rendering. :)
> That's only true if you use 'view source'. If you open up > dev tools, all of the elements are rendered in full and > live updated as they change.
If one attempts to view the demo with client side javascript turned off - one gets a completely blank page. The very point to a static site generator is the word "static" which is generally taken to mean that the actual rendering of the content requires only HTML rendering (no javascript (or php or ??) code execution, server side or client side).
If you want to render your blog in client side js AND use fresh-from-the-oven js features, the least you can do is include a polyfill.
Render the client on the server, then push the rendered markup and the client state to the browser where the client takes over again.
This paradigm is fundamentally different from the Angular1-style "render everything in the browser" and "maybe pre-render on the server, then discard that on page load" approach. If anything, it's closer to the traditional "render everything on the server, then apply enhancements in the browser" approach of the pre-SPA days.
Basically Angular2 renders a completely interactive view that captures any user events that occur while the app is bootstrapping in the background. Once the app is loaded, the events are replayed to make the user experience consistent.
React and Angular2 are fundamentally just different flavors of the same underlying infrastructure. React is more de-centralized and composition based. Angular2 is more centralized, monolithic, OOP, architecture based.
They have even eluded during presentations that the 2 core dev teams have been in direct contact to work out some technical details.
From what I've heard, Ember.js uses these same approaches. Kinda makes me question how much of this started with Ember and was later adoped by React and Angular.
Needless over engineering for displaying text on a page.
As much as I like site generators and I'd find this a good idea for some purposes I wouldn't state it is a replacement for static sites generators.
Maybe that's not directly SEO but it is indirectly. Good open graph data makes links, at least on Facebook, arguably more compelling which makes them more likely to be clicked and/or shared which may lead to better SEO
I totally agree with you here.