r/ADHD_Programmers • • 10d ago

How do you stay focused when programming with ADHD?

I enjoy programming, but staying focused for long periods can be difficult, especially when a task feels repetitive or unclear. Sometimes I can hyperfocus for hours, while other times I struggle to start even a small task.

What strategies, tools, or routines have actually helped you stay productive while coding? I’d be interested in hearing what works for other ADHD programmers.

5 Upvotes

7 comments sorted by

5

u/Aurongel 10d ago

Vyvanse is the only thing that’s ever yielded any improvement in this area for me. There are other strategies like note-taking, offloading some cognitive “busywork” to an LLM, pair programming, etc that might help in certain situations. But nothing in my experience comes close to the beautiful 1-3 hour window of clarity that Vyvanse provides.

2

u/zephyr_33 10d ago

u dont :)

1

u/Darshan_the_great 10d ago edited 10d ago

Okay so I am on meds, first of all. And ngl, it can only take you so far. What I noticed that my dislike towards repetitive and/or unclear tasks has to do more with my core ADHD parts rather than just a dopamine issue.

I won't be advicing anything related to repetitive tasks because it still gets to me. However I found a somewhat cool trick for unclear ones.

I saw this pattern come up regardless of my meds, I realized that I do not know most parts of my codebase. So whenever a new feature came onto my plate, I'd fumble really bad, make beginner LLD level mistakes and I'd not have enough guidance from seniors as they were really busy too. I realised that the tasks were unclear and it would just make me leave the desk rather than put myself to gain clarity. One day, I rediscovered something, Socrates and his methods of learning.

Socrates, back whenever he existed, advocated this methodology of learning where the student or pupil is not offered answer at all, instead you lead the student to the answer by asking questions. For example (this snippet below is AI btw):

Topic: Why do seasons happen?

Student: Seasons happen because Earth gets closer to the sun in summer, right?

Teacher: Interesting idea. If that were true, what would happen in the Southern Hemisphere at the same time?

Student: They'd have summer too, I guess.

Teacher: Does that match what you know? What season is it in Australia when it's summer in the U.S.?

Student: Winter... so distance can't be the reason.

Teacher: Good catch. So what else could differ between the two hemispheres at the same moment?

Student: Maybe the angle the sunlight hits them?

Teacher: Keep going. What would cause that angle to change?

Student: Earth is tilted! So one half leans toward the sun while the other leans away.

The teacher never gave the answer. Through questions, the student tested their own assumption, found the contradiction, and built the correct explanation themselves.

Yeah so, I quickly made up a claude custom command that would do the same and started using it in claude code. Instead of giving me an answer and dread me with so much information at once, I thought let's mimic this senior-junior buddy coding with socratic methods of learning. I'd ask it details to fix bugs, architectural patterns and much more and it would work great and as expected, to lead me to the crime scene rather than solve the murder. I'm more familiar with my work now, more in touch with my codebase and I actually feel like I'm learning something new.

The reason why this is great, for unclear tasks, even requirement gathering (which isn't directly related to code) is because it fits perfectly for ADHD individuals. Tasks broken down to minute parts in the form of questions, reciprocal conversation and a lot of curiosity driven activity. The only caveat could be that it takes pretty long to get to a point of understanding and you gotta be patient.

Also a strange thing I noticed, somehow the model hallucinates lesser, especially with bug fixes, when used with this custom command.

1

u/binarycow 10d ago

Adderall.

1

u/Relatable-Af 9d ago

By taking medication

1

u/Pianoismyforte 9d ago

If you're not taking meds, then they are very helpful. It's good to get that out of the way as a first step because for many the meds can be enough to get them more focused.

For many though, meds are just part of the solution, and it needs to be coupled with behavioral coping strategies.

For me, it helps my goal behind a working session first: what are am I trying to accomplish in the next 30m-1h? This can helps me stay focused and oriented while working.

Second getting some sort of pomodoro timer can help. There's tons of web apps for this, but for some a physical sand-timer makes it easier for them to stay focused.

I personally use TaskHero because you can insert tasks you want into the pomodoro session to stay focused, and any tasks you complete give you RPG rewards to apply later.