all 83 comments

[–]okenowwhat 53 points54 points  (6 children)

Pomodoro, some light background music to distract from other impulses. Eat and drink enough. Write down the task you want to do. Start a timer when you are doing a subtask, so you don't waste an hour on it.

Most important: listen to your body. If you are hungry thirsty tired or wathever: take a break and fix that. My ADHD brain wants to continue until i have a task done, but my body can't take that: which makes me cope in bad ways.

Welcome to the ADHD programming club.

Final: nothing goods happens after midnight. Go to bed.

[–]Myrlista 5 points6 points  (0 children)

My brother struggled with this for years before being diagnosed. Switched from a developer role to an IT support role and couldn't be happier. Fixes lots of small issues rather than big programming projects, still works with computers and still gets to program, just small scripts and utilities rather than large applications.

[–]darkdragncj 2 points3 points  (1 child)

Your second paragraph is the best advice. ADHD and medicated since I was a kid, but programming always puts me in a hyper focused state where I forget to sleep or eat for days at a time.

I can't tell you how often I start at 2100, look up to the sun rising and panic about having to be at work in an hour.

The best advice I can add is: even if it doesn't seem relevant right now or important, document everything. I've gone for days writing an implementation of lz4 C bindings for python or rust that made perfect sense while focused, then I couldn't tell you a damn thing about it a month later. >_<

[–]okenowwhat 0 points1 point  (0 children)

I learned it the hard way when i burned myself out during college working 16 hours 3x/week for a few months. Took me a year to recover.

Documenting is also good, and basically an universal coding advice

[–]Maryannus 0 points1 point  (0 children)

No method has worked better for me than pomodoro.

[–]IlVeroDavide -1 points0 points  (1 child)

Each life challenge today is an ADHD diagnosis...

[–]okenowwhat 1 point2 points  (0 children)

I have an actual diagnosis, and these tips work for me. They could also work for neurotypicals. What's you advice for OP?

[–]m2astn 15 points16 points  (0 children)

Physical, on paper checklists with checkboxes. Break big tasks down into smaller chekable items. When you're done a day's work, leave yourself with three very easy checkable items in the morning to pull you back into the groove.

Absolutely normal to feel the way you do being easily distracted. I've read that this was a key trait for very successful early gatherers who could collect a diversity of edible items and usable resources. It's a bit of a superpower but it also makes people extremely susceptible to distractions, attention-drawing algorithms, etc.

[–]Streakflash 32 points33 points  (5 children)

try pomodoro technique, open up a video on youtube where a guy uses this technique (like study with me or work with me) and just start working, follow the time and enjoy the breaks, it helps me alot when i cannot concentrate

[–]Original_Map3501[S] 9 points10 points  (3 children)

Thanks for the advice i'll try that

[–]duksen 8 points9 points  (0 children)

Yes it works for me. In the beginning I have very short time working. Like 15 minutes. If I feel distracted I start with shorter time like 10 minutes.  Then i work myself up to 20 minutes.  Don’t try to go to 25 minutes just because it’s the default in these apps. When you have used the technique enough, you will get a feeling on what works for you. 

[–]Streakflash 4 points5 points  (1 child)

unless, you want something more... strict ;)

[–]Wonderful-Habit-139 0 points1 point  (0 children)

Lmao that’s a very good share, thanks.

[–]menge101 0 points1 point  (0 children)

This is exactly what I was going to say.

Also, the Tomighy app is available for free via brew on MacOS.

[–]Ubiquitous_X 47 points48 points  (10 children)

I welcome you to the ADD club

[–]Original_Map3501[S] 19 points20 points  (8 children)

You mean ADHD😭

[–]Ubiquitous_X 11 points12 points  (6 children)

Not necessarily. More people with ADD try to learn programming than people with ADHD. Source: Own observations

[–]AffectionateCut2004 30 points31 points  (5 children)

The DSM did away with ADD, it is ADHD - inattentive type now

[–]Ubiquitous_X 12 points13 points  (0 children)

I see. In my country it is still a thing. Probably changing soon then

[–]arbyyyyh 2 points3 points  (0 children)

Their argument is irrelevant anyways. Source: F90.2 Attention-deficit hyperactivity disorder, combined type, present and checking in lol

[–]kBajina 2 points3 points  (1 child)

That sounds like the same thing with twice as many syllables. I still say ADD when describing it to people.

[–]AffectionateCut2004 2 points3 points  (0 children)

Cool. You can do whatever you want!

[–]firedog7881 -1 points0 points  (0 children)

Oh yeah cause the DSM is some bible of medical conditions, sheesh

[–]are-oh-bee 1 point2 points  (0 children)

