3 ms·
But how can I mentally execute code if the whole point of the code is to interact with a third-party OS facility or application that's closed-source and therefo
by mwcampbell 11y ago
But how can I mentally execute code if the whole point of the code is to interact with a third-party OS facility or application that's closed-source and therefore opaque? In that case, my mental execution of the code will depend on a mental model of the third-party component that's probably incomplete. Might as well just let the machine run the real thing.
- userbinator 11y agoIt does get a little more difficult when execution flows into code you didn't write, but you can still validate your post/pre-conditions at those boundaries.
- etingel 11y ago> In that case, my mental execution of the code will depend on a mental model of the third-party component that's probably incomplete. That's the whole reason why you would want execute the code mentally. If you don't execute the code mentally, you might not realize that your mental model of the third-party component was incomplete to begin with. Mentally executing code is a great way to test your own assumptions.
- yuliyp 11y agoYour mental model of the code you're reading is probably incomplete too. Just be aware of where you're less confident and then you can use different mechanisms to build that confidence when it's the most logical thing to do (running a minimal test case, or log a function return value, perhaps).