Fog Creek Software
Discussion Board




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 ;) ).

Also, how do you find that magical moment in time when you know you've designed enough and are ready to for pounding out code?

Crimson
Tuesday, March 25, 2003

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).

As a rule though, once I understand the algorithm or layout on paper, I do little if any pencil and paper thinking. Mostly, I can think by structuring comments or writing layout or the like.

Come to think of it, I usually motivate myself by doing all the layout I know I'll need (name the functions, layout the class and the comments I know I'll want, etc). As I do this, things naturally occur to me and get inserted into the flow until I have a bare bones outline of what ever it is I'm working on.

More goes on from there, but my basic answer  to how much pen-and-paper is "not much but some".

Steven C.
Tuesday, March 25, 2003

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.

It is hard to be quantitative about how much time it takes.  Usually I don't spend much time with paper, more with the keyboard.

mackinac
Tuesday, March 25, 2003

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...

Steven C.
Tuesday, March 25, 2003

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.

RRKSS
Tuesday, March 25, 2003

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...

Why biros? It's the thing about "thinking before you write".

Why big bits of paper? Because I hate running out of room halfway through a thought.

Why bed? Because it's comfy. My other half likes really plain environments, free of what he terms "visual clutter" to think in. I need these complex environments full of things like coffee, the History channel and cuddly toys. And it has to feel like MY environment: any random complex environment isn't enough. I probably shouldn't work in bed -- it doesn't help my insomnia, but I happen to like being in bed. It's all comfy and cosy and I can go to sleep if I need to.

This isn't "work" work, of course, because that doesn't need designing. This is the hobby work I do at home to stop myself going insane from being underchallenged during the day...

Telling when you're done is tricky. I find I can tell when I've done a bit when I stop having this nagging doubt that I've forgotten to consider something... but that's not really useful to anyone else.

Katie Lucas
Wednesday, March 26, 2003

I use pen and paper for working out a design, but for actual lines of code I type them straight into the computer.

T. Norman
Wednesday, March 26, 2003

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.

Mike Swieton
Wednesday, March 26, 2003

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.  :)

HeyCoolAid!
Wednesday, March 26, 2003

On paper, I tend to stick to doing my major objects, classes, table structures, etc.

If its really tricky problem, I will do a data or process flow.  Other than that, its the keyboard for me :)

Bryan Shaw
Wednesday, March 26, 2003

2 Words....

"Whiteboard Baby"

KenB
Wednesday, March 26, 2003

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.

I like the idea of the spiral notebook.

Nat Ersoz
Wednesday, March 26, 2003

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.

Also, on the same general subject - on really large or abstract projects I will often write up some sort of executive overview of the work, just for myself and perhaps to communicate to the project stakeholders.


Yeah, that's the "professionals write" bias I have. What the overview accomplishes is twofold - one, it helps me understand the problem domain better by just trying to write a "story" narrative about it. If I stumble in describing the process I'm trying to implement, it tells me that I don't really understand what I'm trying to do.  Secondly, it can become a specification of sorts that can be passed around to interested parties as needed, to get everyone on the same page.

FWIW.

Bored Bystander
Wednesday, March 26, 2003

My work cycle is: think, code, test ...

At each step I use any tools or means that make my life easier (hence more fun 8).

Cheers
Dino

Dino
Thursday, March 27, 2003

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.

My notes are generally useless later.

Chris Tavares
Thursday, March 27, 2003

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.

Martha
Thursday, March 27, 2003

*  Recent Topics

*  Fog Creek Home