• Gork@lemm.ee
    link
    fedilink
    arrow-up
    50
    ·
    16 hours ago

    It’s a load-bearing function.

    We have no idea why it’s important, just that it is critical to everything functioning.

    • pixelscript@lemm.ee
      link
      fedilink
      English
      arrow-up
      9
      ·
      16 hours ago

      I feel like the “we don’t know what this function does” meme is kinda bad. There’s no reason beyond maybe time crunch why you shouldn’t be able to dissect exactly what it does.

      Despite this, the notion of a load-bearing function is still very relevant. Yeah, sure, you know what it does, including all of the little edge case behaviors it has. But you can’t at this time fully ascertain what’s calling it, and how all the callers have become dependant on all the little idiosyncracies that will break if you refactor it to something more sensible.

      It has been several times now where a part of my system of legacy code broke in some novel fantastic way, because two wrongs were cancelling out and then I fixed only one of them.

      • bisby@lemmy.world
        link
        fedilink
        English
        arrow-up
        7
        ·
        11 hours ago

        https://en.wikipedia.org/wiki/Fast_inverse_square_root

        even if you can figure out specifically WHAT a function does, it’s not always clear WHY a function does, and honestly, if this function wasnt labeled in the code, no way in hell would I know what it does.

        It has an entire wiki page dedicated to explaining it, and it involves enough math that most people wouldn’t be able to follow along.

        Nothing this atrocious lives in any current codebases I work on… but if you work at an old enough company, some of the load-bearing code will be tricky to figure out what is calling it, but also it was written in a time where little hacks were needed to eke out performance.

        You only have to experience it once for it to be a memorable enough thing that you will cite it for the rest of your days.

        Or more realistically, it IS comprehensible, but the level of effort necessary to comprehend it is not worth it. So you leave it as “undecipherable” and move on.

      • MajorHavoc@programming.dev
        link
        fedilink
        arrow-up
        13
        ·
        15 hours ago

        There’s no reason beyond maybe time crunch why you shouldn’t be able to dissect exactly what it does.

        Usually it’s mysterious business logic from before the dawn fo time.