When Eli accepted a position nicknamed The Marshal, he knew he’d be in for a challenge. For many years, the company’s culture was dominated by cowboy coders and a frontiersmen attitude of just get’er done. Though many of the code-slingers had long since retired, the spirit of the Wild West still remained.

Strewn across the vast corporate expanse were dozens and dozens of ghost applications that weren’t on any IT Systems map, yet were still used by various business units. Some were small, living on an old workstation under a desk, while others were large, forgotten systems that once were fertile pastures of development.

Bringing law and order wasn’t something that could happen overnight, but Eli knew exactly where to start: the database. If he could simply choke the supply of queries to and from Oracle, scofflaw applications would have no choice but to turn themselves in with “access denied” error messages. Sure, the handful of applications that used illicit database engines would continue to elude justice, but those could always be caught another day.

After turning off free-for-all database access, it didn’t take long for the “access denied” messages to come up. In fact, one of the first offenders was an application that seemingly didn’t even need database access: a simple budget estimator. Since no development team took responsibility for the years-old app, Eli rolled up his sleeves and got his hands dirty wrangling with code.

public double calculateCostSQL(double cost,double discount){
    ResultSet rs = null;
    double resp = 0;
    try{
        String quer = null;
        quer = "SELECT "+cost+" - "+discount+" result FROM DUAL";
        rs = dbm.query(quer);
        if(rs.first())
        resp = rs.getDouble("result");
    }
    catch(Exception e){
        e.printStackTrace();
    }
    finally{
        try{
            if(rs != null){
                rs.close();
                rs = null;
            }
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
    return resp;
}

There was no fathomable reason why anyone would need to bring in Oracle for a simple subtraction, and Eli didn’t give it a second though. He simply strung up the code and put it out of its misery, replacing the entire body with a simple return cost-discount;.

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