(no title)
squirrelicus | 6 years ago
That being said, executing the code while typing it is critical. You cannot build a mental model of all edge cases. At best, your personal discipline will allow you have habits around preventing and catching edge cases. But you won't find enough edge cases just by thinking about the code to type. You do have to discover them by running the code, and the sooner you discover them, the faster you will be at producing high quality code.
As far as how much time I spend building a mental model vs coding... It's at least half mental model time. If I happen to predict enough edge cases, then it might be 90% of the time. But the critical part is that I'm not done until I've exhausted the edge cases I can imagine. If I discover sufficiently big edge cases that brick my code, it's time to step away from the computer and fix my broken mental model.
Note: tests are a way to do this, but so is white box poking and prodding at your program in debug mode.
mstade|6 years ago
(The last nota bene of your comment is particularly striking to me. I love tests and I try to automate them as much as possible, but sometimes you just gotta prod and poke the thing to really get a feel for it.)
einpoklum|6 years ago
squirrelicus|6 years ago