This week there were two occasions when I had chance to glance at some code shortly before it was due to be rolled out to live. In both cases I looked over the code, not in any official capacity as both had been through testing and peer reviewed before I even set eyes on them.
However I found underlying problems in logic that would result in either unhandled exceptions or the wrong information being transmitted. Neither is a good outcome and I pushed both of these back to be refactored by the developer.
At no point do I consider superior to any of my co-workers but it struck me as weird that I was able to spot such things after only a cursory look at the code. Maybe it’s due my history in mainframe coding, where running your code was a right pain in the arse, so beforehand you walked through the logic to ensure it worked as it needed to.
In my COBOL years when I was new to everything in the workplace and I was learning the ropes I had a co-worker named Tim, to whom I owe much of my early programming skillsets. I wasn’t that he told me how to solve issues, but rather how to get myself in the correct frame of mind to analyse my work, processing the code like the the machine would.
Maybe in today’s development environment it’s too easy to just compile and run the code and check the output rather than walking through the lines.
If the output is correct then this code goes to testing, again the same tests are performed just by a non-developer. The same tests are going to pass again and this code will be lined up to go live, where the end user will subject the code to more variations and non-test condition situations than could have catered for.
I know this is of course one area that test driven development looks to improve matters, I truly look forward to the day I get to see some TDD that is implemented correctly rather than half baked attempts that just cater for the happy path testing.
Maybe I’m fast approaching the “I’m getting too old for this shit” destination of my working life. Somedays it really feels that way, however other days, like today, I wonder if I need to step up and teach those less knowledgeable developers those lessons that I was given that turned me into the Pain the Arse I am today.