In the past few weeks, I noticed three instances where I was forced to take a break exactly when I was ready to jump in and write some code to fix a bug or add a small feature. I had to step out of the house and take a walk to meet someone, etc.

I ended up getting ideas during the walks, which significantly changed and simplified how I would’ve implemented things, if not for those breaks. Even if I did end up zeroing down to those solutions, I am pretty sure it would’ve taken a couple of not-so-good attempts and much longer than it did.

Context switches are usually considered to be expensive for programmers, but taking a break at the exact time when I had all the required context loaded into my head seemed to help. It was also probably helpful that I was taking a walk, and there wasn’t really any other inputs or outputs competing for the space in my head.

This got me thinking about doing this more deliberately – I’d love to hear about any experiences or any experiments any of you have done with this. Also, I’m reminded of Rich Hickey’s Hammock Driven Development talk and I wonder if this is a smaller/different version of it, and makes me want to try out the things he suggests more deliberately. If any of you has thoughts and suggestions, I’d love to hear from you!