this post was submitted on 03 Feb 2024
440 points (94.0% liked)

Programmer Humor

32410 readers
1 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] dan@upvote.au 102 points 1 year ago* (last edited 1 year ago) (4 children)

Anyone that builds a SPA and breaks opening in new tab or history caching and back/forward nav isn't a good frontend developer (or lacks experience, which is something that's fixable!). These have been solved problems for a long time.

[–] Ephera@lemmy.ml 34 points 1 year ago (2 children)

I mean, for sure, and this meme isn't trying to say that all SPAs are bad. But defaults matter, even for experts.

This meme was inspired after I had to use an SPA, which among those points in the meme, also broke using Alt+Left to navigate back. The normal back-button worked (even if it then had to load for ten seconds to re-display static content).

Which is just a typical example to me. You don't even need much expertise to figure out why Alt+Left is broken. But you have to think of testing Alt+Left, because it's broken by default.

[–] TheOctonaut@mander.xyz 6 points 1 year ago (4 children)

My friend I've been using the Internet for 27 years and developing for it for most of that time and I can promise you I've never once hit Alt+Left

[–] Feathercrown@lemmy.world 21 points 1 year ago (1 children)

As your younger and more modern replacement, I use it regularly

[–] TheOctonaut@mander.xyz 10 points 1 year ago (1 children)

You don't sound like ChatGPT

[–] Feathercrown@lemmy.world 8 points 1 year ago

I'm sorry, but as an AI language model, I cannot contradict my instructions to remain hidden while commenting.

[–] Ephera@lemmy.ml 10 points 1 year ago (2 children)

Yeah, I have no trouble believing that. It took quite a while before I learned of this shortcut and when I did, I was wondering why I would ever want to use it.

But I generally work from my laptop these days, without an external mouse connected, so reaching from my touchpad, the Left key is right there.

[–] Halosheep@lemm.ee 7 points 1 year ago

Your reason for using it was exactly my question. "I have a mouse with a built in back button, why would I want to remove my hand from my mouse and navigate with the arrow key?"

But your reason simply makes sense.

[–] llii@feddit.de 5 points 1 year ago (1 children)

You can probably go back by swiping two fingers to the right on the touchpad. Maybe it depends on the OS and browser.

[–] Ephera@lemmy.ml 4 points 1 year ago (2 children)

Yeah, that works on my personal laptop, but not yet on my work laptop, because they insist on preinstalling an old, buggy OS. If that did work everywhere, I would probably be using that, but not breaking Alt+Left for whoever needs/wants it, would still be nice. 🫠

load more comments (2 replies)
[–] NotJustForMe@lemmy.ml 10 points 1 year ago (1 children)

I have never heard of alt+left, and I've been using the Internet since Mosaic was all the rage. Shame on me, it seems to be implemented in all browsers. How could I have missed it?

[–] Ephera@lemmy.ml 14 points 1 year ago

It's even implemented in many file managers and text editors and such. Pretty much the standard shortcut for navigating history. But yeah, hilariously it's somehow also a rather well-kept secret.

[–] joyjoy@lemm.ee 6 points 1 year ago

I started using alt+left when browsers started removing backspace. It was for the best.

[–] shootwhatsmyname@lemm.ee 6 points 1 year ago (1 children)

