Hacker News new | ask | show | jobs
by mattgreenrocks 3064 days ago
One way that helps me is to read the code I wrote in several different contexts.

Most of my code reading is in my editor. I'm in a certain mode of thought there, mostly detail-oriented as I piece things together. When committing code, I use git diff to inspect everything going into the commit, making sure I agree with it. I do this in a terminal (I don't use a terminal-based editor) with a different color scheme. Lastly, I'll re-read it again (especially if I'm not 100% sure) on a web-based git server (Github/Gitlab) as a way to get some closure on the day/commit.

This works well for me because:

* Most committed code is read at least twice

* Each reading context is different, at least visually

* Time passes between each reading, which gives your brain space to surface doubts

Doubt is your friend here. With enough experience, you'll know when you've nailed something.