r/ProgrammerHumor • monkeyuser.com • Mar 06 '18

Focus

Post image
43k Upvotes

805 comments sorted by

View all comments

Show parent comment

3

u/[deleted] Mar 06 '18

I like to think of it as a graph search. The problem + solution in your mind build a graph much like in the comic. Debugging is running validation of the actual implemented AST vs the virtual implementation in your mind.

When you're in "the zone" you're doing a depth first search. Usually happens when you "know" this issue has to be related to X.

When you take a break that depth first search gets interrupted and possibly even corrupted (hard to remember what you were doing) this gives you the opportunity to depth first search a different part of the graph. Effectively simulating a pseudo breadth first search.

More breaks, wider, shallower searches. Less breaks deeper, narrower searches.

Imo for debugging I like leaning wide and shallow as the issue is likely an over sight more often than not.

For designing/first implementation/hacking together something leaning deeper and narrower I find helps keep things modular and clear in your mind.