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.”
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.
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.
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.
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.”
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.
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.
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)
Submerging the sphere gives you the volume. You're thinking of the legend of Archimedes who measured volume this way and measured mass with an ordinary scale and deduced the density from those two values.
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.
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.
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.
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)
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).
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)
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.
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
Fun fact, most Tetris clones have a 4D table of all pieces and their rotations. Or multiple user selectable. The actual game generates them (look up "tetris recomp site:github.com").
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
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.
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.
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.
All these job titles don't really have a formal definition. Software engineer = programmer = software developer. Computer scientist sure does sound fancy though. There's no committee that will say "actually you're doing too much math to be a developer sorry." We all do the code-y thing. Businesses seem to pick one at random based on seniority. I just call myself whatever my most recent job title was.
Your industry will affect your specialisation and skills much more than anything else.
You’re taking my comment a little too seriously. I just know that what I do is essentially playing with other people’s legos, to make a CRUD app, to show my industry’s equivalent of cat pictures. I leave the heavy math and theory to the real computer scientists.
Bijecting to an exponential curve was also a hint. Anything that bijects to an exponential would just biject to the positive reals, since that's how logarithms work.
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
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.
It could be on a different subject, but it has to be a trick question. If they were prompted to ask more, that would undercut the whole point of the test, since OP wants employees that always ask or question.
I don't think asking someone a trick question in an interview is a good way to gauge if they'll push back and ask questions on the job. Also, I think that behavior is more related to the employer creating an environment where employees feel safe doing that, and isn't really something you can draw out of a candidate during an interview, of all times.
I mean I'd probably go super generic and say something like "it's a deterministic function which turns a block of data into a usually smaller block of data, usually for comparing equality to the original block of data" which covers most of the uses?
If you ask a generic question, you're gonna get a broad answer, and if you want to draw clarifying questions, you need to ask a more complex question and provide insufficient information to answer it. Even then, making that question something you can easily look up online, and you either know or you don't, doesn't achieve as much as making the question something that you objectively won't know, and have to learn on the spot, as that shows your ability to learn new things including things you can look up on the Internet.
The point is that in a real software engineering process, specs and requirements are rarely defined precisely from the start, and the programmer should be able to identify the gaps and clarify them. A generic answer doesn't help as much as a clarifying question.
A common but amateur mistake is to just make assumptions about how something should work and then forge ahead. As a programmer in a company, you are building things for somebody else (your boss, your client), so you need to ask them first.
Sure but as I said, that's a knowledge question and not an engineering problem to solve. They're very different and unless you work in software consulting, you're not gonna get a problem that looks remotely like that from a client.
The only definition of hash that I know is an identifier for an object created from that object's data. Everything else stems from that central idea. What other types of hash are there?
Yeah, it's basically that, but it has different uses - two main things I can think of right away are 1) verifying data when downloading large files and 2) cryptography (e.g. when storing credentials). Oh, and hash tables too.
So, to start off, I'm someone who does not typically perform well during interviews because of anxiety (but through some miracle has had no issues with employment), so take this response with whatever bias that brings.
I believe this is bad too. You're still essentially asking a gotcha question, expecting one phrase in your answer and failing the candidate if you don't hear that phrase. And, in fact, I disagree with the premise. I think the question is defined quite well in the context of programming, given that someone answers with the possibility that there are many ways to hash something and many uses of hashing.
The hash question is just something from the top of my head. I normally fit it to the situation.
I absolutely take nervousness into account, as I can relate to it.
The thing is, I need to know if the person can push back in some way. it's a hard thing to do in interviews, but also the first point for me to check how a person reacts
I've been bitten too many times, with dev coworkers who don't give at least a little resistance when vague or stupid tasks show up. Only to notice hours or days later, when something was done completely the wrong way
Every task starts out as a vague idea that, at some point, needs to be narrowed down to something specific and actionable.
If you’re at a sufficiently large organization and you get lucky, that happens before it makes it to a developer. For the rest of us, it’s an important skill to be able to take a task, ask clarifying questions, and narrow it down to something actionable.
@SkaveRat
in college I had a prof tell us to get into teams, then give us lego sets to assemble.
they were in the original boxes but the directions had been removed. I was the only one to go up front and ask for the directions and she gave them to me.
Apparently that was the whole point to the excersize. “ask for the resources you need"
Fair point, but depending on the interviewee, you might get very different answers and/or follow up questions.
Even if they assume something, it might be just for the sake of the example. If they're competent, they'll follow up with another example and so on, depending on how exactly you pose the problem.
If you present it as an abstract question, one possibility is that you get an abstract answer. If you present it like a ticket with no description, you might get prompted to clarify.
Related sidenote: I don't think I have any form of tism, but something activates when people ask computer science terms where my terrible memory goes "oh yeah I remember the dictionary definition perfectly, punctuations included, let's recite!"
Also I love the hash exampple. If they start talking about checksums and whatnot, you know their hobby lmao.
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%!
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.)
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✨️🤷🏾♂️✨️
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.
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.
This wholly depends on where this code is running. If it’s running on the server, you want the best algorithm for most cases, to try to minimize work and power consumption, and maximize capacity. If it’s running on the client, just use whatever.
137 Comments
ThatGuy46475@lemmy.world · 215 pts · 1d
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 · 147 pts · 1d
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 · 70 pts · 1d
The physicist’s answer would be correct anywhere, no matter the temperature or density of the fluid.
montechristo@feddit.org · 29 pts · 1d
Supposing that the measurements with and without the sphere are taken under identical circumstances. But you deserve the upvote either way.
OwOarchist@pawb.social · 15 pts · 1d
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 pts · 1d
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 · 12 pts · 1d
They just said the ball was red, they didn’t say why…
Aqivex@fedinsfw.app · 9 pts · 1d
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.
untorquer@quokk.au · 5 pts · 1d
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:
Which includes non-standard conditions.
tyler@programming.dev · 1 pts · 4h
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.”
BartyDeCanter@piefed.social · 5 pts · 1d
Anywhere with gravity sufficient to overcome the surface tension of the water from forming around the object or clinging to the container.
ChickenLadyLovesLife@lemmy.world · 17 pts · 1d
They later added an Anthropologist, who understood that more questions needed to be asked. His first question was "do you want fries with that?"
k0e3@lemmy.ca · 8 pts · 21h
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.
kuberoot@discuss.tchncs.de · 14 pts · 20h
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.
froh42@lemmy.world · 4 pts · 20h
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)
Jako302@feddit.org · 3 pts · 20h
It shows volume, not density.
The amount of displaced water is the same for a lead sphere and a balloon of the same size.
You can the also calculate the density if you measure how mich of the object is submerged
Shanmugha@lemmy.world · 2 pts · 20h
attach something to the bottom, pull, fix position
Edit: I am late. kudos for everyone who was faster :)
blamster19@programming.dev · 2 pts · 20h
Submerging the sphere gives you the volume. You're thinking of the legend of Archimedes who measured volume this way and measured mass with an ordinary scale and deduced the density from those two values.
Kazumara@discuss.tchncs.de · 2 pts · 20h
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.
HeHoXa@lemmy.zip · 4 pts · 14h
This entire post is a deep catharsis, and this comment is the pinnacle.
BCsven@lemmy.ca · 86 pts · 1d
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 · 42 pts · 1d
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 · 14 pts · 1d
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 · 6 pts · 1d
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).
muusemuuse@sh.itjust.works · 3 pts · 1d
Humans can invent lies. Machines can repeat lies faster.
Tja@programming.dev · 3 pts · 17h
Yeah, but we didn't have an is_odd npm package, imagine the horror.
MonkderVierte@lemmy.zip · 1 pts · 18h
Aren't commonly used math results fix in hardware anyways?
HugeNerd@lemmy.ca · 1 pts · 5h
On 8 bit CPUs we just "refactor" the circle to have 256 degrees so you can easily use 8 bit math.
Sludge@sh.itjust.works · 16 pts · 1d
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 pts · 1d
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 pts · 1d
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
diaphragmwp@discuss.tchncs.de · 2 pts · 7h
Fun fact, most Tetris clones have a 4D table of all pieces and their rotations. Or multiple user selectable. The actual game generates them (look up "tetris recomp site:github.com").
dumnezero@piefed.social · -13 pts · 1d
why is this upvoted
Diplomjodler3@lemmy.world · 19 pts · 1d
Because there are plenty of scenarios where this would work.
BCsven@lemmy.ca · 10 pts · 1d
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
thenextguy@sh.itjust.works · 85 pts · 1d
I would say Computer Scientist in place of software engineer.
baggachipz@sh.itjust.works · 45 pts · 1d
Yeah, software engineers are the sanitation engineers of programming. Source: am one
surewhynotlem@lemmy.world · 18 pts · 1d
Scientists research. Engineers do. We are the more practical of the two.
Omgpwnies@lemmy.world · 14 pts · 1d
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.
Kazumara@discuss.tchncs.de · 5 pts · 20h
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.
gankouskhan@bookwyr.me · 4 pts · 23h
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.
Zarobi@aussie.zone · 9 pts · 1d
All these job titles don't really have a formal definition. Software engineer = programmer = software developer. Computer scientist sure does sound fancy though. There's no committee that will say "actually you're doing too much math to be a developer sorry." We all do the code-y thing. Businesses seem to pick one at random based on seniority. I just call myself whatever my most recent job title was.
Your industry will affect your specialisation and skills much more than anything else.
- Software Engineer (Maths)
Tja@programming.dev · 2 pts · 17h
I don't even go that's far. I "work in IT". Enough for 99% of social interactions / official forms.
baggachipz@sh.itjust.works · 2 pts · 17h
You’re taking my comment a little too seriously. I just know that what I do is essentially playing with other people’s legos, to make a CRUD app, to show my industry’s equivalent of cat pictures. I leave the heavy math and theory to the real computer scientists.
bruh@nord.pub · 1 pts · 9h
sounds reasonable to me! why reinvent the wheel right?
baggachipz@sh.itjust.works · 1 pts · 5h
I just use wheels that will others have built and call it my car 😎
Zarobi@aussie.zone · 1 pts · 12h
I couldn't tell how serious you were being, sorry. Some people get weird about this specific topic and gatekeep the labels lol
Stache_@lemmy.ml · 76 pts · 1d
Red thinks you’re making up words
CanadaPlus@lemmy.sdf.org · 1 pts · 7h
They're all real words, but not in an order that makes sense. And I'm not sure what algorithms there are by a Ross or Maxwell.
tetris11@feddit.uk · 1 pts · 19h
I think it means when the method is barely better O(Exp), even on ordered sets
procrastitron@lemmy.world · 54 pts · 1d
B.S.
Dijkstra would have loved the lookup table solution.
He HATED complexity.
serenissi@lemmy.world · 39 pts · 1d
disappointing. no such algorithm.
yeah I looked it up
Tja@programming.dev · 7 pts · 17h
Good news, you can invent it!
CanadaPlus@lemmy.sdf.org · 1 pts · 7h
Bijecting to an exponential curve was also a hint. Anything that bijects to an exponential would just biject to the positive reals, since that's how logarithms work.
anon_8675309@lemmy.world · 39 pts · 17h
Everyone interviewing candidates believes they’re Dijkstra.
kamen@lemmy.world · 38 pts · 20h
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 · 25 pts · 17h
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 · 10 pts · 13h
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.
CanadaPlus@lemmy.sdf.org · 2 pts · 7h
It could be on a different subject, but it has to be a trick question. If they were prompted to ask more, that would undercut the whole point of the test, since OP wants employees that always ask or question.
zalgotext@sh.itjust.works · 1 pts · 4h
I don't think asking someone a trick question in an interview is a good way to gauge if they'll push back and ask questions on the job. Also, I think that behavior is more related to the employer creating an environment where employees feel safe doing that, and isn't really something you can draw out of a candidate during an interview, of all times.
1rre@discuss.tchncs.de · 9 pts · 14h
I mean I'd probably go super generic and say something like "it's a deterministic function which turns a block of data into a usually smaller block of data, usually for comparing equality to the original block of data" which covers most of the uses?
If you ask a generic question, you're gonna get a broad answer, and if you want to draw clarifying questions, you need to ask a more complex question and provide insufficient information to answer it. Even then, making that question something you can easily look up online, and you either know or you don't, doesn't achieve as much as making the question something that you objectively won't know, and have to learn on the spot, as that shows your ability to learn new things including things you can look up on the Internet.
hirihit640@sh.itjust.works · 1 pts · 4h
The point is that in a real software engineering process, specs and requirements are rarely defined precisely from the start, and the programmer should be able to identify the gaps and clarify them. A generic answer doesn't help as much as a clarifying question.
A common but amateur mistake is to just make assumptions about how something should work and then forge ahead. As a programmer in a company, you are building things for somebody else (your boss, your client), so you need to ask them first.
1rre@discuss.tchncs.de · 2 pts · 3h
Sure but as I said, that's a knowledge question and not an engineering problem to solve. They're very different and unless you work in software consulting, you're not gonna get a problem that looks remotely like that from a client.
hirihit640@sh.itjust.works · 1 pts · 3h
You actually get them all the time, because the programmer is more deeply knowledgeable about the features they wrote and can identify gaps better.
Boss: "Can we move the widget to the left side of the page?"
Programmer: "Sure but that means when the sidebar opens it will obscure the widget, making it hard to see both at the same time. Do we want that?"
Boss: "Hmm I didn't consider that. Let me ask the UX team what they think."
stingpie@lemmy.world · 7 pts · 15h
The only definition of hash that I know is an identifier for an object created from that object's data. Everything else stems from that central idea. What other types of hash are there?
Waraugh@lemmy.dbzer0.com · 6 pts · 14h
I smoked some on the way in here to make interviewing more tolerable
trebach@sh.itjust.works · 1 pts · 13h
I had a can of it and made some Reuben sandwiches.
kamen@lemmy.world · 4 pts · 14h
Yeah, it's basically that, but it has different uses - two main things I can think of right away are 1) verifying data when downloading large files and 2) cryptography (e.g. when storing credentials). Oh, and hash tables too.
xianjam@programming.dev · 7 pts · 14h
So, to start off, I'm someone who does not typically perform well during interviews because of anxiety (but through some miracle has had no issues with employment), so take this response with whatever bias that brings.
I believe this is bad too. You're still essentially asking a gotcha question, expecting one phrase in your answer and failing the candidate if you don't hear that phrase. And, in fact, I disagree with the premise. I think the question is defined quite well in the context of programming, given that someone answers with the possibility that there are many ways to hash something and many uses of hashing.
SkaveRat@discuss.tchncs.de · 4 pts · 14h
The hash question is just something from the top of my head. I normally fit it to the situation.
I absolutely take nervousness into account, as I can relate to it.
The thing is, I need to know if the person can push back in some way. it's a hard thing to do in interviews, but also the first point for me to check how a person reacts
I've been bitten too many times, with dev coworkers who don't give at least a little resistance when vague or stupid tasks show up. Only to notice hours or days later, when something was done completely the wrong way
Pyr_Pressure@lemmy.ca · 6 pts · 13h
Sounds like you need to fire the person handing out vague and undefined tasks to everyone 😂
cantstopthesignal@sh.itjust.works · 3 pts · 12h
Listen up every client ever, I'm sorry but I'll have to let you go.
ID10T@programming.dev · 3 pts · 8h
Every task starts out as a vague idea that, at some point, needs to be narrowed down to something specific and actionable.
If you’re at a sufficiently large organization and you get lucky, that happens before it makes it to a developer. For the rest of us, it’s an important skill to be able to take a task, ask clarifying questions, and narrow it down to something actionable.
Ruusunmarja@lemmy.blahaj.zone · 1 pts · 14h
Well, he did say ”push back on bullshit” soo congrats? 🤭
CanadaPlus@lemmy.sdf.org · 6 pts · 7h
Are you sure you're management material?
(This is a complement)
SkaveRat@discuss.tchncs.de · 2 pts · 7h
Man, I hope not
HugeNerd@lemmy.ca · 1 pts · 5h
Two's complement?
grendel84@tiny.tilde.website · 3 pts · 13h
@SkaveRat
in college I had a prof tell us to get into teams, then give us lego sets to assemble.
they were in the original boxes but the directions had been removed. I was the only one to go up front and ask for the directions and she gave them to me.
Apparently that was the whole point to the excersize. “ask for the resources you need"
@kamen
kamen@lemmy.world · 3 pts · 8h
Fair point, but depending on the interviewee, you might get very different answers and/or follow up questions.
Even if they assume something, it might be just for the sake of the example. If they're competent, they'll follow up with another example and so on, depending on how exactly you pose the problem.
If you present it as an abstract question, one possibility is that you get an abstract answer. If you present it like a ticket with no description, you might get prompted to clarify.
cantstopthesignal@sh.itjust.works · 2 pts · 12h
If you want something to blindly implement a vague task by making a ton of assumptions, just use AI.
Jankatarch@lemmy.world · 2 pts · 8h
Related sidenote: I don't think I have any form of tism, but something activates when people ask computer science terms where my terrible memory goes "oh yeah I remember the dictionary definition perfectly, punctuations included, let's recite!"
Also I love the hash exampple. If they start talking about checksums and whatnot, you know their hobby lmao.
SpaceCowboy@lemmy.ca · 1 pts · 1h
Hash? Sure I can hook you up.
henfredemars@infosec.pub · 36 pts · 1d
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 · 40 pts · 1d
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 · 14 pts · 1d
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 · 21 pts · 1d
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.
baines@lemmy.cafe · 1 pts · 4h
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
mushroommunk@lemmy.today · 1 pts · 3h
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.
baines@lemmy.cafe · 1 pts · 3h
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
mushroommunk@lemmy.today · 2 pts · 3h
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.
rtxn@lemmy.world · 15 pts · 1d
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 · 28 pts · 1d
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 · 19 pts · 1d
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 · 13 pts · 1d
Why would a mother do this, I'm horrified
Warl0k3@lemmy.world · 16 pts · 1d
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.
ChickenLadyLovesLife@lemmy.world · 9 pts · 1d
My mom taught me ORM. I'd rather have had the SQL mom.
MonkderVierte@lemmy.zip · 6 pts · 18h
It's Bobby Tables.
psud@aussie.zone · 5 pts · 19h
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
Tja@programming.dev · 2 pts · 17h
Meh, Mongo and Elastic are the future, SQL is for... moms!
Warl0k3@lemmy.world · 2 pts · 10h
I sent her this thread and she's asked me to tell you that she likes this so much she's getting a "SQL is for Moms!" T-shirt printed.
Tja@programming.dev · 3 pts · 7h
I'm glad she liked my dumb joke. Have a good one!
Yaky@slrpnk.net · 23 pts · 1d
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.
Tja@programming.dev · 3 pts · 17h
Depends on the scale of the project. Some apps you would get a promotion if you could get them to (reliably) run on just 50k a day.
Randelung@lemmy.world · 22 pts · 17h
Your MOM is marginally optimal, nerd!
Hah, gottem.
HugeNerd@lemmy.ca · -7 pts · 5h
It's either "gotcha" or "got 'im".
jve@lemmy.world · 7 pts · 5h
Nope. You’re wrong.
HugeNerd@lemmy.ca · -7 pts · 5h
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.
jve@lemmy.world · 3 pts · 3h
Gottem.
SamuraiBeandog@lemmy.world · 2 pts · 2h
Talk to a linguist about how languages evolve.
nylo@lemmy.dbzer0.com · 1 pts · 2h
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.)
Alcoholicorn@mander.xyz · 1 pts · 2h
Gotcha addresses the person you're talking to, gottem is used to address a real or fictional audience, highlighting for them what you did.
Zachariah@lemmy.world · 20 pts · 1d
goatinspace@feddit.org · 20 pts · 1d
tetranomos@awful.systems · 16 pts · 1d
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 · 10 pts · 1d
(╯°□°)╯︵ ┻━┻
not@lemmy.dbzer0.com · 10 pts · 20h
┬─┬ ノ( ゜-゜ノ)
MonkderVierte@lemmy.zip · 5 pts · 18h
Flipped table, sorted table.
SatyrSack@quokk.au · 15 pts · 1d
https://en.wikipedia.org/wiki/Edsger_W._Dijkstra
Skullgrid@lemmy.world · 7 pts · 1d
Yeah. OP gets bonus points for the OG
mlg@lemmy.world · 12 pts · 1d
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 · 7 pts · 1d
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.
MonkderVierte@lemmy.zip · 1 pts · 18h
Which one?
Tja@programming.dev · 5 pts · 17h
Probably roller coaster tycoon...
MonkderVierte@lemmy.zip · 2 pts · 17h
Ah, right.
But this was at a time when compilers weren't better than you in optimizing.
Jankatarch@lemmy.world · 11 pts · 1d
I am torn between this and "AAA videogames should be optimized more."
tatterdemalion@programming.dev · 10 pts · 1d
New shortest path meta dropped
https://arxiv.org/pdf/2504.17033
Flower@sh.itjust.works · 9 pts · 1d
The solution that I know my colleagues can maintain in the future.
Avicenna@programming.dev · 7 pts · 1d
I feel like it would CS professors and not software engineers who would give that look.
VonReposti@feddit.dk · 3 pts · 21h
Well, it is Dijkstra in the picture.
hperrin@lemmy.ca · 6 pts · 1d
This wholly depends on where this code is running. If it’s running on the server, you want the best algorithm for most cases, to try to minimize work and power consumption, and maximize capacity. If it’s running on the client, just use whatever.
Clusterfck@lemmy.sdf.org · 22 pts · 1d
THIS IS WHY SOFTWARE DOWNLOADS ARE 75 GB WHEN 20 YEARS AGO THEY WERE ONLY 200 MB.
xthexder@l.sw0.com · 15 pts · 1d
Because who cares if it's the user that has to buy more RAM or gets terrible battery life, that's not our problem. /s
This is why we can't have nice things.
hperrin@lemmy.ca · 6 pts · 1d
I agree. I guess it wasn’t obvious that I was being sarcastic.
bruh@nord.pub · 1 pts · 7h
you should have used '/s'. a lot of people got confused it seems
sunbytes@lemmy.world · 6 pts · 20h
How BE guys look at you when you use flex-grid instead.
NigelFrobisher@aussie.zone · 4 pts · 1d
Harold Shipman meme.
SamuraiBeandog@lemmy.world · 1 pts · 2h
How I look at the algorithm nerd on my team who just wrote code that is tightly coupled across 3 layers of the codebase.