3 ms·
First of all, make sure your sleep and nutrition is up to snuff, that you're getting some sunlight and exercise, and you're not getting sucked into too many dis
by throwaway81523 4y ago
First of all, make sure your sleep and nutrition is up to snuff, that you're getting some sunlight and exercise, and you're not getting sucked into too many distractions like the internet. Delete all your social media accounts. They are bad for you. Yeah, HN too, though less so or at least we like to think. Also, take vitamin D supplements unless you're outdoors a lot more than most people are.
If after that, if it's general mental or physical fatigue, it might be medical. Are you able to passively take in information, like watching TV attentively without getting distracted/tired? If not, then yeah, suspect medical or psychological issues. Everyone gets that way sometimes, but if it persists more than a few weeks, talk to an MD.
If you're having trouble beginning code tasks, then work on stuff that you're already in the middle of, write documentation, go through the bug list of whatever you're supposed to be working on and fix issues, etc. This can get you back into it.
I think really great programmers are in an inspired, highly productive mode almost all the time. Ordinary pretty good programmers (most of us here) are in that mode some of the time, and need to develop the skills and habits to keep plugging along when we're less inspired. That is partly a matter of technical fluency: be very familiar with your tools, languages, environment, code base, etc., so you can keep cranking without having to get too overwhelmed by uncertainty and confusion.
There is a long time stereotype of hackers staying up all night coding, and that is partly because there's a time around 4am when psychological resistance to doing stuff dissolves. So if you are stuck on something, deciding to pull an all nighter can actually help break through, even if most of the night is not productive. Don't do that too often though, and never do it 2 days in a row.
Other than that, I guess we would have to know more specifics.