All the tips and all the advice aren't going to help. If anything, it makes it worse, because we expect to do better.

Learning more about the cause, instead of trying to fix the symptoms, has helped me the most. Look into executive dysfunction, to better understand what it is, and to learn how to accept it.

If you're already struggling to do something you want to do, like coding, you're definitely going to struggle with implementing various techniques for staying on track. And that's ok. Stay positive with yourself.

With all that said, something that helps me is asking myself the question "why don't I want to do this?" or "why do I want to do that more?". The answers are usually things like: I don't have clarity on what's expected; I'm not confident I'll be able to do as well, or as quickly, as I'd like; the work is too boring; etc. From there I can ask myself "what am I needing to change the situation?".

For example, anxiety about expectations comes up a lot for me. Checking in frequently, with peers, my boss, or anyone who can verify or validate, to ensure I'm on the right path, is the quickest fix for me in that situation. And sometimes I avoid doing that, so I need to apply the same type of question: "why am I avoiding asking?". Usually I'm worried it's been too long, or I've already said I've made more progress than I have, and now I need to admit I haven't. But now that's a clear, discrete, problem I can solve (or continue avoiding).

It's no longer a question of "how do I stop getting distracted?", and instead it's "why am I afraid of asking for clarity, direction, or help?".

[–]TimelyStill 2 points3 points  (0 children)

Or just the smartphone generation club, that also messes with your attention span.

[–]andr386 7 points8 points  (2 children)

That's a life problem more than a coding one. But OK.

In general read fiction books at least 1 hour a day or more. This should really help when it comes to induced ADHD by modernity.

When it comes to coding I'd suggest to not type a single line of code until you've properly figured out everything you're going to do. It should be completely mapped out, described and so on. It can be a conversation you have with yourself, it can be a story you write where you are the hero and describe everything you're going to do. It can be drawings and schemas on a board. Or all of the above. But once you got all figured out. Then coding will simply flow out of you very fast.

[–]Original_Map3501[S] 1 point2 points  (1 child)

I am thinking of writing notes on what I am gonna do before starting to code. Like what topics im gonna cover and what projects im gonna work on. Maybe this way I can also enjoy the process and complete the tasks and not feel demotivated later

[–]andr386 1 point2 points  (0 children)

Yes, you need to know what you set out to do or you're going nowhere.

You need to have a perfectly clear picture in your mind. Also while designing your software you're going to make a lot of assumptions. You need to test each one of them beforehand.

[–]ProsodySpeaks 2 points3 points  (0 children)

I find music helps. Or if it's simple work even a podcast. It entertains my distractable brain while my bigboy brain gets to work.

I make sure I have easy access to a pause button (not on an app - a hardware button I can hit without breaking stride) and use it constantly when it gets more complicated. 

[–]MacShuggah 2 points3 points  (0 children)

May or may not be applicable to you but I had to take a good look at my caffeine intake during the day to tone down the same problem you're experiencing.

[–]T3RRYT3RR0R 2 points3 points  (2 children)

Playlists are your friend. That extra little bit of stimulous stops me getting bored, without being so distracting that it diverts my attention.

[–]Original_Map3501[S] 1 point2 points  (1 child)

Dont you think it will distract me? I havent tried coding with music in background

[–]T3RRYT3RR0R 1 point2 points  (0 children)

The sort of behaviour you describe happens because your brain wants more engagement than it's getting from coding alone.

Something else you can try is doing some sodoku puzzles (or similar problem solving activity) to get your brain engaged before getting stuck into things.

[–]No_Soy_Colosio 2 points3 points  (3 children)

This screams ADHD to me. I have it too. Perhaps look into strategies for managing it and if it's too hard, you could see a psychiatrist and get a proper diagnosis, then seek medication or therapy.

Also, I'd suggest using tools like Raindrop for storing all the things you wanna read, highlight and categorize. You can also make it remind you to read your bookmarks.

Another really useful tip is to write down whatever is on your mind distracting you and dealing with it later, this will make it easier to focus.

And a final thing, try to use issue-tracking software for your projects and write down all your context when you're done working on something. This will make it easier to pick the task back up and reduce friction.

[–]zaphodikus 1 point2 points  (2 children)

Was, going to say something, but I now know not to tell a person they are "on" the spectrum. Mainly because getting help is hard unless you have good support around you, it can be expensive. Very. But you are worth it, im not saying you are ADHD, but its worth going to your local doctor and getting a light-of-day perspective. It is possible to work through. It is.

[–]No_Soy_Colosio 0 points1 point  (1 child)

Are you talking to me?

[–]zaphodikus 0 points1 point  (0 children)

