

Ask HN: I get bored while programming? - yuashizuki

I get bored while programming, do u guys know how can one program for long hours non stop. I program for like 30min and then my mind starts to wander. How to resolve this issue, do u guys face the same issues. 
Basicaly in other words how to focus constantly for hours.
======
powatom
The easiest way to train yourself is to define strict boundaries for what you
will achieve during a defined period of time.

If you have trouble focusing, the worst thing you can do is leave your
attempts completely open-ended and vague. Define precisely what you want to
achieve in an hour, and then give yourself an hour to do it.

If you don't get it done in an hour, stop and take a break, then give yourself
another hour to finish it and start the next thing. Work in well defined
blocks of time - the point is not to get good at 'doing lots of things within
an hour', but 'sitting down and working straight for an hour'. Once this isn't
a struggle for you, bump it up to an hour and a half, then two hours etc.
Don't avoid breaks - your brain will continue to work problems out while
you're off making a cup of tea or getting some air.

If you need practice, then you need something to practice towards. Give
yourself boundaries.

------
saluki
Having interesting work is definitely a plus when you're excited about
completing something time usually flies by.

The Pomodoro technique might be something for you to try.

Basically choose a goal/task work only on that for 25 minutes then take a 5
minute break (play a round of a game you like, browse the news, etc) the get
back on your task or move to the next task if you complete the first one.

[http://en.wikipedia.org/wiki/Pomodoro_Technique](http://en.wikipedia.org/wiki/Pomodoro_Technique)

Sometimes when I'm in a groove I just keep going, but if it's a boring tedious
task it's nice to break for 5 minutes.

There is a cool OSX app that shows a countdown at the top bar and that's good
incentive to keep at it and try to knock out tasks in 25 minutes.

Soon you'll be estimating in pomadoros (30 mins).

Good luck staying focused.

------
Klockan
The problem isn't that programming is boring, the problem is that you can't
focus unless the task is interesting. Not being able to focus for more than 30
minutes as an adult is abnormal. But programming is mostly boring and tedious,
there is no way to get around that.

I used to have the same problem but I have been fine since I started taking
ritalin. Before I could do around 10 hours in a good week but now I can easily
do 60 in similar circumstances. Could be an alternative if you are open to it.
You would need a diagnosis though.

~~~
dkvochkin
Could you tell a little bit more about ritalin? I mean there are a lot of side
effects, which might be not worth it. I also have a lot of trouble to focus,
on stuff that are not interesting, for longer than 30min, and although i have
not been diagnosed with TDAH, i have been thinking about trying out some meds.

~~~
Klockan
The main points of it is that it increases arousal so it is much easier to
focus on what is important right now (fight or flight state, you don't zone
out if there is an angry bear in front of you).

The side effects comes from the increased arousal as well, for me it means my
heart rate increased from 60 bpm to 80, I sleep 1 hour less per night and it
is easier to miss meals so I have lost some weight. I have tried several other
forms of psychoactive medications before and this have the least negatives and
most positives so far.

------
gamechangr
If you get bored in 30 min, programming may not be a natural fit for you.

I get restless about 4-6 hour mark, but I am great for the first three hours.

One trick that does help when I am really tired is to play music. I use
classical (or no words) music if I am having a hard time focusing. It helps me
more than other kinds of music and I do listen to everything at different
times, but classical really keeps me focused!

Hope that helps

------
Rainymood
I am of the notion that, to some degree, the brain can be trained to focus.

You could try cycling work/play with MagicWorkCycle (google it) and work up
from 10/5 to 25/5, which is standard pomodoro.

------
kiraken
Then maybe coding isn't for you? You need passion to code, but if you get
bored in half an hour i doubt you have it

~~~
GotAnyMegadeth
You don't need passion if it's just a job. It might be boring, but most jobs
are boring.

