3 ms·
I tend to think of it in terms of horses for courses. In other words, let your requirements drive your architectural choices, rather than going in with the prec
by mschaef 8y ago
I tend to think of it in terms of horses for courses. In other words, let your requirements drive your architectural choices, rather than going in with the preconceived notion that there are architectures 'no one needs'.
I recently threw together a small blog engine and wouldn't even have thought of writing it as an SPA... there was no point. Then again, a blog is mostly static document service, so it shouldn't be a surprise that picking a document service architecture made sense.
For me at least, some of the specific reasons to pick an SPA might be this:
* I'd like my user to be able to make change to a document without disrupting where they've scrolled in the document.
* It's possible to build retry logic into the SPA to get a bit of offline capability if the network connection isn't great.
* There's a block of data on a page that takes an unmanageably long time to render and I'm okay with it showing up after the body of the page.
* There's a large volume of data that can be maintained and incrementally updated within the client, rather than reload every time.
* There's a need to automatically stream and update the page in real time (and meta refresh, etc. won't work.)
* The developers assigned to the project are more comfortable with SPA and associated tooling.
* There is a high likelihood of one of the above becoming true soon enough that we wouldn't be able to rewrite to an SPA to accommodate the requirement when it arises.
Not exhaustive, but a big list anyway.... so there are often good reasons to select an SPA design. But not always. As engineers/architects, we have to do the work of understanding the requirements and planning our design..
- bunderbunder 8y agoMany of those serve as great examples of times when you might want to add AJAX-y elements to your design. I don't want to imply you were suggesting this, but it bears mentioning that a lot of the SPA vs MPA debate rests on a false dichotomy, where "MPA" is taken to imply that you're partying like it's 1999.
- mschaef 8y ago> I don't want to imply you were suggesting this Actually, I kinda was. Maybe a better way to put it is that I'm looking for more fluency of control in where the application code actually runs. I'm less interested in having 'an SPA' or 'an MPA' and more interested in tooling that makes it possible to more easily select between SPA and MPA characteristics for various parts of a given UI. Edit: to make this a bit more real, here's a few thoughts on what that might look like: * Same language on both client and server. * Same templating on both client and server. * Some sort of lightweight RPC-style mechanism for exposing server functionality up to the client. (Without a fully specified protocol/format/etc.) * Framework provides an endpoint that serves up a JavaScript projection/transpile of some subset of the overall application code. * Same thing for CSS. * The usual automatic reload/refresh-on-change logic you get with modern client stacks. * Setup is essentially 'add a plugin or maybe two to the project build script'.