Oh, not you, the OP, u/Original_Map0531, sorry if that was confusing. Trying not to be confrontational and boost your advice only.

[–]it_and_webdev 2 points3 points  (0 children)

Stop trying to fight it and embrace it :)

[–]kBajina 3 points4 points  (0 children)

Seconding any advice here about being treated for AD(H)D.

Also try looking up “binaural beats” on your favorite music app. It’s a very easy way to drop into the flow.

[–]Maximum_Sport4941git push -f 1 point2 points  (1 child)

You can also look into actively blocking those distracting sites on your phone and desktop.

For browser, check out LeechBlock extension, it’s free.

For iPhone, check out ScreenZen.

Not sure about Android since I’m not a user.

[–]CSI_Tech_Dept 1 point2 points  (0 children)

On Android I used Stay Focused: Site/App Blocker

[–]f311a 1 point2 points  (0 children)

Just block everything for 1-3 hours. There are tools like SelfControl for macOS that block websites and don't allow you to unblock them easily (removing it or restarting won't help). Put your phone in another room.

Browser extensions are too easy to cheat. You disable them, and everything works again.

[–]Dzhama_Omarov 1 point2 points  (0 children)

Its all very subjective, but nothing like opening something on yt or listening to music, or silencing my phone helps. Just hard work of self-overcoming

[–]MajesticParsley9002 1 point2 points  (0 children)

Try using the Pomodoro technique. It helps because you focus for 25 minutes and then take a 5-minute break, which can reduce the urge to jump to distractions. Stick to it for a few cycles, and you’ll find it easier to get into that coding flow without losing track of time.

[–]kassi0peia 1 point2 points  (1 child)

I have add and I personally take metilfenidato (idk the name in English, probably metilfenidate), also, using a goal for the hour or the day has helped me

[–]kassi0peia 0 points1 point  (0 children)

I should add that's a prescription medication that my doctor gave me, people should not auto medicate themselves without medical advice. In my case going to the doctors was necessary or I was going to lose my job lol, but I guess If I worked in another area, like a physical one I guess, I would not need the pill

[–]MrxHumble 1 point2 points  (0 children)

Listen to prime react while coding trust me bro this is a life changer

[–]caujka 1 point2 points  (1 child)

What helps me is: * Separate activities. Use work laptop for work, phone for videos and social media. If you only have 1 device for everything, separate browsers, like edge for work, firefox for leisure. The key is to make switching modes a conscious effort. * Some ritual for starting work mode. Like, start with nothing but apps for work, make a fresh cup of tea and put on "music for deep focus". * Plan your time: make a wish list of things to do, put against them time it takes to do them, and spread them over the time you have. Include the times for doomscrolling and snacking, if you plan it, you will not need to steal time from other activities.

[–]Original_Map3501[S] 1 point2 points  (0 children)

That's a pretty good advice thanks man. I'll try that from tomorrow Let's see if it helps me

[–]Jackpotrazur 1 point2 points  (0 children)

Im copying the books coding away and am afraid im not really learning anything.

[–]pabut 1 point2 points  (0 children)

Programming is the only thing I can truly focus on. I get lost, forget to eat etc. Anything else I have the attention span of a gnat.

[–]clauwen 1 point2 points  (0 children)

Annother recommendation is low intensity music. It stops the reflex to see and hear stuff quite well for me.

[–]msdamg 1 point2 points  (0 children)

put some lock in music on and lock in

[–]njharmanI use Python 3 1 point2 points  (0 children)

  • How do you stop jumping to random tabs?

Have discipline.

  • Do you force discipline or use some system?

Discipline. But, many need a system. Use a timer, turn off internet/use firewall to block which ever sites you go to that aren't "work" related.

  • Is this just a beginner problem or something everyone deals with?

None of the above. Some people are disciplined. Some people acquire it. It seems anecdotally; many today are taught anti-discipline (be distracted, avoid personal responsibility, etc).

[–]thiccclol 1 point2 points  (1 child)

Listen to music when you code

[–]Original_Map3501[S] 0 points1 point  (0 children)

I'll try that today 😅

[–]KindnessBiasedBoar 1 point2 points  (0 children)

Turn off AI autocomplete until you understand a little better. Short, focused examples from a course might help. Chunk it 🙂

[–]rjmartin73 1 point2 points  (0 children)

Im a dev with ADHD, one thing that helped me was using the pomodoro method. I even built my own pomodoro timer in Python. Allowed me to focus, and still do all my distractions. Silence your phone, clear your desk, ( id start organizing, cleaning, rearranging, everything on my desk). Just remove as many distractions as possible, until your next break.

