Ask HN: When coding, how to do remember what you were doing the previous day?
I always try (not always successfully) to stop what I'm doing when it's time to go home. (If instead, I try to finish what I'm working on before heading home, sometimes I'll accidentally still be working 3 hours later).
For this to work, the next day I need to be able to remember what I was in the middle of before I left.
What techniques do you use when coding, to make sure you can pick up from where you last left off (without spending half an hour trying to get back into the flow)?
Personally I write "here" in the IDE to break the compilation, so the IDE will bring me back to that place in the code when I next try and compile. Sometimes I also add a line or two describing the very next thing I want to do e.g. "finish this off and then maybe move it to the viewmodel" etc
Anyone else?
67 comments
[ 3.0 ms ] story [ 117 ms ] threadWhen in the code and need to jump around different thoughts all in progress, I also tend to put "%%" and/or "%%$%" as a marker for "come back to this". (It helps that it doesn't compile, and works across platforms or different editors, so I don't have to change the habit over time.)
https://github.com/vscode-org-mode/vscode-org-mode
1. Don't get to that point. Don't back away from the keyboard when the clock strikes 5; move away from the keyboard when you're at a natural stopping point. If that point is 3:30, and you know that the next block of work you'd like to do is going to take you three hours, don't start it. Commit, push, and consider yourself done writing code for the day.
2. I keep a journal of what I do throughout the day. This probably is at a higher level than what you're looking for, but occasionally I'll post links to github with the file and line number where I left off.
3. Sometimes, I don't commit everything; hopping back on in the morning, a `git diff` shows me what I'm working on. This obviously doesn't work if you've changed a thousand lines, but that goes back to point 1 - have reasonable stopping points.
4. Break tests. If you know you need to finish something, write a test for it that doesn't work.
It should be added that just because you're "done" at 3:30, there's probably plenty to do. I spend the last bit of my day doing other things that are important such as checking email, responding to pings, writing documentation, updating tests, catching up with coworkers, etc.
When I get back to work the next day, I look at the output of `git diff @~` and I'm back in the flow of things within a minute or two.
I separately keep a TODO file with the list of next major task items, and I break them down into subtasks if necessary.
This allowed me to do a side project in 15-minute chunks on my train ride to and from work for a year
But usually, especially if it's complex, I enjoy the clean state. If it's too difficult to pick up later, then I ask myself: did I really automatize the things that should be automatized e.g. with a script or makefile? Is my project/code navigatable?
These days I keep a worklog for each day that I can flip through, and mark various items as TODO in the log. That allows me to track state over more days, which is useful when there are half a dozen projects to track.
After an hour of cleaning up loose ends, it can be nice to take stock and replan the day. While it can feel nice to finish a commit or model at the end of one day, it can actually lead the next morning to be unproductive.