> Yeah, but in times of being stuck, it's much easier to get distracted and procrastinate.
A bit, but I tend to do directed procrastination. Go the gym, do some research on a different problem, write some emails, etc... As soon as I stop actively thinking about the problem a solution will come.
Another solution (and this works well with coding and writing) is just to start coding/writing. I'm writing an article now for a newsletter, and the top of my document is a bunch of stand alone sentences that eventually lead to a full article.
In programming, I'll often do the same thing and just start solving the problem even if I know it's not the right solution yet. Usually this leads me to a better understanding, and eventually the solution.
Directed procrastination works for me too. I usually hate admin type of work; sorting out my room, doing the laundry, responding in social media (yes, that counts too..)
But when I hit the inertia part of the productivity cycle, this saves me. It's always better to do something than just being stuck. And while I mechanically do those tasks, my head also gets in order, I start dreaming and slowly, I'm on the roll again.
When the right time comes, I slide back into the 'real' work. I can't quite regret for 'wasting' that time, because usually the reward is a new perspective, and the ideas that come with it.
> As soon as I stop actively thinking about the problem a solution will come.
The book 'Hare Brain, Tortoise Mind' has a good explanation of how that works, what it's good at and what it's not.
I get a lot of side chores done with directed procrastination. But, what works for me to get the main task done is to just open the IDE even without a goal. Instead of "Ugg... I need to make X work today...". Just open the editor and do anything. Refactor a function. Comment something. Whatever. Once you get started, it much easier to continue.
My problem is when I open the editor and refactor a function, I start finding other functions that need to be refactored, then finding even more refactoring opportunities from those, recursively, forever. At some point I need to stop refactoring and start producing something new...
Some amount of distraction is probably helpful. Once you have gathered all requirements and have thought about the problem for a while it is good to let it marinate for some time. You will often have moments of insight seemingly out of nowhere while you are e.g. going out for a walk.
Yeah, but in times of being stuck, it's much easier to get distracted and procrastinate.