4 ms·
Make it easy to verify what you have written works. This can be done in several ways, and which ones to use depends on the people you're working with and what a
by Poiesis 9y ago
Make it easy to verify what you have written works. This can be done in several ways, and which ones to use depends on the people you're working with and what access to the production code you have. Debug log levels are a popular way to do this.
* Always make a way to examine the data that's coming in (over network, arguments, whatever) to make sure your code is receiving the input it expects, and to be able to predict output/state changes.
* Similarly, have a way to see the data/state changes produced by what you wrote.
* Don't log all this by default.
* ...except for unexpected outcomes. By all means, check your inputs and loudly complain if they are garbage in a way that's unrecoverable.
* Be judicious about how much of this you normally expose to a user; don't overwhelm a user with unactionable noise.