Live data from Hacker News

How I Write Code: Pen and Paper

noteflakes.com

61–70 of 110 posts

Re: How I Write Code: Pen and Paper

#61
post #35

Earlier quoted context omitted.

No, the author is actually writing code using pen and paper. It's not just a high-level or organisational sketch. It's not just planning. What happens at the computer afterwards can best be described as transcription and debugging.

I find it pretty unlikely that this entry: > I opened my laptop, created a new Github repository, typed in the code, added some tests and wrote the README. It was probably all done in 4 or 5 hours of concentrated work. Means handwritten code verbatim went into the repo. The focus on iteration is great - it would be unusual to stop at this point. But if we say the written word is canon, my response is that's inefficie…

No, she probably kept editing it after she typed it in; aside from debugging, I always find things I can improve when I'm typing in code I wrote on paper first, so I do. But that doesn't mean that what she wrote on paper wasn't the code for the module. I mean, you can see some of it in her photos. It's syntactically valid C and Ruby code, semicolons and all.

Re: How I Write Code: Pen and Paper

#62
post #26

I used to code in pencil during the day at school, so I could test when I got home (and avoid boredom). These days I'll still sometimes use paper if I'm trying to optimize some inner loop assembly, easier to draw the code and the data side-by-side when both are changing. Edit: This line resonated with me: > Maybe someday I’ll be able to handwrite code on an e-Ink device and then run it. Are there successful projects…

I devised a notation for this kind of thing but haven't implemented it on a computer: http://canonical.org/~kragen/sw/dev3/paperalgo

Re: How I Write Code: Pen and Paper

#63
Website seems down; https://archive.is/0vc8S

It's pretty cool how the comments are divided between "I write code on paper/I used to write code on paper" and "Nobody could ever write code on paper, she must be speaking metaphorically." It's kind of like China Mieville's "The City and the City": somehow these two populations in the same place don't see each other at all, or they pretend not to, in order to avoid conflict.

I have an easier time writing code on paper than on a computer when it's "algorithmic" and its problems are internally generated, or when it's in a domain I already understand really well. I wrote a Soma cube in OpenSCAD once in a text editor on an internetless iPhone, which is more or less the same thing; Naomi Wu mentions that this is one of the benefits of OpenSCAD for people in poor countries, where they maybe don't have access to sit in front of FreeCAD or Blender all day, but they can totally type text on their cellphone while they're on the bus. Or write it on paper, maybe, but that takes two hands.

On the other hand, I also write a fair bit of code where the relevant unknowns are things like "What kind of user interaction will feel responsive?" and "What will this API do if I invoke it with these arguments?" and "How many public recursive DNS resolvers are there on the internet?", which are not things I can find out by thinking and writing things on paper.

Re: How I Write Code: Pen and Paper

#64
I always feel boxed in inside an IDE -- Why can you not attach images inside IDEs? diagrams of what you want to do...

I like doing this in notion -- here you can write code with the syntax highlighting and attach all sorts of stuff to the document -- once you've crystalized exactly what you want to build, you can fireup your IDE and get to work.

I think it ties with the theme -- A programmers work is not to type things -- the main input is thoughts and ideas that can be interpreted by a computer to do correct things. A notebook helps with the thoughts and ideas part.

Re: How I Write Code: Pen and Paper

#65
I sat an exam in high school where we had to hand write code for... Either a Mandelbrot set generator or some prime search thing, can't remember.

But it was a simple algorithm and it didn't specify a language so I wrote it in 386 assembler. I think that to this day is the only program I wrote by hand, and I know it compiled and ran correctly as they made me type it and execute it (only for fun they knew I knew what I was doing)

Re: How I Write Code: Pen and Paper

#67
post #43

Earlier quoted context omitted.

As someone who's worked a fair bit now - coding has absolutely no value to any company. What delivers results is deploying solutions - whether those solutions are powered by hotpockets and red bull at 3AM or whether they are entirely composed of meetings discussing how to inform customers of the change - it is never "coding" that solves a problem. "Coding" is at most the effort of transcribing a solution from your br…

Coding often gives feedback on your plan and design. You may not see its flaws as long as its only in your head or on paper. When you write the code and try to run it on your computer you often realize something is wrong with it. Architects do a similar thing, they visualize in their heads and on paper, but then they also actually build 3D small-scale prototypes to get feedback on their design. So I would say that co…

this is why I made the question about coding being called 'typing', in writing, coding or anything similar when you are at the 'typing' stage you will often revise and think more about what you are doing, add in conditions for edge cases and so forth. It is not just transcribing the thoughts you have already had, it is developing those thoughts at the same time.

Re: How I Write Code: Pen and Paper

#68
post #31

This may seem pedantic, but this is an aspect of project management. The pen and paper aren't in the coding, they're in the design. You may be doing some abstractions/pseudo code on paper but you're not coding. You're planning. There's nothing wrong with this! I think it's a great way to operate. But it's less sexy to say "How I Plan: Pen and Paper" then to conflate it with coding. Everyone does planning. Some people…

My cs classes in college gave quizzes via webpage or email, but the actual exams were on paper, hand writing actual code. Multiple pages of it. It actually helped make things stick better, after initially adjusting to it. Afterwards, I would end up typing code more deliberately, and found myself tapping delete far fewer times. Very similar experience to learning drafting-by-hand before CAD.

yup! I distinctly remember having to write out by hand a PATRICIA tree in C++ for the final exam of CS106X.

feel bad for the T/As that had to grade all those exams.

Re: How I Write Code: Pen and Paper

#69
It's fun to see someone else that does this! I also write code with pen and paper. Mainly for work, but I have good memories of a holiday with a notepad and The Little Schemer (with a long till receipt to cover up the answers column).

Similarly I sometimes code review by printing out diffs and writing on them.

I like the tactile side of writing, and the spatial freedom. Also I just find it easier to think away from a screen somehow -- coding on a computer is still my majority case, and it's essential where it's the type of work that involves stitching things together. But for algorithm or code-design style work, if I get stuck I write it down.

One theory I have is that because I have a very spatial/location-sensitive kind of memory, scrolling on a screen messes with my internal mental map of where things are.

I mean that if I'm designing something or trying to understand someone's code, my working memory built up of the things that I'm reading or writing down is linked to where I read or wrote it, and I think a single screen space in which anything and everything can appear messes with that and makes my brain have to work harder to remap things.

Post reply on HN