My Problem Solving Loop
2009
There is nothing more satisfying in the world then solving a good problem. Some would say, and I would have to agree, that programming is more about solving problems, then just telling a computer what to do. If problem solving is important to programming, why do most programmers do it so badly? I think it’s a lack of a systematic application of a problem solving loop.
I know what you’re thinking. “He’s lost it, gone crazy, too much coding time, time for reboot.”
I don’t think I’am crazy, but if you do by the end of this post, drop me a comment and let me know.
Answer honestly and nobody gets hurt.
If you can answer all of these questions with “No,” then you have a great problem solving loop or no problems. Either way, you are good.
- Have you ever solved a problem that someone did not have?
- Have you ever beat your head against a wall for more than 8 hours trying to solve a problem?
- Have you added features to a program that are never used?
- Have you ever fixed a problem with some google code that broke when deployed to production?
- Have you ever…I think you get the point.
Here is my approach to solving problems
Identify
Ask yourself, do you truly have a problem and is it worth solving?
Some people see a problem and just start fixing it, immediately, without even thinking about the consequences. There are always consequences even in programming. You need to consider the pros and cons of fixing the problem. Working on problems might not be as important as working on your client’s real problem.
Research
Ok, now you need to know if anyone else has solved for X or a derivative of X? Research the problem with your trusty browser and see how others have solved the same problem. Most problems are not new. Most, if not all, have been solved for at least twice. Study history and you will not repeat the same mistakes, works for programming also.
Test
Define a metric for success and automate the test. If the tests pass, you have no more problems. This eliminates the gold plating or extra features problem.
Apply
Code the solution and integrate. This, of course, would include unit testing and tracer bullet type development practices.
Confirm
Run those automated test again and see how well you’ve done. You rarely get it right the first time, and if you do, I would be suspicious of your tests.
Recognize
Try to recognize the sound of your head hitting an immovable object before you waste anymore time. I have been guilty of this myself once or twice. There is nothing wrong with heading down the wrong path, as long as you recognizing it early.
Reevaluate
Is solving the problem still worth the time you have spent plus another loop around the problem solving loop?
Repeat
If the problem still needs to be solved, then spin it again, from the top.
Conclusion
Programming takes a special kind of analytical mind that likes to solve problems, but solving every problem is a problem in itself. The better programmers know where to apply their limited resource. Do you?