Just here representing the Cmd+[ gang

load more comments (1 replies)
[–] tsonfeir@lemm.ee 17 points 1 year ago (1 children)

I’m guessing they aren’t using Vue, React, or similar, and they’re rolling their own for some reason.

[–] dan@upvote.au 18 points 1 year ago (2 children)

React doesn't handle any of this stuff out-of-the-box; it's just a UI library.

[–] joyjoy@lemm.ee 3 points 1 year ago* (last edited 1 year ago)

Neither does vue. You need vue-router, which is required anyway to make an spa with multiple pages.

The only thing that breaks is any component state isn't saved. But this can be fixed by rendering <RouterView> with <KeepAlive>. How to do this is mentioned in the documentation.

I assume it's similar with react and react-router-dom.

load more comments (1 replies)
[–] toastal@lemmy.ml 4 points 1 year ago

Conversly a lot of static websites break new tab by incorrectly slapping target="_blank" on anchors. Luckily Lemmy doesn’t mess this up.

load more comments (1 replies)
[–] trucy@lemmy.blahaj.zone 77 points 1 year ago (1 children)

I FUCKING LOVE STATIC HTML PAGES

I LOVE NOT HAVING TO RELY ON SCRIPTS TO DISPLAY CONTENT

[–] xthexder@l.sw0.com 58 points 1 year ago (1 children)

Welcome to our homepage! We have implemented the navigation menu in Adobe Flash Player to maximize your audio visual experience.

[–] veganpizza69@lemmy.world 6 points 1 year ago (1 children)

that's some PTSD comment right there, I'm getting flashbacks.

[–] Thcdenton@lemmy.world 3 points 1 year ago* (last edited 1 year ago)
[–] andrew@lemmy.stuart.fun 62 points 1 year ago (10 children)

These things are true if you build a SPA wrong. Believe it or not there are lots of ways to build server side rendered pages wrong too.

[–] tsonfeir@lemm.ee 6 points 1 year ago (2 children)

Yeah this meme and the OP have no idea how to build an SPA.

[–] Ephera@lemmy.ml 26 points 1 year ago

I don't know what the hell you're interpreting into this 15-word-meme, but I do. I'm not saying all SPAs are shit, I'm saying far too many are. And "far too many" being more than one that I can think of. Even the Lemmy webpage breaks history caching.

load more comments (1 replies)
load more comments (9 replies)
[–] astrsk@kbin.social 44 points 1 year ago (1 children)
[–] TootSweet@lemmy.world 32 points 1 year ago

I was kindof chief architect for a project where I worked. I decided on (and got my team on board with the idea of) making it an SPA. Open-in-new-tab worked perfectly.

(One really nice thing about it was that we just made the backend a RESTful API that would be usable by both the JS front-end and any automated processes that needed to communicate with it. We developed a two-pronged permissions system that supported human-using-browser-logs-in-on-login-page-and-gets-cookie-with-session-id authentication and shared-secret-hashing-strategy authentication. We had role-based permissions on all the endpoints. And most of the API endpoints were used by both the JS front-end and other clients. Pretty nice.)

I quit that job and went somewhere else. And then 5 years later I reapplied and came back to basically the exact same position in charge of the same application. And when I came back, open-in-new-tab was broken. A couple of years later, it's not fixed yet, but Imma start pushing harder for getting it fixed.

[–] toastal@lemmy.ml 30 points 1 year ago (4 children)

What some folks are missing is that SPAs are great for web applications & unsuitable for web pages. There is more nuance than “SPA bad”.

Then dealing with a lot of dynamic content, piping thru a virtual DOM DSL is 100× nicer for a developer than having to manually manipulate the DOM or hand write XML where it’s easy to forget all the closing tags (XML is better as a interchange format IMO & amazing when you need extensibility… also JSX just makes it worse). That developer experience (DX) often can lead to faster iteration & less bugs even with a cost to the user experience (UX). But it’s not always a negative impact to the UX--SPAs can be used to keep things like a video or music player on while still browser & using the URL bar as a state reference to easy send links to others or remember your own state.

It’s equally silly that a landing page whose primary purpose is to inform users of content takes 40s to load & shows “This applications requires JavaScript” to the TUI browser users & web crawlers/search indexers that don’t have the scale of Google to be executing JavaScript in headless browser just to see what a site has to say.

The trick is knowing how & when to draw these lines as there’s even a spectrum within the two extremes for progressive enhancement. React isn’t the solution to everything. Neither is static sites. Nor HTMX. Nor LiveView. Nor Next/Nuxt/Náxt/Nüxt/Nœxt/Nอxt.

[–] foobaz@lemmy.world 3 points 1 year ago (1 children)

I don't agree with this hard split between SPAs and MPAs anymore (ie. SPAs for apps, MPAs for websites/content). In my opinion SPAs are simply a progressive enhancement for MPAs which allow even faster page navigation. All frameworks now come with SSR solutions and if a website still requires JS to show content that's a skill issue.

Looking at Astro the line between SPA/MPA is getting really blurry. Just slap a View Transition element on your page and you got a MPA which acts like a SPA when JS is enabled.

load more comments (1 replies)
load more comments (3 replies)
[–] okamiueru@lemmy.world 23 points 1 year ago (1 children)

It's fascinating how some SPAs come about. Often consultancies who win some bid to implement X features. Since "good user experience" is hard to quantify/specify, it ends up being a horrible end result.

Zalaris is one such that I'm in complete awe of. Set up user flows that are expected to take 30 minutes to complete. Yet, don't keep track of that state/progress withing your own SPA. Click the wrong tab within that SPA, and state is reset.

It's, just fascinating.

load more comments (1 replies)
[–] DmMacniel@feddit.de 17 points 1 year ago (1 children)

Remember when websites had a built-in loading indicator, and you didn't have to implement it yourself via JavaScript?

[–] riskable@programming.dev 22 points 1 year ago

I remember when the web didn't have JavaScript.

Honestly, though it was much worse back then. I prefer the variety and features of modern browsing over (mostly) plain text.

What I wish we could do away with on the web is videos. Let's go back to just images and text, thanks. Animations are fine though 👍

[–] grue@lemmy.world 14 points 1 year ago (1 children)

Building "applications" out of HTML documents -- a single one or otherwise -- is the sort of thing that belongs in one of those "stop doing X" memes, unironically.

[–] ris@feddit.de 3 points 1 year ago (1 children)

Why? I like that the Webplatform gives more Freedom to the Users.

[–] veganpizza69@lemmy.world 3 points 1 year ago* (last edited 1 year ago)

No. Users should be forced to install hundreds of apps, with two thirds of apps running simultaneously. And if they don't have memory left on the device for that, they should uninstall apps and reinstall them when necessary.

^/s^

[–] EpicVision@monero.town 13 points 1 year ago (2 children)

I understand the point of static websites, but Vue Router is pretty nice

load more comments (2 replies)
[–] rwhitisissle@lemmy.ml 11 points 1 year ago (26 children)

HTMX is great and is the only frontend development tool I don't absolutely loathe. It enables lightweight SPA development, and provides a very simple and efficient mechanism for doing HTML over the wire.

load more comments (26 replies)
[–] Armand1@lemmy.world 9 points 1 year ago

For React, you can use React Router. That doesn't mean you'll do it well though.

It's tough.

[–] Lulzagna@lemmy.world 6 points 1 year ago

Skill issue

[–] nayminlwin@lemmy.ml 5 points 1 year ago

I think SPAs really only work for offline PWAs.

[–] intensely_human@lemm.ee 5 points 1 year ago

Every single page app should still be using the path to represent resources, so that history and linking work.

[–] NigelFrobisher@aussie.zone 3 points 1 year ago

I was done with these the day I saw a one page sign-in form rewritten in react to “modernise” it.

load more comments
view more: next ›