As a programmer I spend hours each day (yeah even many weekends) looking at code and while I love it there seems to be one specific issue that keeps getting me, missing obvious mistakes in my own code.
The Catalyst
The issue that finally broke my will to live and made me write this blog post came a few weeks back when working on getting Redmine setup to manage my projects. The whole process went according to plan (well maybe I had some help) till it came to setting up email through my Google Apps domain.
For those who don’t know I’ll provide a bit more detail. When setting up Redmine you have to configure your email client. It’s not a text field in the settings but a file in the application itself. No having it in a text field in the admin would not have helped me at all.
It took me 2 hours on two different days to get the email working (no this has no reflection on Redmine, read on). I read blog posts, combed through issues on the Redmine site, stuck my tongue out while coding, and nothing worked. It’s only as I beat my head against the table yet again that something jumped out…I spelled the username/email wrong in the configuration file.
I suppose the fact that I was getting errors from Redmine saying there was an issue with the username or password and that the login was failing should have been my first clue, but I guess the hammer wasn’t big enough to knock sense into me.
The real issue is not that I made a spelling mistake but the fact that it took me 4 hours to find it spread over two days. Why didn’t the incorrect username jump out at me right away? Redmine is a solid piece of software with good testing. All the blog posts I read said to do what I was doing (mind some were for older versions), and yet I missed a simple spelling mistake. Something in my head just didn’t want to see the forest for the trees.
Learning It All Again
I’m sure that I’m not alone here in saying this is not the first time I’ve had to learn this lesson. There is no way I could count the times that I struggle with implementing something on a site and after spending days (sometimes) I realize that I’ve made a spelling mistake, syntax error, didn’t link to a script…. The hard thing is how do I stop myself from learning this over and over again?
Got any suggestions?
3 responses to “Missing the Forest for the Trees When Coding”
Try reading your code backwards when you’re searching for errors.
I think this happens to all of us at some point no matter how much experience we have.
Personally, I’ve found that Google can be my enemy when these things occur. It’s tempting to start doing a bunch of searches to find out if anyone has had the same problem, but if it’s just a silly mistake by me I’ll only end up following false leads and waste my time looking for non-existent issues before I realise I’m no closer to having it working. It’s like chasing the end of a rainbow. In the meantime I’m not doing what really needs to be done to solve it – looking at the code!
Yeah that’s where I get stuck. Maybe the plain of action is not to go to Google looking for solutions to problems but to read your code in detail a few times, even backwards as Miles suggests. If nothing comes up then head over to Google.