Some Java code I looked through to figure out how to accurately rework a mapping of value intervals to status colors:

• 16 levels of indentation
• Calls an instance method one line before a null-check
• Assigns that same value to a new variable and null-checks it again
• Insistently loops over existing HashMaps' entry sets to find a value by key
• Stringifies a Gson object, parses back the string and then null-checks the result.
• Mixes up the 'leq' and 'geq' comparison operators twice, which is why I went to check the implementation in the first place.

And this wasn't even legacy code. It's from last year.

  • 2
    It's legacy the minute some says "Yup, it's done without a code review".
Add Comment