r/learnprogramming • • 4d ago

Discussion How can I focus longer on programming?

I'm a creative person. I like creating things, and I would love to create my own apps and programs. However, I find it hard to concentrate on programming, and I found out that it's not something that I can just do whenever, for example, something like video editing. No, I have to fully concentrate on programming the whole way unless I have already learned something and I have to recall it.
I don't have ADHD. Could this be solved?

11 Upvotes

19 comments sorted by

4

u/Beregolas 4d ago

I have to fully concentrate on programming

This points to it just being "a skill issue", by which I don't mean to say you are bad... you just don't have enough practice to make it automatic yet. Writing and talking about your code makes you reason about it more, which helps you build mental models and makes thinking about it more automatic. If you program alone, this is often an issue. Basically try to explain it to learn more about it.

Also, in many ways programming is more taxing that video editing. It requires you to have more abstract knowledge in your head, to translate your ideas into text instead of visual ideas, and it requires you to think about multiple possibilities at once. I would call myself a pretty good programmer, I enjoy doing it and even with ADHD, I never had an issue to sit down and "just program", but it's definitely one of the most mentally taxing things I've ever done, especially on harder projects. I think the only thing that regularly was more mentally draining was playing Go (board game)

I don't have ADHD

Many ADHD tips and tricks also just work for normal people. One that many neurotypical people find particularly helpful is: You are allowed to take breaks. Your code gets better when you take creative breaks. Anything that moves your body and doesn't occupy your brain counts. Go on a 15-30 min walk without music, without a podcast or audiobook. Nature is a bonus, if you can get it. Just think about whatever comes to mind, your programming project for example. Don't force it though. We often have far too many distracting background thoughts and tasks, aand since we are never bored anymore, they don't properly clear out.

General tips for better concentration apply: Nutrition, Sleep and sports. If you think you might lack in any of those, change it! It's worth it!

1

u/Ecstatic_Comfort_139 4d ago

When I take breaks, I just somehow snap out of concentration, and it's harder for me to kind of "snap back". And taking breaks does help. But this already helped me. Thank you.

2

u/spinwizard69 4d ago

I might add here a couple of things.

  1. Listening to music can have a profound impact on how the brain works. It is a different sort of relaxation.
  2. Spending more and more time on learning to program can have the opposite impact of what is wanted. You addressed this but I'd like to reinforce the idea, take breaks and don't over do it on any one day. At best have only one day a week to do reinforcement training over an extended period of time.

7

u/Professional-Owl1687 4d ago

Program something you enjoy

4

u/OtherwiseOne4107 4d ago

Proper sustained focus on something intellectually challenging is hard to do. It's normal. You are not deficient, you are using a complex organ in a way it's not used to, and that is tiring. It will get less tiring the more you practice.

When I was at uni, I had a physics tutor (who was a professor, the real deal), who said he could only focus on something challenging for 20 minutes. So he'd do 20 minutes, stop, do something less taxing, and then go again later.

2

u/dicewitch 4d ago

Have you tried the pomodoro method? Easier to focus 100% on one thing for 25 minutes and then take a break, vs half concentrate on it for "as long as possible"

2

u/spinwizard69 4d ago

Some people are really not built for programming, you may or may not be in that group.

However you may be on the wrong track here trying to focus longer on programming, I'd actually try to shorten the amount of time that you address programming each day. If not time focus on a concept each day. Once you grasp the concept get up and do something else. Do this 2-3 times a week, that is address a new concept. Then at the end of the week try to turn everything you have addressed into a program or extend a program you have built, using the new knowledge.

The idea is to address concepts in small steps then roll them into a real program.

2

u/BrannyBee 4d ago

Once you put thousands of hours into it, growth becomes exponential because it stops taking as much bandwidth as it currently does to code. It's like how you can draw or write stories and not feel like you're being overwhelmed/bored by practicing your english skills. You're getting better at drawing or at writing by doing that stuff, but its not the same rigor as when you had to spend hours drawing basic shapes or writing essays in school, you drilled the basics so much that they don't take any energy and its automatic.

Same thing with programming, you force regular practice for a long time, even if you have to devote just a little time every day at least do something every day. Then when you have the foundation built, making stuff for fun becomes how you continue learning, and you dont even notice the basics

2

u/Ahmed_Hisham0 3d ago

this isn't a focus problem, it's a working memory problem, and they're different things.

video editing lets you hold a rough shape in your head and keep going. programming needs you to hold about seven things at once, and the moment one drops you lose the thread. that's why unfamiliar code is exhausting and familiar code is easy: the second one doesn't use the same slots.

what helps, in order of how much:

stop before you're empty, not after. write the next step down in a note ("the loop skips the last item, check the range") and close the laptop. starting tomorrow costs 2 minutes instead of 40.

45 minutes with the phone in another room beats 3 hours with it on the desk. not willpower, just fewer things competing for the same slots.

and do the same type of thing twice before switching. jumping between a css problem and an async bug and then a database one is what actually wipes you out, not the hours.

1

u/funcyChaos 4d ago

It is difficult to solve. I either a) wait for a deadline and rush or b) wait for inspiration and ride the wave

1

u/mxldevs 4d ago

 No, I have to fully concentrate on programming the whole way unless I have already learned something and I have to recall it.

It sounds like you don't enjoy the process of learning something you're not interested in. Most people don't.

Programs are like assembled IKEA furniture: you have some idea what the finished product might look like, and you just have to figure out how to break it down into 100 different steps and do one step at a time until you reach the end.

1

u/LoneArcher96 4d ago

two days ago I was on my weekend, planning to continue one of my small projects, main problem was figuring out whether the current architecture of the app is good or if I need to redo it, the only problem is I was very drowsy, fired up vscode and just looked at it for hours, can't concentrate, I don't even know what I'm doing here, what is my task? I need a task like a function to implement or something, can't solve a problem I can't see.

some days or many days I would just be like that, it only started getting better when I opened up a notepad (or a pen and paper), and started typing away, randomly, about my current architecture, I have this class and I have that, and the concern I had before was this, and I kept typing until my flow kinda got going.

after an hour or something I didn't solve the question, but at last I had a clue on where to start, my achievement was literally putting a name and a description to the problem at hand, now I have a solid thing to work on, I can think about it.

Also this productive one hour session had a constraint, I told myself you get one hour, I don't care if you could actually achieve something in it or stared to the ceiling the whole time, once the hour ends there ain't no programming for you anymore (and I'm kinda passionate about it, this is important), constraints usually make me work more efficiently, given I could trick my mind into believing that it is contrained.

Hope this give you a clue. (and btw, I would kinda guess that I'm suffering from depression and burn out more so than ADHD, this might or might not give you some clues too)

1

u/kschang 4d ago

Pomodoro then. Periods of focus, take a break if you want.

1

u/Senior-Assumption864 3d ago

try stopping in the middle of a problem instead of when its done, its way easier to jump back in next day

1

u/AdDiligent1688 3d ago edited 3d ago

Is it a skill issue right now where you’re at with programming in terms of creating things? I’m not sure I understand fully.

I do remember similar with me, I am a tinkerer and for a while liked to just jump in and mess around try to break stuff. And that worked for a while but then created a habit for me where I started to kind of expect everything would be like that. But then as I progressed and came across more complex topics, I’d get frustrated because they weren’t as simple as the others, and required me to slow down more and learn the conceptual/theory side more. I wasn’t immediately testing tools or whatever, or picking up a new library, but instead doing the chore learning I didn’t like as much. So that would affect my motivation, and kind of made me disgruntled and give up on stuff, and created a bottleneck in my learning, sticking to stuff more approachable like learning another language or library or framework etc. that felt more familiar and likable to me for its hands-on aspect as well.

Anyhow, what worked for me in the end, mind you several years into programming, was just accepting to myself that not all learning is the same. I had preferences to styles, like unstructured dig in and find out break stuff thing, but sometimes it does require slowing down, admitting you don’t know and need more time, and that is okay and normal. I felt like it wasn’t normal due to pressures on myself and false expectations, like I had been doing it for years it shouldn’t be this hard, but rather I was doing what was familiar and comfortable for years, not accepting that me spinning my wheels trying to attack new concepts through programming projects wasn’t going to work all the time.

Good example of this for me was concurrency, there’s a lot packed into that subject that isn’t immediately obvious working from the programming aspect outward, imo now the coding part is trivial it’s more understanding what the threads/processes/asynch stuff is doing behind the scenes and avoiding race conditions etc when you use those api’s. Same could be said with network programming such as sockets and client server architectures, understandable generally, but there is standards involved with that and if you don’t know them such as that for UDP or TCP, then you’re going to have a hard time understanding what’s going on and why it needs to be that way. Sometimes you do still gotta reference a textbook even today.

Part of it too at the time is I was in college and self conscious comparing myself to others cause it was a competitive time and environment for comp sci education. Really hated that aspect so much, felt forced into it. But once I got out of that, that’s when the realization about the learning really sunk in, with the stakes lower than before, I could focus more on progress in my own fulfillment aspect, rather than perceived by what was expected of me or I thought that was due to pressures. Idk if that makes sense.

So I guess, for you what is it really? Is it a skill gap, maybe you aren’t there yet in your journey to be able to create what you want, or is it an ease/gratification issue where you’re expecting video editing software level experience but not getting that with programming as in it’s less seamless? Is it a timeline thing, like maybe you feel like designing/making web apps should be a quicker turn around than what you’re experiencing when making them? There’s a lot of questions behind learning struggles and expectations/preference cannot be left out.

And again, sorry if this comes off as dismissive. I feel like I can relate, I also do not have adhd, but suffered from similar to what I think you’re describing. Correct me if I’m wrong though.

1

u/profalaxiz 2d ago

Shrink your scope so you only have to hold one small problem in your head at a time. Instead of sitting down to build an app, give yourself a concrete 30 minute goal like getting one form to save data, then take a real break.

1

u/notyboy01 1d ago

Nobody remembers every bit of syntax. I've seen experienced devs look up basic stuff all the time. What matters is knowing how to figure things out when your code breaks. Boot dev seems pretty good for that since you're actually coding instead of watching endless tutorials.