A developer asked me for some help today. He tested out his code and threw it over the wall to the test team. They said his stuff did not work. Then he tried his code again. Sure enough it was broke. He could debug the C++ code using his Microsoft IDE. However he was stuck once it called some stored procedures in Oracle.

I told him the thing to do would be to activate some logging so he could build a bread crumb trail. That way he could figure out what was going on in the stored procedures. I call this the old printf style of debugging. So we sprinked some logging to a database table in his routines. Then we ran the code again.

Sure enough, some output was generated in the database table. We traced it down to the code he wrote. Then we iterated and added more logging in the local area where he thought the code was not working. All of a sudden, the application started working correctly. Wait what? I could not imagine just adding logging would fix the problem.

I gave it some thought. The logging did not magically fix his code. He was just not running the same version of the code that he was looking at. He just assumed that the version of code he worked on was what was deployed. Next time I should have him extract the source code of the stored procedures right out of the database. That would prevent this surprise.