The Daily WTF
Back when I was still working for a large enterprise company, I did a lot of code reviews. This particular organization didn’t have much interest in code quality, so a lot of the code I was reviewing was just… bad. Often, I wouldn’t even need to read the code to see that it was bad.
In the olden times, inconsistent or unclear indentation was a great sign that the code would be bad. As IDEs started automating indentation, you lost that specific signal, but gained a new one. You can just tell code is bad when it’s shaped like this:
public List<Integer> getDocSectionsChanged(CustomerVersionTag versionTag) { Set<Integer> sections = new HashSet<>(); for (Map.Entry<String, List<String>> entry : getVersionChanges().get(versionTag).entrySet()) { for (F.Tuple<CustomerVersioningDocSection, Map<String, List<String>>> tuple : getDocSectionToSdSection()) { for (Map.Entry<String, List<String>> entry2 : tuple._2.entrySet()) { if (entry.getKey().startsWith(entry2.getKey())) { for (String change : entry.getValue()) { for (String lookFor : entry2.getValue()) { if (change.startsWith(lookFor))
To read the full article click on the 'post' link at the top.