Pen-and-Paper coding vs "At-the-keyboard" coding..
Just curious about other programmer's habits. For a nontrivial coding job, how much time do you spend writing out on ideas/algorithms/preliminary designs/etc on paper vs actually sitting down and banging away at the keyboard? Some people claim to be able to sit at a computer and immediately start producing effective code without any time with a pen and paper. However, for me, this would be impossible (at least for producing *good* code ;) ).
I can't speak to designing, but the work I do often requires me to grab a piece of paper and diagram things so I can get an idea of how an algorithm or layout works (for instance, the way gcc 3.0 lays out classes in memory where there is some virtuality in the inheritance -- what I am doing right now).
I like to have a pile of 11"x17" fan fold computer printer paper, a couple of pencils (a Koh-I-Noor Rapidomatic is my current favorite), rulers and templates and a good eraser available to use when starting on a design. Working with paper and pencil is kind of slow, but it is easier to get a clear idea of the design.
Actually, although as I said I don't do much programming work on paper, I traditionally have 3 or more notepads on my desk, with assorted notes and organized todo lists. I think I have a mania...
I like to type my step-by-step algorithm on top of the function. That way I can follow it while coding and it helps explain how that piece of code works a few months ahead when you don't even recognize that code anymore.
I use huge peices of paper -- flipchart refill pads, things like that, and black biros to do design stuff. This complicates things because I design stuff in bed. This is one reason why I bought a huge bed, so I'd have room for that and a laptop and books and all the assorted stuff I need to work...
I use pen and paper for working out a design, but for actual lines of code I type them straight into the computer.
I got pissed one day (ran out of paper and desk space) so I bought a whiteboard for my bedroom. I had to replace the Pink Floyd poster, unfortunately, but it's damned handy.
My absolute favorite tool is a spiral bound pad of notepaper. I do all of my designing, debugging, and doodling in it. When I'm done, I just close it. No stacks of random pieces of paper and notes floating around on my desk that I need to dig through. Depending on the complexity of what I'm doing, I may do more or less "pen & paper" work. If it's small, I usually just go for a simple outline and some algorithms. If it's more complex I design my classes and the general structure as well, then break it all down as far as I can. I never write actual code down on paper. I don't find that very useful. I just mess up and have to scratch things out, making it unreadable anyways. The keyboard has a very handy tool called the backspace key. :)
On paper, I tend to stick to doing my major objects, classes, table structures, etc.
There is something about sitting at a keyboard that says "code baby". And that is often helpfully efficient. But just yesterday I hunkered down in a conference room with a white board and paper to work out a algorithm. It only took an hour - it turned out to be easier than I thought. But I could not get the brain to think that way next to the key board.
Yes, I do this too. I will draw an ad hoc structure or data flow diagram on some scrap paper in order to get the concepts of what I'm trying to do set in my mind. Generally, all I need is this to kick-start to the creative process to help me visualize whatever it is I'm trying to accomplish. Generally, the drawings are throwaways once implementation is underway.
My work cycle is: think, code, test ...
I'm kinda weird this way. In many cases, I'll start writing a diagram or some code on a piece of paper. But I never finish that paper. I get about a quarter of the way in, then switch back to the keyboard, and start coding for real.
I do that too--start writing out the database schema on paper, then after about the third or fourth time I have to erase something because I thought of another field (or whatever), I give up and just get to work at the keyboard.
Fog Creek Home