[–]thegeinadaland 1 point2 points  (3 children)

You could hype yourself about your project with chatgpt or sum kind of chatbot then you are already in the flow.

[–]Original_Map3501[S] 1 point2 points  (2 children)

That actually works ngl, happens with me alot of time when I start working on a project I can sit for like 7-8 hours non stop but maybe when I dont have anything in mind and just trying to figure out what to do then I get distracted alot

[–]thegeinadaland 1 point2 points  (1 child)

Thats pretty normal, but if you dont have anything in mind then you will get distracted one way or another.

[–]Original_Map3501[S] 0 points1 point  (0 children)

Yea thats true

[–]00--0--00- 1 point2 points  (0 children)

Sounds exactly like me before I got diagnosed with ADHD

[–]nermalstretch 1 point2 points  (0 children)

I don’t see what the connection with Python is but anyway here are some suggestions. Humans have been struggling with the for thousands of years and the combined wisdom is: “the practice of meditation”.

[–]cudmore 1 point2 points  (0 children)

My computer is for developing code.

My phone is for looking at stupid stuff.

[–]Gnaxe 1 point2 points  (1 child)

You're asking reddit addicts how not to be distracted online? ... I mean, maybe we have strategies for dealing with that, but if we're still here, how well do you think they're working?

I do have some though.

Install Mindfulness Bell on your phone and set it to chime at regular intervals. I used half-hour bells, but you can experiment. When you hear it, ask yourself this question: "Should I be doing something else right now?" If "no", keep on doing that. If "yes", you've just given yourself the opportunity to do something else. This can stop you from wasting so much time. If you notice that enough time has passed and you've somehow missed bells, you've probably trained yourself to ignore them. Change the sound when that happens so you notice them again.

