I find that if I go for a walk with some chill music, I can redirect my mind away from the code that is stumping me.
Usually an extreme case of the "mushy" brain, is because I have been spinning my wheels on a problem, and I can't seem to think outside of the box to find a better solution. What seems to work the best for me, is taking a 15 min break, and then coming back and explaining the code to someone. This usually gives me an "Aha!" moment, and my brain becomes less mushy, and sad.
Take a nap like ~10 minutes, sometimes with soft music on.
But if I have a dog or cat, playing with them may would help, I guess.
Just step away and go do something else. Some days, I know that feeling means I've just done enough and won't be particularly productive until the next day. Other days, I just need to do something completely different for a couple hours and then come back to my work.
I usually watch movies, TV shows, documentaries, or anything that take my mind away from coding, It helps to "reset" my"logical side" of the brain
To make it short, I just take a break and do something that I like. Speaking of that, I like to do something that I like always!
Burnout is ALWAYS a worry... I find it can often help to just take time away to help someone else with their problem before returning to your own -- be it in the workplace, or just try helping some random stranger on a forums! When it's someone else's problem it's not really stressful for YOU. Solving their problem can often give you that confidence boost needed to take your project to the next step... you might also learn something in the process because we don't all walk the same line. Someone else might be doing something you know HOW to do or could come up with a unique way to do, that you wouldn't think of even doing in the first place.
Strange as this might sound, I find that having multiple projects going at once also helps, as does breaking what you are doing into multiple smaller problems. You get stuck at one point, go attack another and come back after your brain's had time to digest the problem.
In the military there's what's called "tightening one's group shot" -- whilst it's often jokingly used to refer to applying a boot to the boot's patoot, it more properly means to create a distraction that makes the actual problem seem less stressful. You take the task they're failing at away from them, and give them some bullshit stupid pointless task (go pick me a four leaf clover maggot!) and stacking absurdity on top. (You found Mark! But where's his mom! You nimrod you separated this poor child from its mother!!!). Once you've got them utterly flustered over THAT pointless task -- amazingly you can sit them down and boom, instantly what was originally an obstacle they knock down with ease.
It's hard to self practice that on its own, but a good five to ten minute distraction... stop to listen to a song or two. Go read some article to learn more about related subjects you might use. Get your mind off the immediate problem to give the sub-brain time to get out of the funk.
I liken long term 'brainpower' work to the same breakdown of mental processes that can happen in any intensive task physical or mental. More so if you're just sitting there at a keyboard like a sloth. Get up, walk around the block. Give yourself time to 'recharge'.
... and don't push it. It's SO easy to NOT take the break. Again to use a military term, "Target fixation" -- where you become so fixated on one target or one task, you completely miss all the other bat**** going on around you... INCLUDING your own fatigue. That's why I suggest REGULARLY SCHEDULED breaks. REGARDLESS of if you think you need it or not.
You CANNOT sit there for hours on end at ONE task and remain productive. It just doesn't happen!
Oh and for the love of Christmas, AVOID stimulants. They only give you false energy so when you crash, you crash hard. It interrupts your normal sleep, it screws with the brain chemistry and normal internal clock. I know the joke about the "programmers diet" of Jolt Cola, weight loss pills, and dorito's... but trust me, you're only fooling yourself into THINKING you've got energy with the stims.
Kind of like how when you're drunk you think you're just SO witty and brilliant... when the reality is... well...
I find that for me, socializing helps. So for example, after like 6 hrs straight of coding or doing some other logical thinking... Forgetting all about it and meeting friends, or even chatting with a stranger for an hour or two will "reset" my logical brain so that I can put more hours in later in the day.
Work out in the gym :)
Take a break, walk my dog. Drink water! Have a snack. Hangout on twitter or hashnode :)
I sit there, staring into the Unknown for approx. five minutes, eventually waking up in my bed the next morning. I refer to this as the "human reboot".
Sleep
I tend to either listen to music to "un-wind" or I'll go watch intellectually challenged tv for a bit to let my mind settle down.
I like to play a bit of Overwatch after work each day. It's like a reset button for me. I think it's because it doesn't really involve any thinking and is almost completely reflex/physical.
Will Wu
Philip “odafe” Daferiogho
sleep