I'll let Bill Kempf take it away ...

A few years back, I was a developer at a credit card processing company. Our team inherited a J2EE web application that, well, has been around: just about every other team owned it at one time or another. Heck, it even got some "enhancements" from overseas outsourcing partners.

Naturally, the system had no form of engineering. No development methodology was employed. No source control was used. No unit testing was performed. No code reviews were performed. It'd be hard to even imagine how much of a mess this system was.

To give you an idea, here's a library function I found. It's a JavaScript method validates Social Security Numbers in the browser. Oh, and by "library function," I mean it was copy/pasted in every page that needed to use it.

I came across while hunting down a bug that caused some SSN to be rejected on some pages. It had no formatting (scrolling for two-and-a-half pages) and actually looked like a fairly advanced way to validate SSN. Upon actually formatting the code, it turns out the algorithm isn't so advanced afterall ...

After seeing this code, the future was crystal clear: in a very short time, I would no longer be with that company.

function validateSSN( ssn ) {
  if ( ssn.charAt(0) != "0" && ssn.charAt(0) != "1" && ssn.charAt(0) != "2" &&
    ssn.charAt(0) != "3" && ssn.charAt(0) != "4" && ssn.charAt(0) != "5" &&
    ssn.charAt(0) != "6" && ssn.charAt(0) != "7" && ssn.charAt(0) != "8" &&
    ssn.charAt(0) != "9" ) {
    return false;
  }
  if ( ssn.charAt(1) != "0" && ssn.charAt(1) != "1" && ssn.charAt(1) != "2" &&
    ssn.charAt(1) != "3" && ssn.charAt(1) != "4" && ssn.charAt(1) != "5" &&
    ssn.charAt(1) != "6" && ssn.charAt(1) != "7" && ssn.charAt(1) != "8" &&
    ssn.charAt(1) != "9" ) {
    return false;
  }
  if ( ssn.charAt(2) != "0" && ssn.charAt(2) != "1" && ssn.charAt(2) != "2" &&
    ssn.charAt(2) != "3" && ssn.charAt(2) != "4" && ssn.charAt(2) != "5" &&
    ssn.charAt(2) != "6" && ssn.charAt(2) != "7" && ssn.charAt(2) != "8" &&
    ssn.charAt(2) != "9" ) {
    return false;
  }
  if ( ssn.charAt(3) != "0" && ssn.charAt(3) != "1" && ssn.charAt(3) != "2" &&
    ssn.charAt(3) != "3" && ssn.charAt(3) != "4" && ssn.charAt(3) != "5" &&
    ssn.charAt(3) != "6" && ssn.charAt(3) != "7" && ssn.charAt(3) != "8" &&
    ssn.charAt(3) != "9" ) {
    return false;
  }
  if ( ssn.charAt(4) != "0" && ssn.charAt(4) != "1" && ssn.charAt(4) != "2" &&
    ssn.charAt(4) != "3" && ssn.charAt(4) != "4" && ssn.charAt(4) != "5" &&
    ssn.charAt(4) != "6" && ssn.charAt(4) != "7" && ssn.charAt(4) != "8" &&
    ssn.charAt(4) != "9" ) {
    return false;
  }
  if ( ssn.charAt(5) != "0" && ssn.charAt(5) != "1" && ssn.charAt(5) != "2" &&
    ssn.charAt(5) != "3" && ssn.charAt(5) != "4" && ssn.charAt(5) != "5" &&
    ssn.charAt(5) != "6" && ssn.charAt(5) != "7" && ssn.charAt(5) != "8" &&
    ssn.charAt(5) != "9" ) {
    return false;
  }
  if ( ssn.charAt(6) != "0" && ssn.charAt(6) != "1" && ssn.charAt(6) != "2" &&
    ssn.charAt(6) != "3" && ssn.charAt(6) != "4" && ssn.charAt(6) != "5" &&
    ssn.charAt(6) != "6" && ssn.charAt(6) != "7" && ssn.charAt(6) != "8" &&
    ssn.charAt(6) != "9" ) {
    return false;
  }
  if ( ssn.charAt(7) != "0" && ssn.charAt(7) != "1" && ssn.charAt(7) != "2" &&
    ssn.charAt(7) != "3" && ssn.charAt(7) != "4" && ssn.charAt(7) != "5" &&
    ssn.charAt(7) != "6" && ssn.charAt(7) != "7" && ssn.charAt(7) != "8" &&
    ssn.charAt(7) != "9" ) {
    return false;
  }
  if ( ssn.charAt(8) != "0" && ssn.charAt(8) != "1" && ssn.charAt(8) != "2" &&
    ssn.charAt(8) != "3" && ssn.charAt(8) != "4" && ssn.charAt(8) != "5" &&
    ssn.charAt(8) != "6" && ssn.charAt(8) != "7" && ssn.charAt(8) != "8" &&
    ssn.charAt(8) != "9" ) {
    return false;
  }

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