Home > News, Projects > Some nerd humor

Some nerd humor

April 7th, 2009

I wrote this lovely bit of code today whilst confused and frustrated working on a particularly messy command…and its just plain funny.

for(var i:int = 0; i < localSubSwfArray.length; i++){
 
		if( localSubSwfArray[i] is LocalFile){
			getDetailsArray.push(LocalFile(localSubSwfArray[i]).uri);
 
			 localFileArray.push(localSubSwfArray[i]);
 
			 localSubSwfArray.removeItemAt(i);
			 i--;
		}
               else panelForTransport.SubSWFs.addItem(localSubSwfArray[i]);
}

I needed to push items into a one array if they were of a particular type, otherwise add them to another array. Thing is I somehow saw it necessary to remove the item from the original array (with no real purpose), which screwed up the positions for the next iteration of the for loop. My fix? Throw a decrement in there to offset it! This actually works despite how unnecessarily confusing it is, it just wasn’t the right solution.

For all you project managers out there, this is a perfect example of why Agile suggest developers never code more than 6 hours a day. Fat chance that any of us will ever see that implemented, but I still like to mention it.

ian News, Projects

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.