56
submitted 10 months ago by Lamb@lemmy.zip to c/asklemmy@lemmy.ml

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

you are viewing a single comment's thread
view the rest of the comments
[-] pixelscript@lemmy.ml 2 points 10 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 3 points 10 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 2 points 10 months ago

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

this post was submitted on 08 Nov 2023
56 points (93.8% liked)

Asklemmy

43399 readers
852 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS