3 ms·
I focus on the external IO. Once I'm convinced I have tests for most code paths(Unit if I'm being fussy, automated integration tests if I'm being lazy), I ment
by eternityforest 4y ago
I focus on the external IO.
Once I'm convinced I have tests for most code paths(Unit if I'm being fussy, automated integration tests if I'm being lazy), I mentally go through and look at everything impure and think "What if that operation fails", at a fine grained level.
Sometimes I even put garbage code in, to simulate the failure.
If I do 3 network requests, I want to be sure that it won't crash if the internet goes down between the 2nd and 3rd, or if the drive runs out of space between writing the first and second file.
And of course, since everything I'm actually interested in working on is large and complex, I rely pretty heavily on reuse, which means my first line of defense is what other people say about stuff. If Google and Amazon trust it, I might to, if it's got 4 stars on GitHub, I'll probably stay away unless there's no alternative and it's small enough to debug myself without unreasonable effort.
I also like to have the computer help me with the reasoning as much as possible. My likes and dislikes as far as languages are heavily influenced by how well the linters work. If something is too freeform and allows lots of stuff then linter doesn't understand, I'll pass on that.