Live data from Hacker News

Single Page Application Is Not a Silver Bullet

blog.bloomca.me

91–100 of 111 posts

Re: Single Page Application Is Not a Silver Bullet

#91
post #33

Tangential question: what is the best practice for handling authentication on a SPA? I have seen JWT being heavily criticized on HN and elsewhere. What is the alternative that still maintains the separation between front- and back-end?

Like anything else it depends. JWTs are still great. Just don’t treat it like a classical session and dump important information in it. You could also use session like you always have if the SPA is being served by the same server.

JWT is at the heart of OpenID connect, I agree they’re still perfectly reasonable.

The big issue I have with JWT is they are hard to invalidate for security reasons, but if you lower the validity and refresh the token more often you can mitigate (not eliminate) the risk.

Re: Single Page Application Is Not a Silver Bullet

#92
post #81
post #52

Earlier quoted context omitted.

I’ve used React in the past and I believe what you’re mentioning is very React specific. Angular has lazy and eager loading, which reduces bundle sizes. It also doesn’t require so many frameworks to manage manually. They are still there, but they are sort of imported automatically by angular cli so it doesn’t take a lot of mental overhead. Some issues I had, though, were with bugs in newer versions. Some of those iss…

is there a way for React to do eager loading? i asked around on twitter but got told "thats not React's job".

I think the react dev team is currently working on an official async loading pattern for a future update. But currently webpack, rollup, etc. offer dynamic import, code-splitting, tree-shaking

Re: Single Page Application Is Not a Silver Bullet

#93
post #84

Earlier quoted context omitted.

Sure there’s something to reimplement. Ensuring that changes to the view state are represented in the URL bar isn’t trivial. Should a popup dialog be reflected in the URL state? Should a confirmation prompt? What about browsing a hierarchy of menus? With web pages as documents that only use JavaScript to “decorate” things, you get this for free. And it’s likely aligned with what users expect.

I really don't understand where you're coming from. SPA routing is a solved problem. There are countless modern solutions that are not only trivial to use but offer bonus functionality over traditional approaches, such as isomorphic routing or controlling the state of individual components and elements with routes instead of entire pages. > Should a popup dialog be reflected in the URL state? Should a confirmation pr…

Terms like "solved problem" and "modern solutions" set off my BS detector. Doesn't the existence of countless solutions, rather than relying on built-in browser behavior, imply that it's not a solved problem?

No doubt single-page apps have their benefits, but there's an awful lot of new hotness kool-aid being passed around. The JS ecosystem is still suffering heavily from the inner platform effect.

Re: Single Page Application Is Not a Silver Bullet

#94

One of the ways that I prefer to judge a JavaScript framework is (1) what is the minimum payload to use it, and (2) how nicely does it play with a hybrid app? In practice I’ve found VueJS does pretty well in this regard. Rather than build a full SPA I can sprinkle a few components here and there on pages that are highly interactive. The rest of the mostly static screens on my app are perfectly happy to be rendered fr…

> Rather than build a full SPA I can sprinkle a few components here and there on pages that are highly interactive In practice, I've found "hybrid" apps hard to pull-off. In my experience, the question becomes, where do you draw the line? Take the simple/common case of presenting a list view. From the list, you want to allow the user to click to view details, which you then present dynamically--maybe in an overlay. I…

I have a hybrid app using reactjs. It's mainly used in very interactive/dynamic sections. It's used in pages where we want to present different data display based on device like in desktop we display grids but in Mobile is a single row list.

Re: Single Page Application Is Not a Silver Bullet

#95
post #84

Earlier quoted context omitted.

I really don't understand where you're coming from. SPA routing is a solved problem. There are countless modern solutions that are not only trivial to use but offer bonus functionality over traditional approaches, such as isomorphic routing or controlling the state of individual components and elements with routes instead of entire pages. > Should a popup dialog be reflected in the URL state? Should a confirmation pr…

Terms like "solved problem" and "modern solutions" set off my BS detector. Doesn't the existence of countless solutions, rather than relying on built-in browser behavior, imply that it's not a solved problem? No doubt single-page apps have their benefits, but there's an awful lot of new hotness kool-aid being passed around. The JS ecosystem is still suffering heavily from the inner platform effect.

