Source code project 1171

The year was 2006. Nelly Furtado was getting promiscuous, the Winter Olympics were in Italy, and Domino was an application developer for Rocketware, a company that produced multimedia applications. Back then, applications were still commonly distributed on CD-ROMs: small round disks of plastic that contained grooves that could be read by a specialized laser and interpreted as data. This was handy in a period when only 30% of Americans had broadband Internet.

Rocketware had done some software for a government agency, which of course had been bundled with a support contract for updates, paid in advance. Maintenance for this application fell into Domino's lap, and he was soon asked to do a small update.

Unfortunately, the software had been written by an infamous pair of numbskulls. Jessie and James had both been fired over a year previously for sheer incompetence, but they'd worked on this project together, meaning it was a ball of spaghetti held together by twine. Or at least, it probably was. Problem number one on Domino's plate: finding the source code.

The application wasn't in any of the source code repositories; Jessie and James hadn't "believed in" version control. They would've been forced to use it during their tenure, but James had also done network support, and therefore had had access to the bare repositories when he'd been fired. Domino suspected that, in retaliation for being forced to use source control, James had deleted his projects before being escorted from the building.

Thankfully, the pair had lacked access to the backup facility. Domino took the latest backup, added a new database, and implemented the fix: 5 hours of work, after about 3 hours of combing through backups to find the right version. Done and dusted. Right?

Wrong. The agency quickly complained of features missing, of old bugs re-introduced. Clearly that wasn't the version that'd been burned onto the CD and mailed to them, but the source code for that version was nowhere to be found.

Domino's boss, Giovanni, asked him to just go ahead and re-implement the missing features, see if he couldn't get things working to the agency's liking.

Now, this application wasn't any old application. The source code consisted of about 10k lines of Lingo code, entirely undocumented of course, and another 10k lines of ActionScript 1.0. There were 20 files, hundreds of frames and clips, a handful of data conversion tools written in Pascal, an Access database, a V12 database, and even some Excel spreadsheets. It was the Wild West: a little of everything, held together with duct tape and prayers. Still, Giovanni insisted that Domino clean up this mess as best he could:


deXML = deXML & "<voornaamste txt=" & QUOTE
  --put thelist
  aantal = thelist.count
  if aantal > 4 then
    aantal = 4
  end if
  the floatPrecision = 0
  repeat with teller = 1 to aantal
    blubber = thelist[teller].getProp(#AANTAL)
    if blubber < 1000 then -- 999
      stringblubber = string(blubber)
    else
      if blubber < 10000 then  -- 9999
        stringblubber2 = string(blubber)
        stringblubber = chars(stringblubber2, 1, 1) & "." & chars(stringblubber2, 2, 4)
      else
        if blubber < 100000 then -- 99999
          stringblubber2 = string(blubber)
          stringblubber = chars(stringblubber2, 1, 2) & "." & chars(stringblubber2, 3, 5)
        else
          if blubber < 1000000 then -- 999999
            stringblubber2 = string(blubber)
            stringblubber = chars(stringblubber2, 1, 3) & "." & chars(stringblubber2, 4, 6)
          else
            if blubber < 10000000 then -- 9999999 9.999
              stringblubber2 = string(blubber)
              stringblubber = chars(stringblubber2, 1, 1) & "." & chars(stringblubber2, 2, 3) & "." & chars(stringblubber2, 5, 7)            else
              stringblubber = string(blubber)
            end if
          end if
        end if
      end if
    end if
    deXML = deXML & Propercase(thelist[teller].getProp(#NATIONALITEIT)) & ": " & stringblubber
    if teller < aantal then
      deXML = deXML & "%0D"
    end if
  end repeat
  the floatPrecision = 2
  deXML = deXML & QUOTE & "/>"

He couldn't do it. Three days into the project, he was back in Giovanni's office, ready to throw in the towel. "Nobody can work with this mess," he insisted. "Only James would know why he did the things he did, or where to even start."

"So get James to come in and explain himself," Giovanni replied.

Domino was incredulous, but somehow, Giovanni got the guy on the phone and convinced him to come in and sit with Domino.

The first question Domino had was easy: "Where's the latest source code?"

"Dunno." James seemed more interested in Domino's bobblehead collection than the code in front of them.

"Was it in source control? Look, I won't tell, but if you deleted it ...?"

"I didn't. Must've been a glitch or something." The George Bush bobblehead jiggled under James' finger.

"Okay, well, what about this?" Domino tapped at his monitor. "What's up with this code? Why is it like this?"


//find next value that can be divided by "value"
value +=1
while(value % steps <>0){
value +=1
}

"If it doesn't work, you just have to debug it," replied James, lifting up the Barry Bonds bobblehead next.

After an hour of pulling metaphorical teeth, Domino gave up, sarcastically thanked James for his time, and had him escorted out again. There was no help to be had from this quarter. He'd have to go it solo.


// check if value is negative
value=value.toString();
if(value.substr(0,1)=="-"){
//Value is negative
...
}

150 hours later, Domino was on the verge of quitting himself. Three builds in, and nothing was working right. If he fixed one issue, ten more things would break. The work was spiraling out of control, bugs being introduced exponentially.

Finally, finally, Giovanni agreed to let Domino just rewrite the entire application ... after he finihed his other projects.

200 man-hours later, they had something they could deliver, this time in source control and infinitely more maintainable.

Of course, that's when the agency really started complaining about all the "features" Domino had "removed" when he fixed obvious bugs. But that's a tale for another website.

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