“Hey, Kim H, can you sit in on a tech-screen for a new hire?”

The Big Boss had a candidate they wanted hired, but before the hiring could actually happen, a token screening process needed to happen. Kim and a few other staffers were pulled in to screen the candidate, and the screen turned into a Blue Screen, because the candidate crashed hard. Everyone in the room gave them a thumbs down, and passed their report up the chain to the Big Boss.

The Big Boss ignored their comments and hired the candidate anyway. A week later, this ended up in source control:

public static ProductCodeModel GetProductCode(int id) {
    for (int i = 0; i <  GetProductCodes().size(); i++){
        if(i==id) return GetProductCodes().get(i);
    }
    return null;
}

Obviously, the loop is unnecessary. The real kicker is that GetProductCodes loads its data out of a file each time it’s called. It contains thousands of lines, which means to access any individual product, the entire file has to be read into memory, id times, and if it's the last product code in the datafile, you have read the file N times.

[Advertisement] ProGet can centralize your organization's software applications and components to provide uniform access to developers and servers. Check it out!