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:

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

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

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

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

    ReplyDelete
  5. 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.

    ReplyDelete