5 ms·
I think SPAs make sense for a very limited set of applications. I worked on Grooveshark, which was an SPA by necessity - you don't want page refreshes breaking
by wanderr 10y ago
I think SPAs make sense for a very limited set of applications. I worked on Grooveshark, which was an SPA by necessity - you don't want page refreshes breaking music playback. We had to do an insane amount of work to get initial load times down, and it was never as fast as we wanted it to be. Some things about an SPA were nice, your server side code can be very fast and very simple and scalable when you can rely on the client side to maintain state for example, but with that comes a lot of fragility and ultimately, a lot more work.
Working on a SPA can be lots of fun, so I'd consider it for a hobby project, but I wouldn't go the SPA route for a production app unless there were some very compelling reasons to do so.
- slau 10y agoI think Grooveshark helped me create more code than coffee did for the few years it was active. Just wanted to take a moment to thank you, and all the others who worked on it for making that possible. I know I wasn't alone to feel very, very lost and sad when it closed up. So, free beer in case we ever meet IRL.
- ClayFerguson 10y agoYour 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.