this post was submitted on 30 Aug 2026
881 points (98.5% liked)

Programmer Humor

33128 readers
30 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 3 years ago
MODERATORS
 
(page 3) 50 comments
sorted by: hot top controversial new old
[–] ThatGuy46475@lemmy.world 235 points 1 week ago (10 children)

A group of researchers was studying how different people solve problems. They gathered a physicist, a mathematician, and an engineer and gave them each a problem: find the volume of a red sphere. The mathematician solves it first. Asked how, he explains that he used a simple formula. The physicist solves it next. Asked how, he explains that he submerged the sphere in water and measured the rise in water level. Hours later, they find the engineer buried in paperwork. Asked about his progress, he says “I can only find a table of values for the volume of blue spheres.”

[–] NaibofTabr@infosec.pub 158 points 1 week ago* (last edited 1 week ago) (2 children)

On further inspection, it was found that the mathematician had assumed an ideal sphere of constant radius, while the real object was in fact oblate. The mathematician had neglected to take any measurements, leading to an incorrect value. The physicist's answer was correct, but only at sea level at nominal temperature.

The engineer is currently using calipers to measure the diameter of the object at many different angles in order to build a CAD model. He said we could expect results next year.

[–] tyler@programming.dev 78 points 1 week ago (3 children)

The physicist’s answer would be correct anywhere, no matter the temperature or density of the fluid.

[–] montechristo@feddit.org 32 points 1 week ago

Supposing that the measurements with and without the sphere are taken under identical circumstances. But you deserve the upvote either way.

[–] OwOarchist@pawb.social 21 points 1 week ago* (last edited 1 week ago)

Interestingly, the physicist's answer would always be correct, but not always consistent.

If the sphere is compressible, then air pressure will slightly affect its volume. And unless the thermal expansion rate of the sphere is zero, the amount of fluid displaced will also vary with temperature.

However, even if the physicist gets different answers in different environments, it's always still a correct answer, because they correctly measured the volume of the sphere at that time.

[–] untorquer@quokk.au 14 points 1 week ago* (last edited 1 week ago) (6 children)

Assuming the time between submersion and observation is greater than zero, increasing temperatures above boiling would give increasing error.

Conversely the physicist may get other error at/near freezing.

And yet another option is the fluid being above the Ball's melting and/or boiling point, assuming changes in density with phase change.

[–] cloudshouter@lemmy.zip 14 points 1 week ago (1 children)

They just said the ball was red, they didn’t say why…

load more comments (1 replies)
[–] Aqivex@fedinsfw.app 11 points 1 week ago (2 children)

All of which the physicist can trivially account for, control and variable test around, should the requested question be updated to require it.

The requested question did not include "In all possible scenarios", thus determining the volume of the sphere via physics calculation at the most average of conditions, is the most correct valid solution, absent further requirement parameters.

load more comments (2 replies)
load more comments (4 replies)
load more comments (1 replies)

They later added an Anthropologist, who understood that more questions needed to be asked. His first question was "do you want fries with that?"

load more comments (8 replies)
[–] BCsven@lemmy.ca 93 points 1 week ago (7 children)

Ha. I had a convo with a programmer in the 90s. He was explaining a complex problem and the steps to solve in the code, to adjust things based on user choices and parameters.

And I said why wouldn't you presolve all of them and then provide a lookup to go get the solution from a list. And he just looked stunned and walked away.

[–] Thorry@feddit.org 49 points 1 week ago (5 children)

Reminds me of the first time I saw Sin and Cos lookup tables being used in early 3D gaming. The computers could calculate those just fine, especially with a math co-processor. But for 3D gaming it would be too slow to get a good framerate. So lookup tables were used to greatly improve the speed.

Back on those days all sort of neat tricks like that would be used. Often done as little demo programs that were very impressive. Before the internet it was hard to look up something like that and the latest and greatest tricks weren't written in books yet. So often little code snippets and demo programs would be shared amongst programmers using the sneakernet, so we could all learn and get better.

[–] xthexder@l.sw0.com 20 points 1 week ago (1 children)

Trigonometry functions are still just a hardware lookup table in most scenarios I believe. One example I've noticed is that you'll get slightly different sin/cos results on AMD vs Nvidia GPUs due to either different lookup table values, or different interpolation functions being applied on top (I'm not sure it's possible to know for sure exactly which without internal knowledge)

[–] gens@programming.dev 8 points 1 week ago

For cpu sine is in code. X87 has a FSIN, but nobody uses it. Afaik it's just worse. Idk about gpus or if there's a standard like there is for floats in general (ieee754).

load more comments (4 replies)
[–] Sludge@sh.itjust.works 17 points 1 week ago

Ah my prior manager suggested something similar... Dynamic views that would adjust based on user set parameters... We set up canned views and called it a day.

He was let go, but always pushed for the art of the possible (even if it would take a few extra sprints to wrap)

[–] OwOarchist@pawb.social 12 points 1 week ago* (last edited 1 week ago) (1 children)

It's possible that the dynamic generation might be more maintainable than a lookup list, though.

With a lookup list, you may need to recalculate the whole thing every time you make a small change. And a significant change, like giving the user a new choice/parameter to adjust, may not only require recalculating the lookup table, but also exponentially increasing the size of the lookup table.

Whereas with a dynamically generated result, small adjustments to the values likely wouldn't require any modification of the actual code at all, and adding a new choice/parameter would be fairly straightforward -- it just needs to be plugged into the formula, maybe add an extra step or two in the algorithm.

[–] BCsven@lemmy.ca 11 points 1 week ago

It was finite, and early 90s. Calculation time is something you wanted to avoid. To put it to an analogy: you could calculate if a 3d X can be manipulated through a hole, or you can just prr evaluate and say Yes or no based on size, rather than running permutations on 6 axis of movement

