1. Dec 26th, 2006

    In defense of verbosity

    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.

    Flexible Rails
    • Flex 3 and Ruby on Rails 2 integrated with HTTPService and XML
    • RESTful Rails controllers that support Flex and HTML clients
    • Coverage of how to use Cairngorm to architect larger Flex applications
    • A full application--not just a toy--developed and refactored iteratively
    1. Dec 27th, 2006

      Joseph

      On that note, as much as I love Rails, I find it’s anti-parenthetic idiom disconcerting. It’s now desperately unfashionable to put curlies around my hash pairs when they’re the last argument in a method call, but still… I’ve been bitten too many times.

      Sure I might look silly in this cardigan, but grunge is coming back y’know.

    2. Dec 27th, 2006

      Assaf

      I use the curly brackets as a matter of style to distinguish between a hash variable, and the “named arguments pattern”.

      And yes, it’s not exactly an elegant solution that works right 100% of the time. It’s more borrowing one feature to implement another.

    Leave a Reply | Trackback | Track with co.mments

    Where's my comment? I get too much comment spam, so I have to moderate comments. Damn those spammers. If you don't see your comment immediately, be patient. I'll approve it the minute I see it. Want to know when your comment shows up, or check if anyone responded? Track it.

    Or using OpenID