by pier25 · 7y ago · 0 comments
For 5 or so years I've been the guy who immediately started a SPA and I've turned 180 degrees. I now think SPAs are basically a cancer, with some exceptions where an app-like website is justified (Gmail, etc) or a hybrid app. SPAs introduce unnecessary complexity and bloat for the vast majority of use cases.
Jesus Christ what is going on with the web.
> You still can't just search and be using a new application nearly immediately.
You can't? I sure can. Gnome, kde, and Mac all have great ways of searching through your apps. The windows search is a little crap.
But the great thing about a local, native environment is that the user is actually in control. If there is an app I need quick access to, I can map it to a shortcut or desktop icon. That's way faster that searching and scrolling through results.
From my non web dev perspective, the reason there is such a proliferation of bloated web apps is because of the devs. All of a sudden we have a ton of developers with little to no formal training who want to make cool apps instead of good products. So they layer on plenty of dependencies. And when there's a Cool New Framework© next week, they'll incorporate that too.
I just don't think devs have performance and user experience as number one priorities. The web will always be horribly slow compared to an SSD. In my opinion, the web has a couple of other fatal flaws that make it inferior to native for applications. But if we do want the web to be where all our applications to live anyway, we need to be concerned about performance as a high priority.
This is a nice idea, but it’s far faster to search with mail.app. The great thing about gmail is just labels.
I've had similar experiences with scaling too early into microservices for example. I need a seriously compelling reason to consider building around these paradigms now. The overhead is unreal.
Both great ways to solve a problem, but not really a problem I've yet encountered - ever.
I'm still glad I've had great opportunities to learn this, at least.
And with WebComponents being supported across the board, even less so.
`document.querySelector('div').someProperty = {some: 'value'};`
For DOM updates you will generally use a declarative DOM rendering engine like lit-html, just like how you use React's VirtualDOM. In fact, the most popular Web Component "library" [LitElement](https://lit-element.polymer-project.org/) uses very simlar vernacular as React (like the `render()` method), and from a developer perspective feels exactly like using React, except it relies more on builtin platform features.
Everyone else is just embracing them.
A small demo https://jsfiddle.net/zu52o7bq/.
My current side project is a HTML sprinkled with JS, turn off JS and you can use most of the site kind of thing. Why? Because ... well mainly SEO to be honest. But there you go ... reasons!
It does. But, depending on how you look at it, either most web companies absolutely suck at picking right tool for the job, or the job isn't really what you'd think it is.
Taking your typical plain webpage done as an SPA, you could either say (as I would) that the authors picked wrong tool for the job, introducing completely unnecessary complexity both on their end and customer end - or, you could tell that the job of that website isn't to be useful to and considerate of the visitor, but to be e.g. CV-fodder for web developers, a way for the team to show off their sophisticated infrastructure, or for the marketing to play their A/B testing shenanigans, or for the company to show off to the investors, etc.
Once you account for all the "parts of the job" that are orthogonal or even opposite to delivering value to users, suddenly a proliferation of frontend complexity makes perfect sense.
Now onto the js frameworks, it depends on which one is used. One could build a website watching web.dev and use a budget to make sure it's app is lightweight. There are numerous tools to make sure an app is properly made. But tbh, I like my js framework because the community is so great, I know the framework is good even tough there are arguments there and there.
I guess it all depends on the tool you choose and how you build your end product. Now having a website that loads in 30s is a joke I haven't experienced in the modern web, and my js framework actually provides a powerful caching system that makes the website available even tough I could bring down my dns. To this point I presume we are just in a odd point in web evolution where we have discovered a new paradigm and rushed into it's usage without maturity.
These things will change but I think it is important to know that some JS front framework are not incompatible with a lightweight web.
The problem is that most of the popular frameworks today add unnecessary complexity.
I still can't believe that we live in a world were most developers are OK to coding with a 5 to 15 second build delay and source mapping during development. I find is extremely frustrating. It slows me down and breaks my train of thought.
Like? I am curious: built a few SPAs (quite complex ones) and it sucked; I got the tools/frameworks from HN.
If you use the right tools ‘tradional’ websites are not complex either.
I think SPAs are good when you have to handle a lot of dynamic data. Especially realtime data.
I built a sample SPA with VueJS, Asyngular and RethinkDB to demo how easy it is.
It's a relatively complex app where all the views update in realtime but all the server code is less than 300 lines.
The framework does most of the work; on the back end, all you need to do is define the data schema and access control rules on the server side. See https://github.com/SocketCluster/ag-crud-sample/blob/6805499...
For the front end, I use VueJS in the simplest possible way without any build step during development. I just define my main app component and setup a component for each page: https://github.com/SocketCluster/ag-crud-sample/blob/master/...
For data, I just use my own model and collection components to bind to the server data in real-time: https://github.com/SocketCluster/ag-crud-sample/blob/master/...
The collection component lets you bind to a 'view' which is declared in the schema on the server.
It's just CRUD with realtime subscriptions built into the model and collection objects, nothing special.
You can achieve a lot more if you just keep things simple (at least conceptually) and use the right tools.