I very much like this piece, the advice is sound. I can attest that I come up with my own best ideas about writing (prose or code) when circumstances conspire to put me some distance from a keyboard — say, out rowing on the lake or walking the dogs.
But I would just like to suggest that the ‘refactoring’ concept may help to lift some of the constraints that make coding-before-thinking usually such a huge mistake. Code refactoring converts programming from an unforgiving activity like marble sculpture to one like clay sculpture that tolerates error and reworking.
Provided that you’re using a suitable, high-level ‘scripting’ language, then the wholehearted adoption of refactoring potentially converts coding from an obstacle-to-thought into a powerful enabler of ‘strong inference’. Thus, the sooner you begin to inculcate refactoring disciplines into your programming practice, the faster you will advance to the point where some (not all!) of the force of the advice Timothée Poisot offers here can be escaped — because you’ll be coding-while-thinking.