3 ms·
Your bad experiences are not because SPA is a bad idea, but because you did it wrong. Once an app is loaded there's simply no reason to every throw it out and s
by ClayFerguson 10y ago
Your bad experiences are not because SPA is a bad idea, but because you did it wrong. Once an app is loaded there's simply no reason to every throw it out and start over. Do native apps have to throw any data away every time they open a dialog, or change an aspect of the gui? No, because that is silly and stupid. The only reason page refreshes even exist is because the original design of the internet was for viewing documents. However that's not was the web is used for any longer, for the most part. The web is not simply for viewing documents. It's at least as much for running apps now. A good webapp loads ONCE and then simply makes ajax calls to get JSON from the server when it needs to re-render part of the screen or even most of the screen, but if you are still doing entire page refreshes in 2017, then i'm just sorry but you are clueless. That's just not the way to do it. Web development is complicated, and I admit just reloading the entire page every time something happens is easier, but that doesn't make it better. Like the old expression "anything worth doing is worth doing right". It applies here.
- ec109685 10y agoWhat is your favorite SPA? HN's experience on a mobile phone, loading pages when clicking links, is far superior to any SPA I know of. Compare HN to glitchy sites like Twitter or Reddit, where swipe from left back doesn't work without flashing. If you are simply rendering content and don't require high degrees of in-page interactivity, your traditional web page centric app will be much better user experience. SPA's for content dominant sites are often a crutch to work around slow backend. A full page refresh (with optional pre fetching of next click HTML) is vastly superior to SPA's and spinners while loading. Browsers are good at loading web pages.
- ClayFerguson 10y agoOnce your browser has loaded the page, it's always (and I mean 100% of the time) more efficient to get whatever data you need from your server in the form of JSON, and then use that json to update ONLY the part of the page that is changing. Even if your entire DOM tree is changing that's STILL no excuse to do a page reload. The only page reload that ever needs to happen is when the user first browses to your url.
- ec109685 10y agoWhy do you think executing JavaScript to render a piece of content fetched from the server as JSON is always more efficient? Browsers are really efficient rendering HTML, so it all depends on how complex your JSON to DOM element transformation is. With async parsing / loading of JavaScript, your new page can be rendered before the JS is even loaded, so the extra initializaion per page view is hidden from the user. Which site feels better, yours or Wikipedia?
- ClayFerguson 10y agoMy site is not finished, so you can't judge it by the experience. However, it is most definitely vastly superior to Wikipedia. meta64 is hierarchical like a directory tree, and can go to any depth. I haven't written the whitepaper yet, but my design makes wikipedia look like the ancient artifact it truly is compared to meta64. All my API is fully JSON up and JSON down(REST-like), and is like a microservice api. The server is a service with an API. The javascript client is in control of rendering the data it gets from the server. I'm convinced that's the most efficient design.
- Isofarro 10y agoYoiks. 12 seconds until the first piece of content is displayed (compared to Wikipedia's 0.6s). That there (TTFC - Time to first content) is the perennial problem of client-side apps, the inability to get the first piece of content immediately to the user. Since you say it's all JSON APIs, it should be trivial to build something on the server to server-render the initial page with content and serve that up while the rest of the application tries to download itself into the browser.
- ClayFerguson 10y agoif I had minification on, your comparison would be apples-to-apples. I have it off for now, for debugging. Also my APP installs itself the first time you visit the page. Think of it as an APP INSTALL. Wikipedia is NOT an app, and has nothing to install.
- Kiro 10y agoWhat are you talking about? Where does he say he throws anything out? The guy built Grooveshark, one of best SPAs ever so I'm pretty sure he knows what he's doing.
- ClayFerguson 10y agoA page refresh is what I call "throwing things out". Once you load your page, you don't need to load it again. Just make ajax calls to server from then on, and use the JSON response from the server to update the DOM. A page-refresh blows away the entire DOM, and is just a bad design IMO.
- tene 10y agoHe said that he built a single-page app to avoid page refreshes; where did you see in his comment (or when using Grooveshark? somewhere else?) that he refreshed the page or otherwise threw things out?
- ClayFerguson 10y agoI think we agree and are misunderstanding each other. Yes if you have an SPA there is no refresh, no throwing things out, and it's good.
- Kiro 10y agoI think you need to read the post you replied to again. There are no page reloads going on in Grooveshark. It's a proper SPA.
- kedean 10y agoWas*, GrooveShark shut down in 2015.
- ClayFerguson 10y agoYou are correct. My post was not about grooveshark or in any way related to grooveshark.