The Daily WTF
Chris was given a program and told to improve it by adding tests. That was a good start to a terrible experience. Just getting it to build was a chore, as the build files had absolute paths hard-coded into them.
But the real problem Chris ran in to is that it’s hard to write tests for something if no one knows what it does or why it does it. The application had no documentation. No comments, aside from commented out blocks of dead code. But comments aside, there was no other documentation. Which left Chris with methods like this to work with:
public int priority() { switch (this.type) { case 1: case 2: return -1; case 3: case 4: return -1; case 5: return -1; case 6: return 1; case 7: return 2; case 8: case 9: return 3; case 10: case 11: case 12: return 4; case 13: return
To read the full article click on the 'post' link at the top.