This is a strange comment thread as it seems everyone is talking past each other.

Browsers can only navigate via URLs. Traditionally these pages are rendered completely on the server but SPA's can just as easily load the appropriate page based on the URL, it's just done on the client and requires routing to be setup.

Whether it's actually setup like that is up to the developers to do, as many don't use routing for all inner pages. If they don't put in that effort then there are no URLs to navigate directly and thus there is nothing for a browser to do to open a new window/tab. Routing is a solved problem and is purely about implementation.

Re: Single Page Application Is Not a Silver Bullet

#96
been a victim of shit corporate SPAs

1. tons of widgets/slides/inputs in one single page

2. click submit -> error -> go back -> all filled info gone

3. cant open links in new tabs

4. cant copy shit off the inputs because text was in some kind of fake div with v-data attribute with disabled cursor movements. Had to use devtools to copy shit

5. Naturally, cant paste shit. Had to manually type MD5 checksums.

6. Always got redirect to home page after login

7. Broken links everywhere. Cant restore page state via link. IDK if this page is broken or still ajax in-progress. Had to open devtools to see if there's any js errors

8. If page is broken, refresh, boom, all your typed contents and procedures are gone.

I think if people cant make a proper "multi" page form based web application, they should not be allowed to engage SPA at all.

Re: Single Page Application Is Not a Silver Bullet

#97
post #81

Earlier quoted context omitted.

is there a way for React to do eager loading? i asked around on twitter but got told "thats not React's job".

I think the react dev team is currently working on an official async loading pattern for a future update. But currently webpack, rollup, etc. offer dynamic import, code-splitting, tree-shaking

Not sure if that's what you mean, but when Andrew Clark keeps mentioning the "async" word, he means async rendering, not async loading.

Re: Single Page Application Is Not a Silver Bullet

#98
post #38

Earlier quoted context omitted.

> I'd about say the opposite. > Organizing...into meaningful classes and keeping the whole thing...orchestrated is very much the essence of programming > Filling in some templates causing magic to happen behind the scenes on the other hand, not so much. I'd agree and add that the different perspectives might be in large part due to the shift in programming away from procedural/code to declarative over the last decade…

lol you caught me, I'm old. I'm all in favor of what's fast and easy. So many jQuery messes have almost given me PTSD. So not knocking frameworks in any way. It's just weird to me someone would suggest using them is "more like real programming". No, it's more like one of those paint by number kits rather than a blank canvas and some paint. Of course many people are going to get better results with the paint by number…

>lol you caught me, I'm old

Ha! Only because I can totally relate my friend. Been in the game a while myself. That really is how I can identify with what you're saying.

And, you know what? We're right! Adding an attribute to an HTML-like component tag is not programming, no matter who insists it to be so. That's not to say there's no value to such approaches, but it still doesn't make it coding.

Was talking to another coder friend a while back and we agreed the game has changed: it's more about integrating pieces into a whole than writing swaths of logic. In other words, "coding" is now more assembling than construction.

It's possibly (but not categorically) more productive and it may represent "progress" by some measures, but it is still ironic to hear that referred to as programming over actual programming.

Re: Single Page Application Is Not a Silver Bullet

#99

I always thought the decision was: - Content site = NOT single-page-app - Application = single-page-app Maybe there's more of a gray area between content sites and applications these days, but I think it's still pretty obvious: If most of the user's time is spent reading content, it's a content site.

The problem is even content is becoming functional with interactive charts, infographics and figures, videos, media, filtering, sorting - then the site will eventually need comments, ads, subscribing, favoriting, upvoting, login, lazy load next article, infinite scroll, etc. Yes, a pure content site shouldn't be an spa, but how long can you survive running a pure content site? Information is complex and the web allow…

The problem is, this can all be solved with just a little bit of javascript to make interactive charts, infographics and figures, videos, media, filtering, sorting - then you can still serve static comments, ads, subscribing, favoriting, upvoting, login.
Post reply on HN