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 properly
if (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.

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