The company I work for has used a couple of 3rd parties to develop a some of our projects. The code you get back is usually quite bad to begin with, but yesterday I found the ultimate in bad code.
How not to code:
Actionscript:
-
switch(imageList.length){
-
case 1:
-
this._imageList.push(chooseType(pcurlImage1, curlImage1, typeArray[0]));
-
rowNum = 1;
-
break;
-
case 2:
-
this._imageList.push(chooseType(pcurlImage1, curlImage1, typeArray[0]));
-
this._imageList.push(chooseType(pcurlImage6, curlImage6, typeArray[1]));
-
rowNum = 1;
-
break;
-
case 3:
-
this._imageList.push(chooseType(pcurlImage0, curlImage0, typeArray[0]));
-
this._imageList.push(chooseType(pcurlImage3, curlImage3, typeArray[1]));
-
this._imageList.push(chooseType(pcurlImage6, curlImage6, typeArray[2]));
-
break;
-
case 4:
-
this._imageList.push(chooseType(pcurlImage1, curlImage1, typeArray[0]));
-
this._imageList.push(chooseType(pcurlImage4, curlImage4, typeArray[1]));
-
this._imageList.push(chooseType(pcurlImage6, curlImage6, typeArray[2]));
-
this._imageList.push(chooseType(pcurlImage9, curlImage9, typeArray[3]));
-
break;
-
case 5:
-
this._imageList.push(chooseType(pcurlImage1, curlImage1, typeArray[0]));
-
this._imageList.push(chooseType(pcurlImage3, curlImage3, typeArray[1]));
-
this._imageList.push(chooseType(pcurlImage5, curlImage5, typeArray[2]));
-
this._imageList.push(chooseType(pcurlImage7, curlImage7, typeArray[3]));
-
this._imageList.push(chooseType(pcurlImage9, curlImage9, typeArray[4]));
-
break;
-
case 6:
-
this._imageList.push(chooseType(pcurlImage0, curlImage0, typeArray[0]));
-
this._imageList.push(chooseType(pcurlImage1, curlImage1, typeArray[1]));
-
this._imageList.push(chooseType(pcurlImage2, curlImage2, typeArray[2]));
-
this._imageList.push(chooseType(pcurlImage5, curlImage5, typeArray[3]));
-
this._imageList.push(chooseType(pcurlImage6, curlImage6, typeArray[4]));
-
this._imageList.push(chooseType(pcurlImage7, curlImage7, typeArray[5]));
-
break;
-
case 7:
-
this._imageList.push(chooseType(pcurlImage0, curlImage0, typeArray[0]));
-
this._imageList.push(chooseType(pcurlImage2, curlImage2, typeArray[1]));
-
this._imageList.push(chooseType(pcurlImage4, curlImage4, typeArray[2]));
-
this._imageList.push(chooseType(pcurlImage5, curlImage5, typeArray[3]));
-
this._imageList.push(chooseType(pcurlImage6, curlImage6, typeArray[4]));
-
this._imageList.push(chooseType(pcurlImage7, curlImage7, typeArray[5]));
-
this._imageList.push(chooseType(pcurlImage8, curlImage8, typeArray[6]));
-
break;
-
case 8:
-
this._imageList.push(chooseType(pcurlImage0, curlImage0, typeArray[0]));
-
this._imageList.push(chooseType(pcurlImage1, curlImage1, typeArray[1]));
-
this._imageList.push(chooseType(pcurlImage2, curlImage2, typeArray[2]));
-
this._imageList.push(chooseType(pcurlImage3, curlImage3, typeArray[3]));
-
this._imageList.push(chooseType(pcurlImage5, curlImage5, typeArray[4]));
-
this._imageList.push(chooseType(pcurlImage6, curlImage6, typeArray[5]));
-
this._imageList.push(chooseType(pcurlImage7, curlImage7, typeArray[6]));
-
this._imageList.push(chooseType(pcurlImage8, curlImage8, typeArray[7]));
-
break;
-
case 9:
-
this._imageList.push(chooseType(pcurlImage0, curlImage0, typeArray[0]));
-
this._imageList.push(chooseType(pcurlImage1, curlImage1, typeArray[1]));
-
this._imageList.push(chooseType(pcurlImage2, curlImage2, typeArray[2]));
-
this._imageList.push(chooseType(pcurlImage3, curlImage3, typeArray[3]));
-
this._imageList.push(chooseType(pcurlImage4, curlImage4, typeArray[4]));
-
this._imageList.push(chooseType(pcurlImage5, curlImage5, typeArray[5]));
-
this._imageList.push(chooseType(pcurlImage6, curlImage6, typeArray[6]));
-
this._imageList.push(chooseType(pcurlImage7, curlImage7, typeArray[7]));
-
this._imageList.push(chooseType(pcurlImage8, curlImage8, typeArray[8]));
-
break;
-
case 10:
-
this._imageList.push(chooseType(pcurlImage0, curlImage0, typeArray[0]));
-
this._imageList.push(chooseType(pcurlImage1, curlImage1, typeArray[1]));
-
this._imageList.push(chooseType(pcurlImage2, curlImage2, typeArray[2]));
-
this._imageList.push(chooseType(pcurlImage3, curlImage3, typeArray[3]));
-
this._imageList.push(chooseType(pcurlImage4, curlImage4, typeArray[4]));
-
this._imageList.push(chooseType(pcurlImage5, curlImage5, typeArray[5]));
-
this._imageList.push(chooseType(pcurlImage6, curlImage6, typeArray[6]));
-
this._imageList.push(chooseType(pcurlImage7, curlImage7, typeArray[7]));
-
this._imageList.push(chooseType(pcurlImage8, curlImage8, typeArray[8]));
-
this._imageList.push(chooseType(pcurlImage9, curlImage9, typeArray[9]));
-
break;
-
}