This is a common problem. The book Deep Work goes into it in detail, and has some research-based techniques to fix it. Basically it boils down to removing distractions, and determination, gradually building up your brain's ability to focus again. https://www.amazon.com/dp/B00X47ZVXM
Ask HN: I lost my ability to focus for hours on coding. How to regain?
61–70 of 127 posts
Re: Ask HN: I lost my ability to focus for hours on coding. How to regain?
#62Try a side project or some library or module that you’ve always wanted to write.
Re: Ask HN: I lost my ability to focus for hours on coding. How to regain?
#63Re: Ask HN: I lost my ability to focus for hours on coding. How to regain?
#64Watch more porn, or get laid more. I was having focus issues, because coding is fascinating but not inherently sexy to me. After working on a problem for a while, the enjoyment of the problem would become overshadowed by my sex drive, and I would start to find anything else more interesting. Ended up being my body's way of reminding me that I should make some babies before I died, so I was subconsciously distracting…
Realize that promiscuity is a disease vector.
Re: Ask HN: I lost my ability to focus for hours on coding. How to regain?
#65Earlier quoted context omitted.
Realize that promiscuity is a disease vector.
The OP was crude and perhaps hinging on taboo, but there are well established schools of psychology on the topic, namely Freud's psychoanalytic theories come to mind.
Re: Ask HN: I lost my ability to focus for hours on coding. How to regain?
#66Watch more porn, or get laid more. I was having focus issues, because coding is fascinating but not inherently sexy to me. After working on a problem for a while, the enjoyment of the problem would become overshadowed by my sex drive, and I would start to find anything else more interesting. Ended up being my body's way of reminding me that I should make some babies before I died, so I was subconsciously distracting…
Realize that promiscuity is a disease vector.
Re: Ask HN: I lost my ability to focus for hours on coding. How to regain?
#67You'll have to find a way past that fear. You can:
1. Be braver - admit you're afraid and do it anyway.
2. Find the root cause of fear. Maybe you've dealt with too many death marches. Maybe you don't feel like you can meet your expectations. Just admitting it can make it go away.
3. Plan it out in a way that nobody can screw it up, not even you.
Re: Ask HN: I lost my ability to focus for hours on coding. How to regain?
#68Earlier quoted context omitted.
If I try eliminating distractions, I just end up daydreaming. I spend most days at work just reading the same shit over and over with nothing sticking. I manage to get work done in rare bursts after exhausting my brain with distractions. Fwiw, I'm in my mid 40s and have less than a year of treating my sleep apnea. I'm pretty sure I've had ADHD my whole life but blamed other things until recently. I'm trying to resist…
Don't medicate but challenge yourself. Learn a new editor while doing your job. Try using Windows instead of using a Mac. Try typing only left handed. There are varioud challenges to overcome boring assignments. Also try a standing desk so if you skive then you must stand up for fifth teen mins.
If you have medical issues - take care of medical issues in the best way possible.
Challenging yourself = denying yourself treatment.
Challenging yourself is not a treatment for something like sleep apnea.
Re: Ask HN: I lost my ability to focus for hours on coding. How to regain?
#69Earlier quoted context omitted.
If I try eliminating distractions, I just end up daydreaming. I spend most days at work just reading the same shit over and over with nothing sticking. I manage to get work done in rare bursts after exhausting my brain with distractions. Fwiw, I'm in my mid 40s and have less than a year of treating my sleep apnea. I'm pretty sure I've had ADHD my whole life but blamed other things until recently. I'm trying to resist…
Holy shit, same boat, same age, on CPAP for about a year now, can't remember what was said in the meeting I was just in this morning. And browsing HN while I should be writing tests ;)
CPAP only works on the expiratory valve - which is your soft palate.
If you are having a large number of arousals, despite optimal CPAP pressure, and your respiratory waveform is jagged in certain ways (hard to describe in text) - you are very likely having epiglottic collapses.
However, epiglottic collapse can only be definitively diagnosed by sleep endoscopy.
Epiglottic collapse can only be treated surgicially.
Re: Ask HN: I lost my ability to focus for hours on coding. How to regain?
#70I started working on something that I cared about.
Slowly, over 3-4 months, I regained it.