DEV Community

Cover image for Coding and ADHD - Can't Stop
Abbey Perini
Abbey Perini

Posted on • Updated on

Coding and ADHD - Can't Stop


I find "hyperfocus" and "flow state" to be analogous with one key difference - when hyperfocusing, I struggle mightily to stop. I'll be starving. My arms will be aching from typing for four hours straight. Continuing to code is probably detrimental - I'm tired, I know I need to be doing other things, and I'm starting to make mistakes and miss obvious alternatives.

Usually I'm stuck in a "one more try" loop - I'll tell myself I'll stop after I try this thing and then I think of another thing and tell myself I'll stop after I try that thing and then I think of another thing and so on.

When I've been hyperfocusing for a while, I'm often trying to change too much at once and missing meetings. This is often how my blogs happen. I'll look up and it's 2:00 pm and I haven't accomplished anything on my to do list, just a whole new blog.

ADHD brains have trouble switching focus when they've found a task that gives them the dopamine/stimulation they're always craving. Why would my brain want to switch to another task I don't find as interesting when I can just keep doing this?

Many of us also struggle with perfectionism. Once we've finally gotten started on something, we want the end result to be astounding!

Not hyperfocused pie chart: sliver of doing it, small piece of feeling guilty, and 3/4 putting it off for not good reason Hyperfocused pie chart: sliver of doing it, small piece of losing track of time, 3/4 obsessive tinkering justified as "perfectionism"


"This sort of intense focus isn't something you can just buck up and talk yourself out of," says Russell Barkley, a clinical psychologist and ADHD expert. ADHD brains in hyperfocus will literally ignore hunger, thirst, and needing to go to the bathroom.

I've often heard "take advantage of natural breaks," which may work for you. "Phoning a friend" works for me. My husband will come home and starting asking what I'm trying to accomplish and when I'll reach a stopping point. This brings what time it is into the forefront of my consciousness and crystalizes the steps I need to take to stop. You could ask a friend or relative to check in on you at a certain time.

ADHD medication is supposed to make this easier, but actually makes it more difficult for me. The coping mechanisms I've used for 30 years often rely on finding the tiniest bit of motivation and building on that momentum to do as many tasks as I can.

People find timers, alarms, notifications, time blocking, and pomodoro to be helpful. I also find giving myself a certain amount of time to hyperfocus can work, especially for relaxing with video games. These all will help with estimating the time these tasks will take in the future - something ADHD people have to learn manually.

There are a few suggestions I've seen but haven't yet tried:

  • Don't start anything you know you can hyperfocus on close to bed or to procrastinate on another task.
  • Once you realize you're in hyperfocus, immediately move around.
  • Set goals for the task, and take a break when you finish each one.

A hand pouring something into a pan captioned I throw in basic focus A pan on fire captioned Oh, my god. That's hyperfocus. I'm an idiot.

Most of all, after you've found you've been hyperfocusing for a while, be sure to take that break and give yourself some rest. Berating yourself for losing track of time won't help you start the next task.

Use the Hyperfocus

Many people want to be able to focus like this - there's a bunch of material out there on how to achieve a flow state. My ability to complete huge creative projects I'm naturally interested in is something people admire. It's one of the reasons I'm good at coding - once I have convinced my brain to care, it is easy for me to reach a flow state and get a ton of code on the page.

If you can find a pattern in the things your brain will hyperfocus on, use it. Finding what makes you inherently interested in those tasks can help you make a boring task, like chores, interesting enough to get done.


Did I miss a resource or tip you love? Leave a comment!

Up next:

Top comments (7)

thibaultjanbeyer profile image
Thibault Jan Beyer

Soooooo relatable. I remember sessions of easy 15+ hours just coding, no drinking, no peeing, no eating, no blinking, just coding. Some times whole weekends. I have that with other things as well. As soon as I'm interested in something, the hyperfocus kicks in. Easily also drives me to work longer hours than I should, skip lunch, fail to join / forget all my important meetings etc.
That is both, awesome and horrible at the same time.

jbz profile image
jbz • Edited

Dr Russell Barkley called it the diabetes of the brain to explain how devastating it can be if left undiagnosed || unchecked, and also how easily treatable it can be given the right environment/medications/therapy compared to other disorders.

But ADHD sometimes brings along other "friends", creating toxic and messy feedback loops between each other, making it not so easily treatable after all.

You may get ADHD alone, and still being hurt given how an EF/SR dysfunction can create all kinds of side effects not visible related to ADHD.

gabrielpedroza profile image
Gabriel Pedroza

As someone who has ADHD, I can totally agree with this and the previous posts. I think however, it has helped me become better in whatever I've strived for because of the hyperfocus but it can hurt in some areas as well.

tylors profile image
Tylor Steinberger

Thanks for writing this series of articles! I have bipolar and have very similar experiences between "can't start" and "can't stop" and it was nice to get some advice regarding them, especially as it relates to writing software for a living.

All the best! :)

varungujarathi9 profile image
Varun Gujarathi

One thing that I found to be helpful is 'conquering one fort at a time' strategy. I use Google Keep to list all the to-do items in my life. Literally everything is first written down in the list. Next I pick up one task and focus on it completely. From the time a wake to the time a go back to sleep, I think about it, plan it and find ways to accomplish it. Now as for the daily chores I follow a timetable with self discipline. I allocate time to each chore, say, meditation, cleaning room, exercising and then thoughtlessly do it at that time.

lukewestby profile image
Luke Westby

I have yet to attempt a technique that successfully manages hyperfocus. Anything timer-based I will literally just ignore the timer because it feels so bad to stop. I haven’t given much effort to trying a goal-based approach but the idea of taking advantage of natural breaks in the activity like achieving a particular goal sounds promising. I’ll have to give it a try. Thank you for writing this!

cheribc profile image
Heather B Cooper

Thank you for explaining pros and cons of hyperfocusing in those of us with ADD/ADHD and sharing what you have found to be useful in managing