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.
The easiest way to train yourself is to define strict boundaries for what you will achieve during a defined period of time.<p>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.<p>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.<p>If you need practice, then you need something to practice towards. Give yourself boundaries.
Having interesting work is definitely a plus when you're excited about completing something time usually flies by.<p>The Pomodoro technique might be something for you to try.<p>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.<p><a href="http://en.wikipedia.org/wiki/Pomodoro_Technique" rel="nofollow">http://en.wikipedia.org/wiki/Pomodoro_Technique</a><p>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.<p>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.<p>Soon you'll be estimating in pomadoros (30 mins).<p>Good luck staying focused.
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.<p>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.
If you get bored in 30 min, programming may not be a natural fit for you.<p>I get restless about 4-6 hour mark, but I am great for the first three hours.<p>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!<p>Hope that helps
I am of the notion that, to some degree, the brain can be trained to focus.<p>You could try cycling work/play with MagicWorkCycle (google it) and work up from 10/5 to 25/5, which is standard pomodoro.