load more comments (4 replies)
[–] thenextguy@sh.itjust.works 90 points 1 week ago (1 children)

I would say Computer Scientist in place of software engineer.

[–] baggachipz@sh.itjust.works 48 points 1 week ago (7 children)

Yeah, software engineers are the sanitation engineers of programming. Source: am one

[–] surewhynotlem@lemmy.world 20 points 1 week ago (1 children)

Scientists research. Engineers do. We are the more practical of the two.

[–] Omgpwnies@lemmy.world 16 points 1 week ago (2 children)

Also, any CompSci grad I've worked with couldn't write code for shit unless they learned how outside of their schooling, and yet so many go the CompSci -> programmer route instead of doing like SW Eng or something like that.

load more comments (2 replies)
load more comments (6 replies)
[–] Stache_@lemmy.ml 80 points 1 week ago* (last edited 1 week ago) (2 children)

Red thinks you’re making up words Red thinks you’re making up words

[–] tetris11@feddit.uk 1 points 6 days ago

I think it means when the method is barely better O(Exp), even on ordered sets

load more comments (1 replies)
[–] procrastitron@lemmy.world 59 points 1 week ago

B.S.

Dijkstra would have loved the lookup table solution.

He HATED complexity.

[–] serenissi@lemmy.world 43 points 1 week ago (2 children)

disappointing. no such algorithm.

yeah I looked it up

load more comments (2 replies)
[–] henfredemars@infosec.pub 40 points 1 week ago (2 children)

It really depends on what you're building. In an embedded shop, lookup tables are first class solutions to most problems. Computer scientists though, 100%!

[–] mushroommunk@lemmy.today 42 points 1 week ago (5 children)

Depends on the available memory and size of the tables. I've worked on cases where time to compute didn't matter as much as shaving off three more bytes did. Large lookup tables would have absolutely killed us compared to running some math.

[–] henfredemars@infosec.pub 16 points 1 week ago (1 children)

Good point! Good point.

I've seen bubble sort implemented because we had data that said it was faster and was slightly smaller for the exact type data we were sorting and its expected distribution.

[–] disorderly@lemmy.world 23 points 1 week ago

I fondly remember the time I hired a QT expert onto an embedded app team and on his first project he imported a sort algorithm from std. He found the system got weird and glitchy, and often crashed.

Yeahhh turns out the algorithm he chose needed to make a copy in memory and the thread he was working in only had 2048 bytes of stack, so larger inputs would corrupt the stack allocated to the next thread. I had to explain to him that we had a full second to complete the math before we had to give back our semaphore, so saving a couple milliseconds on the sort was not a priority. Fun times.

load more comments (4 replies)
[–] rtxn@lemmy.world 16 points 1 week ago* (last edited 1 week ago)

IIRC, Elite used lookup tables for trigonometric functions on certain target platforms (maybe the NES) because memory wasn't as much of a constraint as computing performance. It's a barrel of game compressed into a pint of code.

[–] Warl0k3@lemmy.world 30 points 1 week ago* (last edited 1 week ago) (2 children)

When I was a kid and my mother was teaching me to read SQL, she really drove home that Elegance is in the eye of the beholder. While a C++ dev finds beauty in reducing a signal processing step to O(n) by recursing through five lines of bitwise ingenuity, a SQL dev finds radiance in completing the task without using any loops at all.

[–] Dimantina@lemmy.world 20 points 1 week ago

Alright to anyone who would question this statement. I am a mom, and have had extremely similar conversations with my kid regarding programming and perspectives.

Seriously it's important for problem solving to not get caught up in perfect solutions or solutions you think are the right path be cause of your own bias'.

Sometimes to solve a problem you are stuck on, or is proving too challenging the best course of action is to figure out why you are trying to solve it that way, and what other solutions there might be.

[–] hemko@lemmy.dbzer0.com 15 points 1 week ago (7 children)

When I was a kid and my mother was teaching me to read SQL

Why would a mother do this, I'm horrified

[–] Warl0k3@lemmy.world 17 points 1 week ago* (last edited 1 week ago)

In the case of my mother, she's pretty autistic and a very well known data scientist. This was her way of teaching me how she relates to the world - I'm quite grateful to her for it; it has given me a love of programming and allowed me get a great deal closer with her.

My mom taught me ORM. I'd rather have had the SQL mom.

load more comments (5 replies)
[–] Yaky@slrpnk.net 26 points 1 week ago (1 children)

I expected the bottom to say something like "instead of cloud-native scalable microservices using AI models that cost an average US household salary per day to run", but maybe I've been in corporate for too long.

load more comments (1 replies)
[–] Zachariah@lemmy.world 20 points 1 week ago
[–] goatinspace@feddit.org 20 points 1 week ago
[–] SatyrSack@quokk.au 16 points 1 week ago (1 children)
load more comments (1 replies)
[–] Jankatarch@lemmy.world 12 points 1 week ago

I am torn between this and "AAA videogames should be optimized more."

[–] mlg@lemmy.world 12 points 1 week ago (1 children)

Remember the olden C days before compilers got really good (and freely available) so we'd still have inline assembly everywhere for better optimization lol.

[–] OwOarchist@pawb.social 8 points 1 week ago (3 children)

And then there's good old Chris Sawyer, writing an entire (fairly complex) game completely in Assembly, because he wanted the (actually kind of computationally heavy) game to still work on potato hardware.

load more comments (3 replies)
[–] tatterdemalion@programming.dev 10 points 1 week ago
[–] Flower@sh.itjust.works 9 points 1 week ago

The solution that I know my colleagues can maintain in the future.

load more comments
view more: ‹ prev next ›