
From Daily WTF:
existingCustomerForm.setError(Boolean.FALSE.booleanValue());
Can you think of a longer way to write ‘false’? But what if this is a better way to write false?
You can stop laughing now … ok, I’ll wait … done?
I’m not talking about some parallel universe where verbosity is a form of art, but the universe we live in. Just a few cubicles across from you.
Think about it for a second. Boolean is the class in charge of all things true or false, so it’s a form of authority on the subject. FALSE is a constant, and constants as we all learned in Programming 101, don’t change. And booleanValue is more reliable than the dark magic of auto-boxing. Put them all together, and you’ve got three measures to make sure you got the right value!
Yeah, that was funny, but what if it’s true?
Code … you spend a while writing it, and it doesn’t work. You spend longer fixing it, and it works for you. Then come the users, and another round of fixing. Q&A, more data, new features, custom extensions, it’s a never ending cycle of breaking and fixing, and fixing the fixes.
Computers may operate on zeros and ones, but code is flakey, annoyingly unpredictable and sometimes downright evil.
Against this backdrop, some developers try to attack every problem by bringing it to its logical solution. They practice their craft daily, always striving to be more learned in the dark art of fixing and testing. Some developers simply stay away from fixing touching the private parts. They practice a voodoo mentality: whatever works.
For the later, this example is not a practice in verbosity, but an anchor in safety. A guarantee that maybe things won’t explode in you face when you hit ‘run’. If it sounds like an emotional reaction to code, that might be it, but then software doesn’t alway behave rationally. It’s only us fools who think logic is the best solution.
Picture by David Wilmot.

