I thought I had seen most things, but yesterday was given some code snippets (not produced at Sun) on how you can make things much harder than they really are.
Say that you want to check the condition of a Boolean. Most people would use
if (b) {
// do stuff
}
But someone didn't think that was clear enough, so they used
if (b != false) {
// do stuff
}
I though that was pretty bad, but then this masterpiece appeared
if (b.toString().length() < 5) {
// do stuff
}
How on earth did they come up with that? The worst thing is that it is supposed to come from a real code base. I pity the ones who have to maintain it!





