Hacker News
points by 1718627440 4 days ago | 0 comments
I had the same experience of writing almost no bugs when writing on paper. (Only conceptual bugs, e.g. in architecture or that I solve the wrong problem in the first place.) But when I now write code on a computer, I do introduce bugs. However I regularly find tricky and rare to occur race conditions or heisenbugs just by printing and reading the code from top to bottom, without a goal, just for entertainment. I did not know of the existence of the bug, before I find them. They stick out when you read it, because it's not what you have in your head that should be written there.

It helps me to print it in a different font/color and without syntax highlighting to force my brain to read it as new code, instead of simply assuming it's the same as I already know.

[–] saidnooneever 3 days ago
i recognise this. i do pen and paper still but i do also write bugs. when i do i try to make test programs to learn why, and ideally recognise where my pen and paper whent wrong, because those are gaps in my real understanding of how my language, the program or interactions with its environment and platform really work. Needless to say i always find myself having lots to learn still :). i think in reality only once or twice i wrote a program truly free of bugs. relatively trivial programs ofc (simple socket client/server with basic binary protocol or so. easy to reason about, no complex sync or threading requirements).

i never use syntax highlighting. one day someone told me it was very distracting, i turned it off and suddenly things were calm. Maybe its just taste but i do find it helpful. you really read stuff rather than assuming some color happening means its correct or incorrect subconsciously

Hacker News