Brain games? A special diet? Exercise? Staying drug free? Sex? Abstinence?
What's your secret?
Brain games? A special diet? Exercise? Staying drug free? Sex? Abstinence?
What's your secret?
Proper amount of sleep, caffeine, and and not having a daughter that keeps you up all night...
I bike to work every morning (weather permitting, no biking in the snow). The exercise helps to wake me up, and keeps me in good health also.
Healthy body === healthy brain.
Although I havent been actively programming for a while. I remember yoga/meditation helped a lot. Sometimes you need to completely forget everything so your brain can reboot.
"Brain games?" -- yes, also known as programming. "A special diet?" -- yes, also known as caffeine. "Exercise?" -- yes, the commute. "Staying drug free?" -- nope, see my special diet, above. "Sex?" -- if followed by sufficient sleep then it's OK, hmm, why didn't I answer that in the exercise question. "Abstinence?" -- mu.
Exercise really helps, I feel much more alert for exercising at lunch time. But for some reason it still requires a lot of will power to actually do it!
Coding itself keeps your brain limber; that is, the very act of writing code on a daily basis is probably all you need to remain mentally on the ball.
Coffee is acidic drink in nature and can cause metabolic disorder over long time of use along with other unhealthy nutrition choices.
Tea is a (much) better alternative, especially green and white teas (less acidic, about 1/4 of the caffeine), which have other good health benefits, including rich amounts of anti-oxidants.
Yes, caffeine has been linked with better concentration, although it can cause hyper-activity and other conditions. The affect of caffeine on individuals is obviously dependent on each person. Wikipedia has a good article on caffeine.
Try also some meditation techniques. I can say from my own personal experiences that certain music and sound clips sharpens the state of my mind. Check http://www.i-dose.us/ for those.
Nutrition (food and drink), proper rests and exercise in-between sessions and some memory exercises (puzzles for instance) help radically too.
No coffee, perhaps tea. Good sleep, big breakfast/lunch. Ambient music, no clock, no internet and other things that might push your break a few minutes more. Exercise, although I have been slacking at that one. Not too funny colleagues. Less meetings. A window, to gaze into the sky and tinker.
Coffee, cigarettes, and code.
I find that coffee and cigarettes have their own calming ritual. Wax on, wax off, and you've got a brief window of zen rivaling any Japanese tea ceremony or yoga contortion. A few minutes to allow your subconscious to spin gears. Making a pot of coffee, or taking a cigarette break, is an inherently constrained form of procrastination.
Then there is the code. You might take a while to get the mental hamsters spinning, but so long as you are coding, you are slipping into the proper mindframe. Before you know it, you are in flow.
The only time I can program is when I feel good enough to program. By not having enough sleep, skipping meals, or loading my body full of caffeine and junk food I reduce my ability to keep up with hectic schedules.
Our bodies were never intended for sitting around in front of a keyboard, so I try to exercise whenever I can. I also ensure that I fit healthy food somewhere into my day, as well as a few litres of water.
Other than feeling good, it is important to keep focused on the task at hand. If I've done well, then I'll reward myself by checking SO or going onto the BBC News and Sport pages.
Project Euler. Try to finish, or at least make progress on, one problem a day.
No freakin joke: Magic the Gathering.
Also helps: Hacker's Delight
And, of course, reading new questions on Stack Overflow
This is very related to how do you vent stress as a programmer.
For myself doing sports, eating healthy food and some brain teasers are the way to go.
I take supplements as well, especially if I'm feeling drained. Of particular use is DL-Phenylalanine (building block for the dopamine neurotransmitter) and Lecithin (building block for the Acetylcholine neurotransmitter). Also almonds and turkey are good (building blocks for Gaba neurotransmitter). Cottage cheese is also a good source of various neurotransmitter building blocks.
The biggest thing is to make sure you don't overdo it. When you find yourself saying "let me try just ONE more thing to fix this bug," then you should probably at least take a break.
Adding to the other things already mentioned:
I've got one trick to get me back into workflow every morning. I just keep some easy task undone from the evening, so when I get back to work next day, I can do it real quick and get that nice feel of a winning. Works better than energy drinks anyway.
I find getting up early and walking into work is a superb way to wake up and get my brain into gear. Quite often I find that solutions to programming problems just pop into my head while walking. I also listen to technical podcasts and old BBC comedies as I walk.
Sadly this morning I overlaid and had to catch public transport to get in on time. As a result I feel half asleep and am finding it very difficult to do anything.
I listen to development related podcasts, and read books to keep myself professionaly up-to-date.
When at work I tend to drink LOT of coffee. It keeps more more focused and it makes the work day go faster. On the work days I don't drink coffee it goes by unbearably slow and I have a harder time working and keeping focused.
A pack of Camel or Malboro and caffeine
...its a shame nowadays the law prohibits you from smoking indoors
I don't wanna sound like bad conscience, but cigarettes sure help me keep my cool and focused at the task at hand.
oh yea, and sex helps as well ;-)
Yeah you just got to keep healthy. Here is some of what I do.
Proper diet- I'm on South Beach.
Exercise - I bicycle at least 125 miles a week.
Sleep - If I don't get enough sleep, I'm a zombie.