I've recently been reassigned to a project that was "finished" and has been "working" for the last two years. This project was written by a co-worker who is no longer with us (he found a better paying job elsewhere in town). After he leaves, the customer gets so upset about the software not working that my boss finally tells me to drop everything else and fix the code. This project is so full of wtf it's depressing.
Let me go over a few:
1. Extreme code copy and paste. He just didn't seem to appreciate the awesomeness of functions. It's common for me to reduce 700 line files to 300 line files by just implementing functions. And no, we're not paid by lines of code.
2. Abusing try catch blocks everywhere. On functions that would fail or would have problems from time to time, he would simply wrap the whole thing in a try catch. He didn't log these errors in any way. Instead he thought it would be better to display exception messages to the users. Because the users definately understand them and know what they mean. Also, everyone knows its more fun to debug problems by having customers send screen shots of the error messages.
3. For some reason the users weren't getting all the normal output messages either:
If procDetails.Count <> 0 Then
For x = 0 To procDetailsCount - 1
sNewStringProc = procDetails(x).ToString
I like the unnecessary if statement. The actuall bug is pretty good too (only displaying the last message). But the part that just really makes me proud is the substring which returns the entire string.
I am starting to wonder if all his code is just examples from somwhere on the web. The best part of all this, I know for a fact that my boss would hire this guy back. They have such a hard time finding programmers here, that they will take just about anybody. It makes me so proud to work here.
[Fixed typo. -ShadowMod]
I don't really follow.. What does this line do?
For x = 0 To procDetails(x).Count - 1
It looks like a for loop but it uses x to determine the last value of the loop? Is that right?
Yeah that's a typo. It's just a basic for loop. Should be
For x = 0 To procDetails.Count - 1
They have such a hard time finding programmers here, that they will take just about anybody.
Bolivia? Send them my name!