this post was submitted on 03 Feb 2024
275 points (100.0% liked)

Programmer Humor

853 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 42 comments
sorted by: hot top controversial new old
[–] trucy@lemmy.blahaj.zone 63 points 9 months ago (1 children)

I FUCKING LOVE STATIC HTML PAGES

I LOVE NOT HAVING TO RELY ON SCRIPTS TO DISPLAY CONTENT

[–] xthexder@l.sw0.com 40 points 9 months ago

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

[–] dan@upvote.au 60 points 9 months ago* (last edited 9 months ago) (6 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 25 points 9 months 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 12 points 9 months ago (3 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

[–] Ephera@lemmy.ml 8 points 9 months 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 5 points 9 months 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 4 points 9 months 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 3 points 9 months ago (1 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. 🫠

[–] llii@feddit.de 3 points 9 months ago (1 children)

Ok, that's unfortunate. But I agree, the browsers default keybindings really shouldn't be broken it's really annoying. I hate it when middle click doesn't work with some web pages. 😒

[–] ICastFist@programming.dev 3 points 9 months ago

It really sucks when they break "open link in new tab". I then have follow the stupid link, then middle click the back button to do what they broke.

[–] NotJustForMe@lemmy.ml 8 points 9 months 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 12 points 9 months 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 5 points 9 months ago

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

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

Just here representing the Cmd+[ gang

[–] docAvid@midwest.social 2 points 9 months ago

Ctrl+[ here

[–] toastal@lemmy.ml 3 points 9 months ago (1 children)

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

[–] Trarmp@feddit.nl 1 points 9 months ago (1 children)

I maintain a couple of Wordpress installations for clients, where new link targets are the same page, as you'd expect.

They still, somehow, manually check "link opens in new tab". I don't know why some of these boomers are allowed to use computers, I swear.

[–] toastal@lemmy.ml 2 points 9 months ago (1 children)

If you manage the WordPress installation, can’t you disable the ability or create/install a plugin that removes that ability? This hurts usability.

[–] Trarmp@feddit.nl 2 points 8 months ago (1 children)

I could, good point. I do disable plugins for clients so they can't beat up their own website too much.

Still, there are legitimate uses for opening a site in a new tab; e.g. when it's an external website. I don't think I should automate that, since there's a granularity in there.

[–] toastal@lemmy.ml 1 points 8 months ago* (last edited 8 months ago)

legitimate uses for opening a site in a new tab; e.g. when it's an external website

This is not a legitimate use—this breaks the default user agent behavior & completely removes the autonomy of opening in the current window (there are tons of ways to open in a new tab/window). Consider rechecking the article linked higher up the thread tree.

load more comments (4 replies)
[–] andrew@lemmy.stuart.fun 44 points 9 months ago (3 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.

load more comments (3 replies)
[–] astrsk@kbin.social 34 points 9 months ago
[–] toastal@lemmy.ml 18 points 9 months ago

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.

[–] DmMacniel@feddit.de 15 points 9 months 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 15 points 9 months 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 👍

[–] rwhitisissle@lemmy.ml 12 points 9 months ago (1 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.

[–] BedSharkPal@lemmy.ca 3 points 9 months ago (1 children)

Not sure I would call HTMX a SPA framework though? Like it all's easy async content fetching for sure, but it's usually done across a MPA?

[–] rwhitisissle@lemmy.ml 1 points 9 months ago (1 children)

Where did I call it a framework?

[–] BedSharkPal@lemmy.ca 1 points 9 months ago (1 children)

Sure, wrong term. I think my point still stands though. A SPA is *generally *"rehydrated" DOM elements from JSON data pulled from an API though. Where as HTMX is more akin to classic AJAX style page dynamism.

[–] rwhitisissle@lemmy.ml 1 points 9 months ago* (last edited 9 months ago) (1 children)

A SPA is *generally *“rehydrated” DOM elements from JSON data pulled from an API though. Where as HTMX is more akin to classic AJAX style page dynamism.

You'll forgive me if I say this is an instance of splitting hairs and having a particular definition for something that includes extra qualities separate from what those terms are actually describing for most people. Also, things like, I dunno, React, are going to extensively use ajax to accomplish what they do. It's literally just asynchronous javascript. It's like someone saying "my vehicle of choice is a motorcycle" and then someone else saying "A motorcycle isn't really a vehicle. It's a transportation device with wheels. A car is a vehicle." They are both vehicles. They both have wheels. The wheels are ajax. A page made with htmx and a page made with React are both SPAs.

[–] BedSharkPal@lemmy.ca 2 points 9 months ago (1 children)

My point is just that I think to most people, HTMX doesn't create what is classically considered to be a SPA any more than older MPA's that called utilized AJAX would be. There's a reason those old-style pages aren't really considered SPA's. Is it splitting hairs? Absolutely.

[–] rwhitisissle@lemmy.ml 1 points 9 months ago

I think we're gonna have to agree to disagree on definitions. To me, and I believe, to most people, an SPA refers to a UI/UX design pattern that can be implemented with any number of underlying techniques. I would also say that the Wikipedia page for SPAs (on the assumption that wikipedia is a valid tool for establishing consensus for definitions) supports my definition:

A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current web page with new data from the web server, instead of the default method of a web browser loading entire new pages.

There are various techniques available that enable the browser to retain a single page even when the application requires server communication.

And it goes on to list frameworks, AJAX, Websockets, etc.

[–] nayminlwin@lemmy.ml 5 points 9 months ago

I think SPAs really only work for offline PWAs.

[–] intensely_human@lemm.ee 4 points 9 months 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 9 months ago

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

[–] EpicVision@monero.town 0 points 9 months ago (1 children)

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

[–] intensely_human@lemm.ee 0 points 9 months ago

If you’re using a router you can still support opening in new tab, history, etc.