Article 6AQ87 CodeSOD: Self-Documentation

CodeSOD: Self-Documentation

by
Remy Porter
from The Daily WTF on (#6AQ87)

It's rare to find truly self-documenting code. Adam, however, while hunting down a bug, found some.

Adam was trying to understand exactly where some functionality was coming from in a Java program. The code base had some very long inheritance trees, which was an absolute nightmare for maintenance. The mix of overridden methods and mysterious interfaces and dependencies from the lowest levels of the hierarchy all the way back to the top created some of the most spaghettied spaghetti code you could imagine.

While investigating, Adam found this wonderful piece of self-documenting code, sitting right at the top:

public interface NotThatVeryUsefull{}

Several base classes implemented this interface, and from them every other class implemented that interface. It was never used for polymorphism, not that doing so would have been terribly useful (just cast to Object at that point). Nothing about this is useful. I'm sorry, "usefull".

proget-icon.png [Advertisement] ProGet's got you covered with security and access controls on your NuGet feeds. Learn more.
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments