It’s All Right – The Daily WTF – The TechLead

[ad_1]

Mark recently inherited a Java codebase that… well, it’s going to need some support. He thought things were bad when he encountered this:

 if (isCheckedOut.equalsIgnoreCase("0")) 
	…
 

This isn’t much of a WTF, beyond the standard “using strings to hold numeric values” problem, but it does make us think about what an upper-(or lower-)case number might look like.

I’m gonna call “€” an uppercase three, and see who notices.

But the bit of code that made Mark stop and send us this pile, was this one:

  public boolean isAll() 
   if (this == null) 
     return false;
   
   return true;
 

This function always returns true. There’s no world in which this could be null. It doesn’t even make sense- you can’t invoke a function an a null. But also, what is that name? isAll? Is all what? isAllWrong? Yes, it absolutely is. I have no idea, and cannot guess, what that name was trying to communicate.

At this point, I feel like I should also complain about conditionals to return boolean values, but I’m still too hung up on that name. isAll? isAll?!

[Advertisement]
ProGet’s got you covered with security and access controls on your NuGet feeds. Learn more.

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *