Reducing Lost Code Recovery Time
How do you reduce your recovery time when you've lost a bunch of code you just wrote? To misquote Bart Simpson, "Version control, my man."
In an earlier article, I wrote about the pitfalls of losing unsaved code. In particular, I explored the relationship between the amount of lost code and the time it takes to recover from that loss. Specifically, I opined that a variety of factors lead to this relationship being non-linear. For example, five minutes of lost code can be recovered in about one minute, while four hours of lost code could easily take two full days to recover.
Losing Your Place
Here's what I wrote about trying to recover from four hours of lost code:
Unfortunately, there's another complication that makes this situation even worse. Trying to remember back four hours, your brain can't even be sure it remembers where it left off.
Did you ever fall asleep binge watching a TV series? The next day, you rewatch the episodes that were on as you were falling asleep. As you're watching, bits and pieces of the show are familiar, but there are also gaps in your memory from when you were drifting in and out of consciousness the night before.
Losing four hours of code is a similar experience. One of the biggest difficulties is simply trying to figure out where exactly you left off when Access crashed. Which functions or classes did you write before the last save? Which ones did you write after the last save?
More importantly, which bugs did you discover and fix after the last save? Assuming a bug is fixed when it's actually not could cause your recovery time to go through the roof.
Reducing Recovery Time
So, what's the best way to reduce recovery time in this scenario? You need an easy way to see exactly what changes you have made in the previous few hours.
And what's the easiest way to see what changes you've made to your code? Version control.
With version control
You can see exactly what the last thing was that you changed:
Without version control
(I know this pain because I lived it before I started using version control.)