I use a menu of a restaurant like a poster. I haven’t ordered from them. It’s a simple large burger menu.

  • pixelscript@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    8 months ago

    It’s a simple function definition that’s equivalent to:

    function confirm(value)
    {
        if (value == true)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    

    Not the most original punchline; I’m sure you’ve seen it before. We were just baffled to actually see it in the wild.

    Judging from the way this function was used, there no evidence to suggest it ever contained extra logic that was refactored out over time. I’m wholly convinced someone wrote this as-is and thought it was okay. I also knew that there’s no way this was extracted for DRY purposes, as it was only called in one place, and the rest of the codebase was extremely allergic to DRY.

    It was also formatted like complete garbage. Indentation level was not consistent line by line. And, presumably due to some carelessness handling line endings, the entire code file developed double-spacing. Somehow it was checked into version control in that state.

    All these little nits, from the code’s utter uselessness to its appalling formatting, compelled us to preserve it. It was like the entire rest of the shitty codebase in microcosm.

    • yttrium@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      3
      ·
      8 months ago

      That’s… incredible. If people who write code like that can get programming jobs, maybe I shouldn’t be quite so worried about my own skills.

      • pixelscript@lemmy.ml
        link
        fedilink
        English
        arrow-up
        2
        ·
        8 months ago

        It’s not usually where the big bucks are, but there is a nonzero amount of money in bad code.