this post was submitted on 14 Feb 2026
324 points (99.7% liked)

Programmer Humor

29716 readers
1144 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] cupcakezealot@piefed.blahaj.zone 31 points 11 hours ago (3 children)

i mean its still good to use an abstraction layer in case you ever have to change the underlying call; it's far easier to change it in one place instead of replacing every call

[–] Blue_Morpho@lemmy.world 12 points 9 hours ago (2 children)

Is this a joke?

If you need a different random function, you write a different random function either way. Having one function do nothing but call another function does nothing.

[–] loutr@sh.itjust.works 22 points 8 hours ago

There are several legit reasons why you'd do this. Unit tests, for example: override getRandom() with an implementation that always returns the same series of numbers, and now you have repeatable tests without touching the production code.

[–] x1gma@lemmy.world 4 points 7 hours ago

It's not about a different function providing different randomness, but providing a compatible implementation for environments not supporting the "regular" implementation.

If this screenshot is legit, I guarantee you that either the library is older and there was some weird branching for IE or it's brand new and had branching for the hot new JS runtime / cross compiling.

Supporting a metric fuckton of browsers and environments takes the same amount of shims.

[–] RickyRigatoni@piefed.social 6 points 8 hours ago

Just do a find and replace

[–] Hirom@beehaw.org 6 points 10 hours ago