Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have some colleagues at work, they arrive at the morning, switch off email, phone, close the door, etc. Then they close their eyes and during 30 minutes try to focus on their programming (C++, C, etc) and remember what they did yesterday. Then and somehow the process or imagine the code on they mind, with closed eyes. And some time later they just grab pencil and dump code on a sheet of paper or on their IDE (Kdevelop, Visual Studio, Eclipse, etc). Some of these guys are really effective and develop very complicated code. Me, I can not do this and I wonder if some of you can do something similar, and in case, if you could give some advice on how to be able to focus so deep in a codde or problem.

Thanks

share|improve this question
    
I sometimes close my eyes or stare at something for a minute or two while I am thinking. –  sange Sep 27 '10 at 19:31
1  
No can do. No door to close. :-) Doesn't help that I'm next to the company shared color laser printer. We get a fairly regular stream of people wandering in/milling around, etc. –  Brian Knoblauch Sep 27 '10 at 19:32
add comment

closed as not constructive by Mark Trapp Nov 13 '11 at 12:12

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

9 Answers

up vote 1 down vote accepted

I find myself doing this before I goto bed. I would be uncomfortable doing this at work as I would think upper management would think I am not doing anything. They typically do not have a grip on how code development works. Usually, laying out code is the simple part, design is the hard part.

Regarding your question, this is on a per person basis. I do not personally think one particular method works for all. Whatever enables you to concentrate on the problem at hand or design in question is what works for you. I find music to be a help as well as driving. Yes I design programs while I drive, probably why I went left of center officer but the next day my boss is obliged at the progress I have made.

share|improve this answer
    
yes, I agree with you, one has to find his/her method by himself/herself. the problem is that sometimes people do not feel the need for improving the way they do things –  flow Sep 29 '10 at 8:38
add comment

Sounds like a nap to me.

Personally, I pace and talk to myself while I think; which is my implementation of the rubber duck technique.

share|improve this answer
    
you talk to you internally or with real voice? –  flow Sep 29 '10 at 8:43
    
@Werner: Both. I found that, if you talk out loud, you have for form certain thoughts more concretely. Otherwise your internal conversation will just quickly move on to something else. –  Steve Evers Sep 29 '10 at 14:45
add comment

I usually started my day by typing hg log or hg diff (I uses Mercurial for version control) in the Terminal.

share|improve this answer
    
ok. in which way is mercurial better than svn? –  flow Sep 29 '10 at 8:41
1  
@Werner: This should be a separate question, and it has been addressed multiple times, but well... Mercurial is a distributed version control system, so every working copy is a fully-working repository by itself, with full history and ability to do local commit (no need to connect to the server) and only push at the end of the day. You can also push/pull to other developer's repository, instead of just to the central repository. Hg is faster for almost everything, since most operations are done locally (except push and pull). –  Lie Ryan Sep 29 '10 at 10:25
add comment

Not about the code per se, as in lines of code, but I do think about how code would interact. This helps me to do abstraction and modularize the code into classes and/or methods. I don't think anyone just hits the keys before having thought out at least this part first...

share|improve this answer
add comment

Like Chris, I do this at home -- I'm a freelance programmer, and do a lot of programming from my home office. Sometimes when I am stuck, I will go into the next room and lie down for a bit to think about the problem. For some reason I seem to think better when I'm horizontal. I've also noticed when am trying to write a story, and I have writer's block, I will do the same thing.

The problem is, as soon as I get up to write down anything, I start to lose it. I have tried using a netbook while lying down but that was not very convenient. Tried dictation using Dragon Naturally Speaking, but that's no good for code. Pencil and paper is about the only thing that works.

share|improve this answer
    
yes, something very similar happens to me! people say ipad is great for that purpose as you can lay horizontal and supossedly confortable. for me the best is sometimes also the paper and pencil (different colors). I start with a single paper sheet, from there and for each concept/thing that needs to be explained, I add a new sheet, kind like a wiki. By the way, can anybody recommend a software (not wiki software) for this? –  flow Sep 29 '10 at 8:40
add comment

Are you sure that they are not just using the time to wake up? ;)

Sometimes I space out while thinking of a problem, just staring at nothing at all for a while. It doesn't last for more than a minute or so, though.

Otherwise it seem like I think better while coding, so I just start with the simple stuff while I'm thinking of how the more complicated stuff should work.

Some of these guys are really effective and develop very complicated code.

Either that's not an accurate description of what they are doing, or they aren't really good programmers.

If they are actually creating simple code to solve complicated problems, then they are worth all the admiration, but if they are in fact creating complicated code to solve any problem, they should rethink what they ary doing.

My favorite quote comes to mind:

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. Kernighan

share|improve this answer
    
well, i guess sometimes it is better just to be sure that one wakes up completely before making bug mistakes, as I usually do when I do not have things clear in mind. I agree that code should be as simple as possible –  flow Sep 29 '10 at 8:42
add comment

Some of these guys are really effective and develop very complicated code.

Writing complicated code is the opposite of being very effective. There should be no need to spend 30 minutes reminding yourself of what you did yesterday; check out the diffs in your source control program and you should be up to speed.

I do see value in "away" time to ponder a problem, but that away time does not include sitting at my desk pretending to be in some zen state.

The way I focus on my code, and this may sound weird but I'll say it anyway, is that I have my editor open and I'm writing code. I can type much faster than I can write, I don't see much value in writing code per se on paper although sketching out components and interactions can certainly be useful.

share|improve this answer
    
hi, i do not understand the last paragraph. what is the difference between typing and writing for you? –  flow Sep 29 '10 at 8:45
    
Sorry- the OP said something about writing code on a sheet of paper. I meant "writing code in my editor" to imply that I was not using a piece of paper, but rather my computer. –  dash-tom-bang Sep 29 '10 at 17:52
add comment

Sounds like they are just trying to get ready to start the day :p

I personally get straight into work when I get in the door, after checking emails, etc. I leave myself notes on what my next step is before I leave the office, so that reminds me where to pick up work from.

I can visualise code, though. I've been told that it looks really weird when I "do that Minority Report-style flick-things-around-the-screen trying to work out where things go, even though you're just sitting there, fingers flying about, with a concentrative look on your face". I embarrass myself. A lot.

share|improve this answer
add comment

I run (almost every day) - not very far, but enough to keep myself from dying (I hope). But more importantly, I bet I solve more problems in a 40 minute run than I do sitting in front of the computer. My desk time is largely about implementation, but that little bit of alone time away from gadgets is where a big chunk of my strategies, approaches, alternate plans, and architectures come from.

share|improve this answer
    
I realize now that I didn't answer the question - instead I answered what I do /instead/ of closing my eyes and thinking. Hope it's helpful anyway. –  Alan Sep 27 '10 at 23:39
    
no, that's a good asnwer as well. it happens the same for me, the problem is that I always find excuses for not going running –  flow Sep 29 '10 at 8:43
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.