Article XRD9 CodeSOD: Leaving an Honest Comment

CodeSOD: Leaving an Honest Comment

by
Remy Porter
from The Daily WTF on (#XRD9)

Apo's workplace just recently migrated their code into source control. They have eight years of code that's been written and maintained by developers using a network share as their central repository.

// Special treatment for Attribute "weight unit"// Needs to be mapped to more readable values for display because SAP is using some ISO codes that are not understandable// by normal users. Hence, if we encounter this attribute, we map it to resemble an easier understandable unit// Yes, this is all hardcoded, yes "one" should not do that// Please redirect any complaints to the peeps who do budgeting and the customer who is not paying to do this properlyif (idAttribute_ == 18500) { if (textblock_ == "KGM") { textblock_ = "KG"; } if (textblock_ == "MGM") { textblock_ = "MG"; } if (textblock_ == "GRM") { textblock_ = "G"; }}

Apparently, they don't have the budget for a hash map. Apo discovered this when the customer complained about the formatting for tons. Unfortunately, he was tackling the problem while juggling 300 other higher priority customer issues, so instead of spending five minutes to clean it up, he spent 30 seconds adding another if statement.

puppetlabs50.png[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today! TheDailyWtf?d=yIl2AUoC8zAIzmfF0YIPtU
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