91

I recently got my first job and I already saw code that I won't ever forget

for(int i=0; i < 2; ++i) {
switch(i) {
case 0:
~~~
break;
case 1:
~~~
break;
case 2:
~~~
break;
default:
~~~
break;
}
}

Comments
  • 25
    Congratulations on your first job! May your rants be few!!! 😃
  • 17
    Isn't that essentially the same as
    codeInCase0();
    codeInCase1();
    ?
  • 17
    @chadd17 it is, that's why I cried
  • 31
    @Glamhoth I didn't realize what was wrong with it for a good minute, and when it did, I was baffled by the impressive overengineering.
    Maybe the last guy got paid by the line.
  • 3
    Well I threw up a little. Hopefully they were either paid by the line or drunk... Or the cases modify i... Or SOMETHING
  • 2
    Piles of wtf there.
  • 6
    But it uses ++i for performance
  • 0
    @chadd17 I hope he did too!
  • 1
    @-eth Was it sarcasm?
  • 0
    He forgot to add //TODOs? 🙄
  • 1
    @CorruptComputer not useless, just additional safeguards 😂😂😂
  • 0
  • 0
    Please tell us i gets modified in those cases.
    And even then I think there are much better solutions.
  • 1
    In the beginning I thought it was the break at the end..
    But then I noticed switch(i)
    And I cried
    Also... How can it default? I mean... Yeah.. WTF!?
  • 1
    @Jijel nope, it's not :(
  • 1
    @Qaldim sadly and realistically we all know his rants will be many.
  • 3
    Boss: You need to make at least 100 lines of code for this!

    Me: Hold my coffee i got this.
  • 1
    @Akio I've never been employed. But is that for real? Some bosses really ask you for a certain amount of lines? How is this amount decided? And why is there such a limit? Isn't short code bette, as long as it's readable of course. I have so many questions...

    I can understand the need for an upper limit. But not the other way around.
  • 1
    @Jijel Sadly I can't tell either... I'll start working on August 1st but I assume it's not like that.
  • 1
    @Akio good luck. Hope you won't have any rant to post.
  • 2
    @Jijel I hope not but it will happen I guess... Companies are still full of idiots who act like shit and write code that's shit. But usually I rant about problems that require like 1 small change and I can't figure this out for like half an hour.
  • 1
    @Jijel some places do. The best way to avoid that crap hole is to not take a job where they do that kind of shit and if they start doing it then quit. Trust me your time and knowledge is wayyy too valuable to be dealing with crap like that.
  • 1
    Maybe it's a shitty state machine:

    ~~~~
    Case 1:
    If cond ? i=0 : i=i
    ~~~~

    Much state. So shitty
Add Comment