Here’s a little method I came across in my travels recently that simply beggars belief. I’m not naming names or codebases, suffice to say it wasn’t in ours. It was too good not to share, so I’ve come out of early blogging retirement to post it:
java:
I don’t even know where to begin to describe what’s wrong with this method. For your sake, I hope I don’t have to ;-) The icing on the cake was the accompanying “convenience” method:
Truely inspired stuff.
The only convenience that came to mind when encountering these methods is the one down which I really wanted to flush this code. I’ll leave the last words to the innocent victims of these methods, B1 and B2.

I wonder what the unit tests for that look like! — David Aug 3, 02:16 AM #