3 ms·
I've been working with SPAs for the last 4 years and I must say I can't decide which approach is better. I believe SPAs provide better user experience, but the
by arnvald 8y ago
I've been working with SPAs for the last 4 years and I must say I can't decide which approach is better. I believe SPAs provide better user experience, but the cost of that is significant. Also, not every component-based page must be an SPA. You can have multiple pages, each of them having some components.
Regarding the article, it feels like author is angry that someone prefers server-side approach instead of his favourite way of developing apps. I disagree with a bunch of arguments in the article:
> (about server-side templates) For any large application (by large I mean more than 50 individually developed screens) this slowly becomes harder to maintain.
50 server-side templates vs 50 stateful components, I really don't see why the former is harder to maintain
> (about server-side templates) How to name things — when everything is dynamic, naming becomes hard.
Again, no idea why naming would be easier with SPAs
> Use runtime templating after AJAX call is done. We cannot use server side rendering any more — or can we? Let’s write endpoints that return HTML and not JSON.
Or course we can do that, why not? Even more - when lazily loading templates in component framework like Angular, I need to not only download the template that's in HTML, but also Angular needs to compile that template.
> Let’s be honest — the only way one can say developing SPA application is costly is if they either don’t know any SPA technology or if they don’t want to learn it.
I don't have any hard data, but neither does the author, so I guess we'll focus on personal experience. From my experience keeping state only in the backend is easier to maintain and therefore cheaper than keeping the state both in the backend and in the frontend.
> Knowing server side templating language. Also not being able to use the same language for AJAX templating.
But to write client components I also need to learn some Angular templating syntax or JSX or some other stuff. And it's not simpler to learn than let's say PHP templating.
If I use PHP for my backend, then I don't need to learn template language, because I just use HTML + embedded PHP.
> If you have proper mobile app, an API has to be developed for that. Having two layers accessing the same data in two different ways is not practical.
That's a fair point, however it doesn't make a big difference.
Using SPA I need to develop JSON API + mobile views + SPA components
Using multi page app, I need to develop JSON API + mobile views + server side templates
> State on the client — because that is where the state belongs to.
But why? The state does not need to belong to the client. The client might be a representation of the state that comes from the server.