"It took months of low quality, late delivered code," Scott C writes, "but a certain coder on our team was finally let go."

"I was the lucky one assigned to clean up some of his old code and noticed that several classes of his made reference to a particular utility package. I opened the package and found a single class with 24 methods filled with sad code."

public static boolean isNull(String val) {
    boolean error=false;
    if(val==null) {
        error=true;
        }
    return error ;
    }


public static boolean isNotNull(String val) {
    boolean error=false;
    if(val==null) {
        error=true; ;
        }
    return error;

    }


public static String isEmpty(String ss, String evt){
    String red = "";
    String s = ss.trim();
    
    if (s.equals("") && (!evt.equals(""))) {
        red = "#ff0000";
        }

    return red;
    }

Scott continues, "those were the 1st, 2nd, and 3rd methods in the utility class. The other 24 methods weren't much better."

"Methods 16 and 17 were particularly interesting, but mostly because of their signature."

public static boolean isIntentegerInRange(String integer, int min, int max)
public static boolean isIntegerInRange(String integer, int min, int max)

"Except for the additional 'nte' in the name, the methods were identical, character for character. And both were used about equally throughout the code."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!