Reminds me of an oldie but goodie about getting away from my computer:
"How do you achieve laser focus and concentration?"
The single most important thing I do to "achieve laser focus and concentration" is to work in such a way that I don't need "laser focus and concentration" to get my work done.
This has to be done the night before.
I always quit all online work at least 2 hours before bedtime and print whatever I'm working on.
Then I go into any other room with program listings, blank paper, and pens (especially red!) and plan out all of tomorrow's work.
All analysis, design, and refactoring must be done at this time. I do not allow myself to sleep until the next day's work is laid out. I also do not allow myself to get back onto the computer. The idea is to have a clear "vision" of what I am going to accomplish the next day. The clearer the better.
This does 2 things. First, I think about it all night (maybe even dream about it). Second, I can't wait to get started the next day.
I always wake up and start programming immediately. Once I get going, it's easy to keep going. Any difficulties are probably because I didn't plan well enough the night before.
Not sure if that's the answer you're looking for, but whatever gets the work done...
I used to do large amounts of programming on paper while commuting or waiting somewhere, but in retrospect I threw most results of that away and did in completely different manner when I got to computer. (for example, I wrote most of the macros in dfsch's standard library into my notebook in interpreted code, only to rewrite them in C when I started to actually implement that). But even in that case, programming without computer caused actual boost of my productivity. Unfortunately now I don't have much opportunity to do that and you inspire me to try to somehow make time for that again.
I love doing this. I often quit for the day and then pull out a notebook and fill up a page with ideas for new features, solving a problem, etc. I normally can't think of ideas like that while I'm in TextMate and I'm thinking of how to translate ideas into Ruby code and not about the big picture. Sometimes the ideas I jot down are worthless because they wouldn't actually be practical if they were implemented, but usually it's very helpful. And you're right in that it gets me excited to program the next morning because I can try to turn some of those ideas into something real.
Each time I do this, I am amazed once more how powerful thoughts and observations can emerge by turning away from my laptop and rethinking the problem with most basic drawings and without the shakles of my IDE and other tools.
This is espescially important for problem solving and creativity, where your first reflex is almost never the best, or when you got stuck.
Paper gives you the freedom needed to express the problem your wrestling with, and as my old math teacher rightly said: Expressing the problem is halfway to the solution.
This is completely terrible, but one of the reasons I've found it so difficult to quit smoking is that the nicotine urge acts as a timer to go outside to clear my head and get some fresh air (ironic, I know).
I've been freelancing for a couple of years now, but about half of the programmers were smokers at my last job. We would coordinate smoke breaks throughout the day, and that time was often spent chatting about whatever projects we were working on. It turned out that it was a good way to get feedback and throw ideas off the wall without interrupting people at their desks.
I am an ex-smoker. I understand this stumbling block quite well. Should you decide to quit, here are some of the things I did to help with the take a break/socialization aspects of it.
-- I never stopped taking smoke breaks. (but I did start calling them air breaks)
-- I invited other, non-smokers to air-breaks
-- Other smokers didn't set off particularly strong cravings in me, so I still did my coordination with them
-- Since my body no longer had the chemical decay timer, and the mental habit started to fade, i had to set real timers and request my smoking co-workers to ping me for my air breaks (before I did this, I started to feel disconnected and seriously considered starting to smoke again to "relieve the stress")
-- Keep carrying around a lighter. (It makes no sense, but somehow it helps put some smokers at ease about a non-smoker in their midst)
-- Don't start preaching to your smoking buddies about stopping. Answer questions if asked, but let it be -- remember how much you hated the "you need to quit" stuff. It will keep the interactions smoother.
In my experience, for team of good programmers working hard on some problem/idea smoke breaks are incredibleproductivity boost. When we had actual office and were mostly working from there, even some non-smokers regularly accompanied us to smoke breaks because that was perfect opportunity for informal chat about work.
On the other hand I have seen teams that don't talk shop on smoke breaks. It seems to me that this can be effectively used as measure of team's proffesionality and motivation
When I worked in an office, nobody was a smoker (Sweden...) but instead we had coffee breaks. The time when we needed to refill our coffee mugs would synchronize and we'd end up around the coffee machine in the airy full-window hallway.
I used to do that when I was in the Navy (I didn't smoke at the time). I was working nights in the server room on an aircraft carrier and didn't get to see the sun much.
It wasn't exactly encouraged to take random breaks all the time for no reason, and you can't go up on the flight deck during flight ops, so at the end of each shift I would go out to the smoke deck with my friends to look at the water and get some sunlight.
How is that implausible? If you kept your distance, fine...It's also fair to say that a person won't inhale as much smoke since it isn't as contained as it would be indoors, but if you're standing downwind from it or if it wafts in your direction, there will definitely be inhalation.
As often as possible (usually at lunch, happy hour, or while playing Street Fighter II), but we would try to avoid disturbing people at their desks unless it was urgent. Of course, there were some people who never came out to lunch or happy hour, and they probably did end up being out of the loop a little.
It kind of reminds me of what someone told me once: "If you don't smoke, drink, or do drugs, you're probably a pretty boring person."
Managers (and many programmers) tend to believe on a gut level that programmers are only truly productive when there are fingers on the keyboard.
Unfortunately, in most organizations you don't want to be 'that guy' who spends half his time scribbling notes, reading inscrutable documents, and frequently talking with peers. It's hard for a casual observer to tell whether you're productive, and many people will assume you're not.
I'm reminded of Bill Watterson's description of how he would come up with Calvin & Hobbes strips:
> People always ask how cartoonists come up with ideas, and the answer is so boring that we’re usually tempted to make up something sarcastic. The truth is, we hold a blank sheet of paper, stare into space, and let our minds wander. (To the layman, this looks remarkably like goofing off.) When something interests us, we play around with it. Sometimes this yields a funny observation; sometimes it doesn’t, but that’s about all there is to it. Once in a while the cartoonist will find himself in a beam of light and angels will appear with a great idea, but not often.
I was even more puzzled when the network went down, which it often did. Half of us worked on Windows PCs and half worked on Unix workstations. When the network was down, the PC folks kept working because they had self-contained local work environments.
Never underestimate the power of a self-contained work environment. Being able to focus your entire development process to a single machine can be extremely powerful in certain contexts.
It also reminds me of programming in Starbucks, where you have no (or weak) network connection. Because of the network connection, you can concentrate on programming (or design, or thinking) rather than time-consuming and attracting information from the net.
i have heard this from my father who was at iit-k, circa 1970's: ibm having installed their machine in the cs-lab on campus, wanted to paint an entire wall in the lab with just a single word "THINK" !
it kind of amused me when i heard it at first. the real truth about it hit home when i started debugging my first program ever (a taylor series 'sin(x)' calculation).
Massages and yoga classes work wonders to clear my head and solve design problems I'm stuck on. It's impossible to see the problem from a new angle by continuing to stare at the same screen for hours.
Maybe Google and Facebook got it right with those walkabout masseuses.
"How do you achieve laser focus and concentration?"
The single most important thing I do to "achieve laser focus and concentration" is to work in such a way that I don't need "laser focus and concentration" to get my work done.
This has to be done the night before.
I always quit all online work at least 2 hours before bedtime and print whatever I'm working on.
Then I go into any other room with program listings, blank paper, and pens (especially red!) and plan out all of tomorrow's work.
All analysis, design, and refactoring must be done at this time. I do not allow myself to sleep until the next day's work is laid out. I also do not allow myself to get back onto the computer. The idea is to have a clear "vision" of what I am going to accomplish the next day. The clearer the better.
This does 2 things. First, I think about it all night (maybe even dream about it). Second, I can't wait to get started the next day.
I always wake up and start programming immediately. Once I get going, it's easy to keep going. Any difficulties are probably because I didn't plan well enough the night before.
Not sure if that's the answer you're looking for, but whatever gets the work done...
Original thread: http://news.ycombinator.com/item?id=191199