8

Trying to refactor legacy code can be a real adventure. It's like exploring an ancient ruin, except instead of hidden treasures, you're uncovering cryptic code and dead ends. But the real plot twist comes when you realize there are no unit tests to guide you. It's like trying to navigate a maze blindfolded - you never know when you're going to hit a dead end and end up with a headache! 🤯

Comments
  • 1
    Sounds like part of my job. Except that there are 300 line long (a single one has 300 lines) switch case statement spaghetti (used like emulated goto).
  • 1
    i do not know why, but while reading your rant i was thinking about something like this:

    "somehow the cooling system in our pyramid does not work anymore. can you fix that? it's all documented with a lot of pictures"
  • 0
    Instead of hidden treasures you discover hidden traps
  • 0
    @happygimp0

    Based Giant switch statement
  • 0
    But you can very easy solve maze blindfolded :)
  • 0
    @YADU

    #define EMULATED_GOTO(t) position=t; break;

    position=0;

    while(1)

    {

    switch(position)

    {

    case 0:

    ...

    if(foo) { EMULATED_GOTO(3); }

    EMULATED_GOTO(2);

    case 1:

    ...

    if(!foo) { EMULATED_GOTO(2); }

    ...

    EMULATED_GOTO(0);

    case 2:

    ....

    }

    }

    Not exactly like this, a bit more hidden and with names. But still very hard to read.
Add Comment