Monday, March 07, 2005

shit code

I've been talking a lot about X-Men producing crappy code, so today I like to give an example.
The project that I am involve in uses . In Struts, a request is routed to the execute method of an Action class based on the struts-config mapping. This one particular action class written by an X-Men is horrible. This execute method is 700+ lines long. A lot of codes were duplicated and I suspect that it was copied and pasted which could have been extracted out into functions.

Looking at it will make you feel nausea, and to think that I've got to make some changes to it.
GD it!

Here is another classic.

if (collection == 0) {
statements;
}
statements;
for (e : collection ) {
statements;
}

It was not clear to me at first that the FOR loop was use as the ELSE part of the IF statement and got me really confused.

So this is the kind of quality work you get from a "highly skilled" X-Men. If you got one in your office, I say that your boss has been suckered into paying an astronomical amount of money which could've been your year end bonus.

Technorati Tags:



No comments: