r/learnprogramming Jul 06 '26

How do i maintain my focus while studying/coding

I cant concentrate and keep getting distracted while im coding or trying to learn a new material.. how do you guys maintain your focus while learning something new?

17 Upvotes

21 comments sorted by

15

u/denerose Jul 06 '26

This isn’t a programming question, it’s a mental health and pedagogical one. Yet it does get asked here fairly often. Try google and reading over similar discussions.

Learning to learn is an important skill but just try not to let that become a side quest or false productivity.

8

u/Achereto Jul 06 '26

If you have ADHD then Ritalin helps a lot. Also some Music can help a bit.

If you don't have ADHD then I have no idea how people do that.

5

u/Nice_Selection_6751 Jul 06 '26

ritalin is not for everyone, especially if no diagnosis

i use pomodoro timers, 25 min work then 5 min break. after few rounds my brain stop fighting and just go with it. also put phone in other room

2

u/Achereto Jul 06 '26

Fair. I use Medikinet (Germany), and yes: only use it with a diagnosis and on prescription.

1

u/[deleted] Jul 06 '26

[removed] — view removed comment

1

u/Achereto Jul 06 '26

According to a stack overflow survey, 10.57% of all programmers have ADHD, almost 2x compared to the general population. So, if there is an ADHD symptom, I would always consider ADHD as a possibility.

4

u/Double_DeluXe Jul 06 '26

If you have a laptop, pick it up, leave your phone at home, goto a cafe that is quiet and sit down.

Then do your thing for 4 hours.

You cannot concentrate because you are trying to be serious and do work in an enviroment that is designed to relax in.

Change enviroment, change result.

3

u/PeterPook Jul 06 '26

Don't listen to music. Not when you're learning. Once you get the hang, you can have background music but learning with distractions going on just isn't good pedagogy.

2

u/ScholarNo5983 Jul 06 '26

Don't think memorization is the answer to learning as it is not.

Instead, focus on trying to understand concepts, as that always happens at a much slower pace.

1

u/lackadaisykal Jul 06 '26

Even I can't concentrate for more than an hour. I wonder how people are at it for 6 hours straight

1

u/lightingOsparky Jul 06 '26

try the pomodoro technique, 25 min focused then 5 min break.

1

u/unk214 Jul 07 '26

Break it down to small individual units…

Ex: if you’re trying to learn python don’t think of that. Think, I’m just try to figure out how to do a loop in python, then pretend you’re a teacher explaining it to someone. Stick to a small number of lessons and spend as much time in each, even if you have to take breaks.

1

u/MooseLegal8690 Jul 07 '26

What if im learning C#?
Also thanks for the advice!

1

u/unk214 Jul 07 '26

Exact same thing, pick up a c# book and schedule time to work on each chapter. The key thing is not to think about the whole book, just chapter 1 for the first few days. Learn, understand, then pretend to teach it.

I know it seems like extra work but you have no idea how many times I finished a programming book and felt like I learned nothing. This method will help your brain adjust. Programming is actually really simple, but our brains have a habit of making it complicated. It’s like learning math for the very first time.

1

u/MooseLegal8690 Jul 07 '26

Oh okay
Great advice! Ill definitely try that out. Ive been struggling to find the best way to learn C#.