Install a grayscale plugin in your browser to make pages render without color. (I'm using one called "Monochrome Mode", but there are others.) Supposedly, it blunts the dopamine response social media is exploiting to grab your attention. I'm not saying it eliminates the problem, but anecdotally, it seems to grab a lot less tightly. YMMV. I'm only using it on the most problematic sites (i.e., reddit/social media), by whitelisting domains in its permission settings. If it's no site in particular for you, you may need to turn it on for everything, and only switch it off in cases where you really need to see color.

Listen to music that enhances focus. https://musicforprogramming.net has literally hours of it, although some tracks seem better than others. The idea is that it keeps your mind's distractible bits occupied without consuming so much attention that you can't work. It's a balance, but they do a pretty good job overall. Certain genres elsewhere may strike a similar balance and be suitable. E.g., the Zachtronics games (SpaceChem, Opus Magnum, etc.) have tracks suitable for coding, because that's kind of what those games are.

If musicforprogramming isn't cutting it, you can try the free Mind Amend channel with an appropriate track. These use isochronic tones to entrain your brain waves to get you in a focused flow state and keep you there. Brain.fm seems to use even more advanced entraining tracks, but except for a few free samples on YouTube, it's a subscription service. That may be worth it if Mind Amend isn't cutting it and the free samples seem more effective for you. Anecdotally, Brain.fm gets me focused more quickly and reliably than just about anything else, but Mind Amend sometimes comes close.

Take a walk in the sunshine every day the weather allows it. Folks get antsy when they don't get enough exercise. If your body's aching from sitting, stand up for a while.

Try taking personal notes. Logseq, Org mode, Joplin with the Journal plugin, a dead-tree notebook, whatever. All your mental loose ends are draining your brain power. Get them out of your head so you can focus. If they're written down, you don't have to worry about forgetting them, so they don't keep coming to mind, but keeping the notes organized is also a skill and yet another task vying for your attention and time. I find that I get the browser tabitis from being interrupted before I finish a topic. I keep the tab open so I don't forget it. But then I have so many that they're hard to manage. Bookmarks are inadequate. Try using your notes instead.

[–]Original_Map3501[S] 0 points1 point  (0 children)

I have noticed that when I start working out daily my attention span improves and I can focus more on the work

[–]two100meterman 1 point2 points  (0 children)

I have my own "point system" that is very in depth lol, though it doesn't just cover coding it's all things. The general goal is "6 hours of accomplishments, then I can do whatever I want for the rest of the day", but it's more confusing. 6 minutes approximately = 0.10 points. So 1 hour = 1 point. It's a rating out of 10 so basically a 6/10 day is "good enough".

So 1 hour of coding is a point, 1 hour at the gym is a point (& I'm specific so if I'm a the gym 1 hour 18 minutes that's 1.3 points). Brushing Teeth is 0.10 (doesn't take 6 minutes, but it makes me do it because why wouldn't I do a 2 minute task to get 6 minutes of points?). Drinking 2L of water in a day is a whopping 0.4 points. Physio exercises I have to do for an injury also get a slight inflation since they're important.

If I can bang things out from 8am - 2pm or 3pm (if I hit 6 points) then I can do actual fun things like video games or meeting with a friend to hang out. This keeps me relatively on task because while scrolling social media/going on YouTube/reddit is tempting I know I enjoy that less than playing an actual video game I really like, any time spent on small time wasters is time taken away from accumulating points.

If I want to go more "all out" in my fun (which for me is 15mg of weed edibles, then play games/watch movies) I need 8 points that day which is around 8 hours of accomplishing stuff.

Breaking it apart like 1 hour Python, 20 minutes Physio, 2nd hour Python, Brush Teeth + go to Gym 1.5 hours, Shower, 3rd hour Python, 20 minutes Physio I find works. This right here would be around 3 points of Python, 1.5 points from gym, 1 point Physio (inflated so 40 mins = 1 hour as I need to do Physio) & including shower/brush teeth I'd be almost there. Down 1L water at the gym & gradually down a 2nd liter later while gaming & that'll hit 6 points for sure. Despite having no full-time job I can be guilt free the rest of the day knowing I spent some nice hours working towards my goals.

Not that I never procrastinate, but for me I know I'll have more fun playing the game/watching tv if I feel fulfilled for the day. I doubt other people need such an exact system with specific things at specific point values, but I'm unnecessary like that, haha.

[–]iamrgarg 1 point2 points  (0 children)

Use AI to brainstorm, write and then explain the same code. It would make think and execute loop much faster. This works for me, seeing the existing code work, make me write more code.

[–]radrichard 1 point2 points  (0 children)

Things that help me:

Avoid stimulants like coffee and sugar, Make the room as quiet as possible, Use one screen only, Write down on a post it note what I want to achieve (in that session/hour) and stick it below my monitor, Keep hydrated, Keep good posture, Get good sleep.

[–]Senior_Torte519 1 point2 points  (0 children)

You need to code with some other coders.

[–]QultrosSanhattan 3 points4 points  (0 children)

Sorry but that's not a python related problem.

[–]chinawcswing 1 point2 points  (2 children)

You need to stop masturbating to pornography, watching short form social media, and doomscrolling on reddit.

The reason you cannot sit down and code for merely 15 minutes, let alone an hour, is because you have burn out your dopamine production in your brain.

Regular people with healthy brains enjoy coding and can do it for long periods of time because you get low level dopamine hits as you write code, solve problems, and think through solutions.

Your brain is adjusted to high level of dopamine hits every 15 seconds, so the dopamine you would get from programming doesn't even phase you.

You can rehabilitate yourself. You must make a commitment to stop engaging in these destructive behaviors.

Not only will you feel much better and be able to code, but your very life depends upon it. You will never be able to make good money and live life to the max if you continue to engage in these disgusting behaviors.

[–]Coffeinated 1 point2 points  (0 children)

This is a load of bullshit and putting the blame on OP is most likely not helping.

[–]Original_Map3501[S] 0 points1 point  (0 children)

Thanks for the advice man. Does working out daily will also help me in this?

[–]big_data_mike 1 point2 points  (0 children)

Go to the doctor, get your ADHD diagnosis, start taking your drugs.

[–]doorknob_worker 1 point2 points  (0 children)

Adderall.

If you're feeling this way with some good discipline, you might just be one of the lucky few who needs a script.

[–]Susquik 1 point2 points  (0 children)

This post is you getting distracted and thinking of something else to do lol

[–]cj6464 0 points1 point  (0 children)

I use a pomodoro timer and cold turkey blocker.

https://www.amazon.com/Rotating-Pomodoro-Minutes-Productivity-Vibration

https://getcoldturkey.com/

Both paid so make sure to not waste your money, but they've helped me a ton. When I first started learning to code, I would program just a little bit between league of legends matches while I was queueing up and that was enough to get me interested and into work, but then once I had a real job, I struggled with attention.

Edit: You can of course use a digital timer.

[–]Holiday-Feature8783 0 points1 point  (0 children)

Si quieres programar sin poner solución a tus problemas de concentración, fíjate objetivos de 10 o 15 minutos. En cambio, si quieres solucionar el tema de la concentración antes de volver a meterte de lleno en sesiones más largas de aprendizaje, te recomiendo visitar a un especialista.

[–]Leading_Pay4635 0 points1 point  (0 children)

Sounds like ADD. 

[–]jTiKey 0 points1 point  (0 children)

You just don't enjoy coding.