September 2008 Archives

An Alternative to Boolean Parameters

I'm always uneasy when I see boolean parameters, particularly in a public method signature.  I think they're a minefield for misunderstanding because they're so information poor.  Really, it's one bit of information, which is good for computers but terrible for people.  Until recently, I've always thought in terms of creating two methods for each boolean parameter.  Sometimes this is good but sometimes not really.

Yesterday, I came across a suggestion in Effective Java (2nd Ed.) that I like: use Java 5 enums instead of booleans. Two advantages

  1. the enum values can be made much more readable than true or false
  2. the values can be extended if there are more than two scenarios in future

Off the Index, Yay!

From what I can tell, this site no longer features in the big G's index, which means that my resume and this blog can no longer be found through a search.  There's a sad side to this, because it means that my old posts, that some people did find helpful, can no longer be found.  I don't think this is a big deal because, with the size and variety of the worldwide web, answers to questions can be found elsewhere.  Besides, some of those posts are dated in terms of technology.  I no longer use it and I doubt others do.

The happy side is that I get to write what I want when I want without fearing an audience.  This site may or may not get back into the index.  (I suspect that upgrading the blog software and the associated churn probably caused a few dings, which wouldn't have helped after not adding any new non-content for a couple of years.)  It matters not, one way or the other.  The main thing for me is to get unblocked and not being in the index, I feel I have breathing room.