Be Kind to Future-You
An early mentor of mine described the starting point of a development effort, feature implementation, or a debugging session as
The Point of Maximum Ignorance
Besides it being the point where the client wants a fixed-price bid, it is also the point where Past You can do the most good for Future You
When one is coding a feature and comes to the error handling, one has a choice: throw an Exception("Something went wrong")
or pay some of the debugging work forward. That point of error handling is The Point of Penultimate Wisdom1(PoPW)
The code knows
- what it was trying to do
- what step went wrong
- what values it was using at that step
- (in many cases) what code was calling it and the values it passed in
- and more
One can find wisdom after something went wrong by furiously2 instrumenting the code and deploying it into production, by swimming upstream in the logs to find the butterfly...