23 June 2017

0xDEADC0DE

Deadcode is perilous. When we work we should be careful to avoid letting deadcode accumulate. I had a recent experience where my pair partner and I modified some deadcode thinking it was the correct place to inject our new feature. We then tested it thoroughly and deployed it into our development environment. Then we tested it more there to make sure it was working right, and finally we had an acceptance review of the code. Everyone gave us the thumps up and we moved on to the integration environment. We thought we were done. 

Turns out, this was deadcode and it never gets run when you follow the process for deployment. Of course we didn't know this and we'd forced its execution in our testing, causing us to break several machines. Fortunately not critically. Once we discovered our mistake we back tracked, unwound the change in each environment we'd touched, and reworked the code in the correct place. Along the way, we removed the deadcode. 

We were really glad we discovered this in the integration environment and not production. We would have exposed ourselves to some pretty significant risk. Granted, I don't think anyone would have been hurt, but it would have been egg on our faces for having done this; and it would not have worked correctly and provided the feature we wanted. 

So, cautionary tale, clean up after yourself to avoid mistakes like this.