Hey folks! I think this request is right up this comm’s alley. I’m sure that we all know bogo sort but, what other terrible/terribly inefficient algorithms, software architecture, or design choices have you been horrified/amused by?

I, sadly, lost a great page of competing terrible sorting algorithms, but I’ll lead with JDSL as a terrible (and terribly inefficient) software architecture and design. The TL;DR is that a fresh CS guy got an internship at a company that based its software offering around a custom, DSL based on JSON that used a svn repo to store all functions in different commits. The poor intern had a bad time due to attempting to add comments to the code, resulting in customer data loss.

34 points

No, I won’t give you my github.

permalink
report
reply
23 points

That’s ok. I’ve only just met you and am not sure that I’m ready to commit.

permalink
report
parent
reply
25 points
permalink
report
reply
9 points

That’s incredible.

permalink
report
parent
reply
15 points
permalink
report
reply
1 point

great. time to put that in practice.

permalink
report
parent
reply
14 points
permalink
report
reply
12 points
*

slow inverse square root:

float slowinvsqrt(float x)
{
    const long accuracy = 100000000;    // larger number = better accuracy
    if (x <= 0.0f) {
        return NAN;
    }
    if (x == 1.0f) {
        return 1.0f;
    }
    if (x < 1.0f) {
        return 1.0f / slowinvsqrt(1.0f/x);
    }

    int max_power = log(accuracy) / log(x);
    long pow1 = pow(x, max_power - 1);
    long pow2 = pow(x, max_power);
    double current = 1.0;
    double previous = 1.0;

    for (long i = 0; i<10*accuracy; i++) {
        current = sin(current);
        if (i == pow1) {
            previous = current;
        }
        if (i == pow2) {
            return current / previous;
        }
    }
}
permalink
report
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 3.4K

    Monthly active users

  • 1K

    Posts

  • 38K

    Comments