Article 6FVFE CodeSOD: It's All Right

CodeSOD: It's All Right

by
Remy Porter
from The Daily WTF on (#6FVFE)

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?!

proget-icon.png [Advertisement] ProGet's got you covered with security and access controls on your NuGet feeds. Learn more.
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments