Friday, January 3, 2014

No Excuse For Code Abuse

What would cause anyone but a complete raving idiot to write Java like this?
if ("D".equals(action))
    action = "D";
...
if ("I".equals(action))
   action = "I";
...
if ("U".equals(action))
    action = "U";

6 comments:

David said...

Paid by the line + no code review => Profit!

jdege said...

Being paid per line of code.

Rob K said...

Unboxing? Or maybe debugging lines to set break points on.

Mauser said...

Maybe there's some weird typecasting action going on behind the scenes there. char vs String.

Joseph said...

This may be have translated from another computer language by a program that was also buggy.

Clayton Cramer said...

Joseph: I wish that this was the case. The highly paid consultants that wrote much of this code did lots of stuff not even this clever.