Wednesday, April 30, 2008

Troubleshooting: Simple Stuff First

I spent a lot of years running and fixing radar systems on big airplanes while flying around cool places like Iceland, Saudi Arabia, and Alaska.

One of the hardest lessons I learned (or had beaten in to me by crusty old sergeants) was that you always, ALWAYS look for the simplest solutions first when troubleshooting.  In my early years I was always diving in to the books to pull out the four-page fold out schematic instead of first using some elementary deduction to get some quick checks out of the way. This same principle carries directly over to ANY form of troubleshooting, not just trying to figure out why dots aren't appearing on a radar screen.

Today I had a good reminder of that when trying to figure out a problem in a system we built.  Custom security roles weren't being recognized by one component which maps records in a database table to business objects based on an enumeration.  I jumped into the debugger and started stepping through the component where the disconnect was (sorry, no test around it, and it had been months since I'd been in that part of the code).

I quickly found this wasn't the best use of my time, and instead went to a very rudimentary step: double-check the values in the database.  Some close examination immediately led me to the source of the problem: someone had added spaces to the role name in an attempt to make them more readable.  "UserType" became "User Type" and "BusinessFunction" became "Business Function".  This may look nice for humans but causes some issues in code...

That quick check saved me from losing more time in the debugger trying to wind my way back to where that initial comparison was happening.  The simple thing won out over the more complex thing.

We geeky types like solving tough problems and too often we get carried away with looking for the harder answer when the simple answer is sitting right in front of us.

(On a related note, if you haven't already, grab a copy of Debugging by David Agans and read through it several times.  Highly worthwhile to help polish your troubleshooting skills.)

No comments:

Post a Comment