Skip to content →

Depth first vs breadth first problem solving

In the book "Pragmatic Thinking and Learning: Refactor Your Wetware" by Andy Hunt he writes about generating several ideas to solve a problem before testing one out. First when you have several approaches to solving it should you try to implement them, but not necessarily completely. The art is to now when to stop and jump to the next one, and possible back again. Always generating information and a bigger understanding of the problem at hand. The aim is also to avoid a full implementation of an idea just to find out that the next idea, or the next thereafter, clearly is better.

Whenever I have a problem at work that I need some help or input on I would ask a more experienced programmer. With Andy Hunts advise in mind I started to notice that it was exactly what the person helping me was doing. He/she would talk out loud, about different solutions. I, being eager to solve the problem, would quickly abandoned Andys advice and say: "That would probably work, lets do it that way!".

A good programmer has an acute sense of navigations on the spectrum of depth and breadth when trying to solve a problem. Breadth being the different approaches and depth being the implementation of one. The entire time she generates more and more information about the problem at hand. She would try to implement one of the suggestions but always stop in time to see if another approach is better. According to Andy Hunt this intuition develops exclusively as one becomes an experienced programmer. On my quest I now try to do more brainstorming and see a problem from different angels. I search on the internett, ask colleges and try think outside of the box. I walk from the computer, draw a drawing with my left hand(I am right handed) using different colors, examining my assumptions and tweak on different parameters to force myself to think differently and come up with several approaches.

I try to apply the breadth first approach in other areas as well. For example searching through documentation and the internett. Instead of taking the first promising article/site I look a bit longer. Turns out Andy Hunt is right. The solutions I now come up with are not necessarily the best and different from the ones I normally would have had but at least they are more carefully thought trough. Hopefully can I also back up the different aspects of it with more confidence.

 

Published in computas programming

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x