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

Programmer Humor

33218 readers
1272 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
top 50 comments
sorted by: hot top controversial new old
[–] ThatGuy46475@lemmy.world 235 points 2 weeks 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 2 weeks ago* (last edited 2 weeks 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 2 weeks 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 2 weeks 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 2 weeks ago* (last edited 2 weeks 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 2 weeks ago* (last edited 2 weeks 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 2 weeks 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 2 weeks 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)
[–] ChickenLadyLovesLife@lemmy.world 17 points 2 weeks ago

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 2 weeks 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 50 points 2 weeks 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 2 weeks 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)

load more comments (1 replies)
load more comments (4 replies)
[–] Sludge@sh.itjust.works 17 points 2 weeks 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 2 weeks ago* (last edited 2 weeks 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 2 weeks 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 2 weeks ago (1 children)

I would say Computer Scientist in place of software engineer.

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

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

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

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

[–] Omgpwnies@lemmy.world 16 points 2 weeks 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 2 weeks ago* (last edited 2 weeks ago) (2 children)

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

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

B.S.

Dijkstra would have loved the lookup table solution.

He HATED complexity.

[–] anon_8675309@lemmy.world 49 points 2 weeks ago* (last edited 2 weeks ago)

Everyone interviewing candidates believes they’re Dijkstra.

[–] kamen@lemmy.world 46 points 2 weeks ago (1 children)

If you hand out a problem and only accept one solution out of multiple valid ones, you're part of the problem.

[–] SkaveRat@discuss.tchncs.de 31 points 2 weeks ago (31 children)

When I interview (experienced) devs, I often ask way too generic questions. Something along the lines of "can you explain what a hash is?", without stating what kind of hash and in what context

The primary goal isn't really to explain it in detail, but to see if they get confused and ask for clarification. Way too many people just start assuming something, when a task is not defined properly. I need coworkers that push back on bullshit, and not blindly implement whatever runs along their desk, no matter how little sense it makes

If I don't hear at least one "it depends" during an interview, I don't have high hopes

[–] zalgotext@sh.itjust.works 16 points 2 weeks ago (5 children)

Your candidates aren't mind readers though. If you want people to ask clarifying questions, you have to ask them things other than comp sci trivia questions.

load more comments (5 replies)
load more comments (30 replies)
[–] serenissi@lemmy.world 43 points 2 weeks ago (2 children)

disappointing. no such algorithm.

yeah I looked it up

load more comments (2 replies)
[–] henfredemars@infosec.pub 40 points 2 weeks 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 2 weeks 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 2 weeks 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 2 weeks 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 2 weeks ago* (last edited 2 weeks 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.

[–] Randelung@lemmy.world 30 points 2 weeks ago* (last edited 2 weeks ago) (9 children)

Your MOM is marginally optimal, nerd!

Hah, gottem.

load more comments (9 replies)
[–] Warl0k3@lemmy.world 30 points 2 weeks ago* (last edited 2 weeks 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 2 weeks 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 2 weeks 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 2 weeks ago* (last edited 2 weeks 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.

load more comments (6 replies)
[–] Yaky@slrpnk.net 26 points 2 weeks 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 2 weeks ago
[–] goatinspace@feddit.org 20 points 2 weeks ago
[–] tetranomos@awful.systems 18 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

software engineers met the table¹ in web design and never looked back. does a table "mean" tfoot and all (arranged at top)? thead, that sorts(, by server link without javascript)? a "table" in the web means all sorts of sorty things (i mean even "drag and drop" first should meet with server links that move a row up and down — maybe reveal the "buttons" through tap+hold on the row in CSS, and so on) and offset things, and paginated things, by navigable server links, even hide and filter fields by URI! and the two tables nested for layout, oy vey! so many ways with all that engineering the web fell to the broken manual✨️🤷🏾‍♂️✨️

¹ (for layout) https://www.w3.org/TR/web-sustainability-guidelines/#progressive-enhancement

[–] isVeryLoud@lemmy.ca 11 points 2 weeks ago (1 children)

(⁠╯⁠°⁠□⁠°⁠)⁠╯⁠︵⁠ ⁠┻⁠━⁠┻

[–] not@lemmy.dbzer0.com 11 points 2 weeks ago (1 children)

┬─┬ ノ( ゜-゜ノ)

load more comments (1 replies)
[–] SatyrSack@quokk.au 16 points 2 weeks ago (1 children)
load more comments (1 replies)
[–] Jankatarch@lemmy.world 12 points 2 weeks ago

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

[–] mlg@lemmy.world 12 points 2 weeks ago (4 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.

load more comments (4 replies)
load more comments
view more: next ›