The only thing I hate worse than making mistakes, is repeating a mistake. Yesterday I was working through a very frustrating set of circumstances and had gotten myself micro-focused. This is a mental equivalence of painting oneself in the corner. Bassil Karam, one of the coolest guys you will ever meet and a very talented programmer, helped me out of my mental hole. I made several problem solving mistakes and I want to share them with others.
I am writing this as my personal penance. Maybe next time I'll shift my tactics a little sooner. So, without further preamble:
Rule 1: Don't fall in love with a solution
There's more than one way to skin a Cat. If your simple solution turns out to be a whole lot more complex than you intended, it is time to brainstorm some other solutions. Even if you return to your original solution, you can gain a new perspective by forcing yourself to think of alternative paths.
Rule 2: Don't Fight complexity with complexity
Rule 3:Identify the true problem
"Any software problem can be solved by adding another layer of indirection. Except, of course, the problem of too much indirection." - Steve Bellovin of AT&T Labs
If you find yourself continuously adding indirection, maybe you should step back and regroup.
Rule 4: Regroup and use a small unencumbered test case to prove your solution.
While sometimes counter intuitive, building external test cases is an economical way to developing solutions.
Yesterday, I was solving a simple problem in a complicated environment. I was running behind, frustrated and convinced I had a working solution, if only it would work! Stepping outside that environment and building a test harness seemed like a waste of time when it would have really SAVED time. When you get stuck, stop, build the SMALLEST test case that proves the point, then proceed ahead with the regularly scheduled programming!
This is by no means an exhaustive list. If you have personal rules that help you develop solutions, please leave them in the comments for others to enjoy!