• SamuraiBeandog@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    7 days ago

    How I look at the algorithm nerd on my team who just wrote code that is tightly coupled across 3 layers of the codebase.

  • ThatGuy46475@lemmy.world
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    8 days ago

    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
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      1
      ·
      8 days ago

      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
        link
        fedilink
        arrow-up
        4
        ·
        8 days ago

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

        • OwOarchist@pawb.social
          link
          fedilink
          English
          arrow-up
          2
          ·
          8 days 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
          link
          fedilink
          English
          arrow-up
          0
          ·
          8 days ago

          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.

          • Aqivex@fedinsfw.app
            link
            fedilink
            English
            arrow-up
            1
            ·
            8 days ago

            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
              link
              fedilink
              English
              arrow-up
              1
              ·
              8 days ago

              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.

  • BCsven@lemmy.ca
    link
    fedilink
    arrow-up
    2
    ·
    8 days ago

    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.

    • diaphragmwp@discuss.tchncs.de
      link
      fedilink
      arrow-up
      1
      ·
      7 days ago

      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”).

    • Thorry@feddit.org
      link
      fedilink
      arrow-up
      1
      ·
      8 days ago

      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
        link
        fedilink
        arrow-up
        1
        ·
        8 days ago

        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)

        • HugeNerd@lemmy.ca
          link
          fedilink
          arrow-up
          0
          arrow-down
          1
          ·
          7 days ago

          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.

  • henfredemars@infosec.pub
    link
    fedilink
    English
    arrow-up
    1
    ·
    8 days ago

    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
      link
      fedilink
      arrow-up
      2
      ·
      8 days ago

      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
        link
        fedilink
        English
        arrow-up
        1
        ·
        8 days ago

        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
          link
          fedilink
          arrow-up
          1
          ·
          8 days 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.

  • kamen@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    7 days ago

    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
      link
      fedilink
      arrow-up
      1
      ·
      7 days ago

      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

      • BCsven@lemmy.ca
        link
        fedilink
        arrow-up
        1
        ·
        6 days ago

        I had this with one of my guys. He spent a week working on something and the validation at the end wasn’t jiving.

        He started showing me the complex solution and end results and so I said show me how you started and walk me through it.

        It was step 1 the origin location of data was out of position.

        I said if you start at this origin the rest of the numbers and data will work out.

        He replied that the origin wasn’t shown measured from somewhere, so how would we know location.

        So I pointed out that the data to origin wasn’t directly spelled out but if you take this measure and subtract this one that is your data origin start.

        He said OMG I worked on this for a week trying to get the formulas working. I feel so stupid because you solved it in 1 minute.

        I replied its not a question of smart or stupid (because my guy is way beyond me for formulae and programming) its just slowing down and following a process. And if you are confused, ask more questions, rather than just continuing.

      • zalgotext@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        7 days ago

        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.

      • stingpie@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        7 days ago

        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?

        • kamen@lemmy.world
          link
          fedilink
          English
          arrow-up
          0
          ·
          7 days ago

          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.

          • Laser@feddit.org
            link
            fedilink
            arrow-up
            0
            ·
            6 days ago

            Well, but the question wasn’t “what is a hash used for”, but rather “what is a hash”

            • kamen@lemmy.world
              link
              fedilink
              English
              arrow-up
              1
              ·
              6 days ago

              Then it’s not all that ambiguous and could be answered with one sentence.

  • Yaky@slrpnk.net
    link
    fedilink
    arrow-up
    1
    ·
    8 days ago

    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.

        • Omgpwnies@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          8 days ago

          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.