• BCsven@lemmy.ca
    link
    fedilink
    arrow-up
    81
    ·
    1 day 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
      2
      ·
      3 hours 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”).

    • Sludge@sh.itjust.works
      link
      fedilink
      arrow-up
      15
      ·
      1 day 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
      link
      fedilink
      English
      arrow-up
      11
      ·
      edit-2
      1 day ago

      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
        link
        fedilink
        arrow-up
        11
        ·
        1 day 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

      • BCsven@lemmy.ca
        link
        fedilink
        arrow-up
        9
        ·
        1 day 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