Article 5ZTSB CodeSOD: Magically True

CodeSOD: Magically True

by
Remy Porter
from The Daily WTF on (#5ZTSB)

Matt P was spending a few hours trawling through a Java code base, working through the poorly documented logic and the bugs and the odd conventions. It was the kind of code base that rightly eschewed "magic numbers", favoring constants, but was also the kind of code base which took that to an extreme which arguably didn't help readability.

For example:

 protected static final boolean BOOLEAN_TRUE = true; protected static final boolean BOOLEAN_FALSE = false;

It's no file not found, but it's important that we clearly define what we mean by true.

otter-icon.png [Advertisement] Otter - Provision your servers automatically without ever needing to log-in to a command prompt. Get started today! TheDailyWtf?d=yIl2AUoC8zA
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