A picture of Edsger Dijkstra with a concerned face and the following text on top: How software engineers look at your code when you solve the problem using two tables — instead of using the Maxwell-Ross-Karmakar algorithm, which is marginally optimal in ordered sets bijectable to the exponential curve

top 76 comments

sorted by: hot top controversial new old
[–] 223 points 2 months ago (21 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.”

  • source
  • hideshow 21 child comments
  • [–] 150 points 2 months ago* (12 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.

  • source
  • parent
  • hideshow 12 child comments
  • [–] 72 points 2 months ago (10 children)

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

  • source
  • parent
  • hideshow 10 child comments
  • [–] 15 points 2 months ago* (9 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.

  • source
  • parent
  • hideshow 9 child comments
  • [–] 11 points 2 months 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.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 7 points 2 months ago* (1 child)

    You're right in terms of grading a student's homework or whatever.

    In research/publication/career these assumptions must be stated unless given.

    But I was responding to:

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

    Which includes non-standard conditions.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 2 months ago (3 children)

    This is like saying “the physicist’s answer would have errors because they measured the ball and then stuck it in an oven. The volume of the ball in the oven is different than what they measured.”

  • source
  • parent
  • hideshow 3 child comments
  • [–] 0 points 2 months ago (2 children)

    No it's more like the physicist tried to use boiling water to measure it

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 2 months ago (1 child)

    Using boiling water is still fine, the measurement will work, your comment literally only is a problem if they don’t measure in time. So yes, it’s exactly like sticking it in an oven and not measuring at the same time

  • source
  • parent
  • hideshow 1 child comment
  • [–] 8 points 2 months ago* (last edited 2 months ago) (5 children)

    Sorry for the stupid question, but doesn't the rise in water level show the density of an object? Can you measure volume too? What if the sphere floated?

    Edit: thanks everyone for helping me understand. I was totally misremembering the story about Archimedes and the crown.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 16 points 2 months ago

    Nope, the rise in water shows exclusively the volume. Density is derived using volume and mass, with mass being measurable by weighing. The only factor density plays directly is indeed floating, but you can just push the sphere under with a thin rod without significantly impacting the measurement.

    It's generally simple - water has some volume, sphere has some volume. Assuming a cylindrical container, the base of the cylinder is known, and the volume of it is equal to the volume of water, which means you can derive the height (or vice versa). If you now add the sphere, the sphere pushes out the water, which means you add the volume of the sphere to the water - and if you measure the height, you can calculate the total volume of water+sphere, and subtract the initial volume of water to isolate the volume of the sphere.

  • source
  • parent
  • [–] 4 points 2 months ago* (last edited 2 months ago)

    If you fully submerge an object, you displace its VOLUME of water. It will always be the same amount (imagine a bowling ball and a soccer ball). You might need to push it.

    When you relate that to its weight, you get the density.

    Imagine you have two 1kg lumps of steel. Out of one you make a bowl with thin walls the out of the other a metal ball. Afterwards they still have (about) the same weight, volume and density - as it's still steel.

    But put the bowl onto the basin and with a little luck it will float like a boat *, put in the steel ball it will sink.

    But when you put in the bowl sideways without splashing it will displace about the same amount of water than the ball. And it will still weigh 1kg.

    *= The thing with floating people remember from school: The floating bowl will displace as much water as it weighs - that's the thing Archimedes found out. So our 1kg bowl will displace 1kg of water - which is incidentally about 1 liter, because the density of water is about 1kg/l (it was intentionally defined that way, some guys in the French revolution used water to define mass by volume)

  • source
  • parent
  • [–] 2 points 2 months ago*

    Density comes into it if we are measuring buoyancy. The weight of the displaced water is equal to the weight of the buoyant object, and the ratio of volume submerged vs above water should give a way to determine density, but I don't have the precise method in my head right now.

    However assuming all you want is the volume, you simply need to fully submerge the object (by applying enough downward force if its density is too low), and the displaced volume is equal to the objects volume. The displaced water will have to flow to the top of the container, so by measuring the rise in water level and multiplying with the base area of your container you can get it easily.

    Just make sure you don't accidentally also measure your hand if you're pushing down the sphere.

  • source
  • parent
  • [–] 87 points 2 months ago (5 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.

  • source
  • hideshow 5 child comments
  • [–] 17 points 2 months 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)

  • source
  • parent
  • [+] -12 points 2 months ago (2 children)
  • [–] 10 points 2 months ago

    Because he hadn't thought of what I suggested and it was much easier than what he was trying to program. I wasn't suggesting he write the program, solve it and table it; it was more like empirical knowledge/common sense stuff to narrow options, then fill the rest in based on what made sense. Then its just a horizontal or vertical intersection to find the outputs required instead of a complex calculation every time

  • source
  • parent
  • [–] 76 points 2 months ago* (2 children)

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

  • source
  • hideshow 2 child comments
  • [–] 53 points 2 months ago

    B.S.

    Dijkstra would have loved the lookup table solution.

    He HATED complexity.

  • source
  • [–] 48 points 2 months ago*

    Everyone interviewing candidates believes they’re Dijkstra.

  • source
  • [–] 42 points 2 months ago (2 children)

    disappointing. no such algorithm.

    yeah I looked it up

  • source
  • hideshow 2 child comments
  • [–] 83 points 2 months ago (5 children)

    I would say Computer Scientist in place of software engineer.

  • source
  • hideshow 5 child comments
  • [–] 45 points 2 months ago (4 children)

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

  • source
  • parent
  • hideshow 4 child comments
  • [–] 21 points 2 months ago (3 children)

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

  • source
  • parent
  • hideshow 3 child comments
  • [–] 16 points 2 months 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.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 6 points 2 months ago

    any CompSci grad I’ve worked with couldn’t write code for shit

    Damn, that sounds pretty bad.

    We had tons of math and theoretical work too, but we also programmed a fair amount: We had to write a renderer in one class, a compiler in another, various Android apps in a third, and in one elective I took we wrote a micro kernel OS as well.

  • source
  • parent
  • [–] 4 points 2 months ago

    It's not like the CS program is devoid of programming, norb would I say the SWE students are that much better off without outside education. CS is about half theory half practical for core education at least. The difference is you learn why and how which is more beneficial long term. After the first 6 months on the job the difference between the two on programming ability should be about the same with some more optimal solutions found by the CS student if any difference. It's a pretty short term problem.

  • source
  • parent
  • [–] 37 points 2 months ago (8 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%!

  • source
  • hideshow 8 child comments
  • [–] 40 points 2 months ago (6 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.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 15 points 2 months ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 20 points 2 months 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.

  • source
  • parent
  • [–] 1 point 2 months ago (3 children)

    not doubting you because the customer can be funny but wha?

    if time to compute doesnt matter there are likely more minimal hardware options to optimize for look up tables and memory cost/space

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 2 months ago (2 children)

    There are so many situations where you can't just swap hardware. Robots on an assembly line? Yeah you've gotta use hardware that's gone through safety testing. They're not going to just swap hardware to make things easier. You want to ship an update, you do it in software and under strict testing regiment. Some of that hardware is 20 or 30 years old. Medical. Aeronautics. Aerospace. All of them and more are using older hardware that's often memory limited but can often just sit and process their next step, and they often don't have built in complex hardware features because those add potential failure points.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 2 months ago* (1 child)

    the hang up for me is more the not caring about time to compute

    aeroish is my experience, and for me those have all cared about time to compute

    generally that’s one of the biggest constraints to the point of being super strict

    like major money being spent on modeled approximations and processing speed costs eclipsing pretty much everything on the design side

    tables for weather, angles, altitude, position this would be tiny compared to some we’re using

    30 year old equipment is even more taxed given the likely feature creep in my experience

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 2 months ago

    I'm guessing you were doing in flight aero stuff? I've been more in the medical and manufacturing space but the aero I did we were doing post-flight processing for reports. We had almost no memory to operate on, probably because of all the tables you're referencing that others were using.

  • source
  • parent
  • [–] 15 points 2 months 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.

  • source
  • parent
  • [–] 30 points 2 months ago* (9 children)

    Your MOM is marginally optimal, nerd!

    Hah, gottem.

  • source
  • hideshow 9 child comments
  • [+] -15 points 2 months ago (8 children)

    It's either "gotcha" or "got 'im".

  • source
  • parent
  • hideshow 8 child comments
  • [–] 13 points 2 months ago (7 children)
  • [+] -15 points 2 months ago (6 children)

    There is no such word as "gottem". This is a recent bowel movement from ignorant people. "Gotcha" has been around for generations, and the use of the apostrophe is quite simple.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 7 points 2 months ago (1 child)

    holy shit.

    you might be the biggest fucking nerd ever for being so thoroughly "em" who just got "gott"

    hahaha gottem

    (no but seriously dictionaries are descriptive not prescriptive; they add new words as the language evolves. if you were correct about new implementation of the language being "bowel movements from ignorant people" then you should be speaking Shakespearean English as that is Proper English™. the language wasn't finished changing when you stopped going to school, pal. I'd recommend you research linguistics as it seems you have a weak grasp on the concept and it's bringing your nerd card into question.)

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 2 months ago

    Okay. So it's not a word. That's fine. The popular expression in this context is indeed "gottem" and it doesn't matter if you think that's a word or not, that's just objective reality. Suck it, nerd.

  • source
  • parent
  • [–] 27 points 2 months ago* (9 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.

  • source
  • hideshow 9 child comments
  • [–] 17 points 2 months 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.

  • source
  • parent
  • [–] 12 points 2 months 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

  • source
  • parent
  • hideshow 7 child comments
  • [–] 16 points 2 months ago* (last edited 2 months 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.

  • source
  • parent
  • [–] 5 points 2 months ago (3 children)

    I am disappointed when someone comes into my career (systems analysis) without the ability to do even a simple SQL statement and it's become common since my employer realised they had too few analysts and hired 20 in my area for three of us to train

    More mothers should teach their kids to query

  • source
  • parent
  • hideshow 3 child comments
  • [–] 2 points 2 months ago (2 children)

    Meh, Mongo and Elastic are the future, SQL is for... moms!

  • source
  • parent
  • hideshow 2 child comments
  • [–] 23 points 2 months ago (1 child)

    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.

  • source
  • hideshow 1 child comment
  • [–] 21 points 2 months ago
    [–] 17 points 2 months ago (1 child)
  • load more comments
    view more: next ›