Hmm, maybe this is part of the motivation for test-first programming? Since I was originally trained to do test-first, I don’t have this problem, because there are always already tests before I write any code. And I pretty much always know my code works, because it wouldn’t be done if the tests weren’t passing yet.
Although, I haven’t explicitly done test-first programming, it appears as though it could be a great way to remove the trepidation. I do, however, often work on problem sets for school which come with pre-written tests, and I find myself mildly anxious before I run those tests on my code. Perhaps, the problem here is that I have internalized that code is “done” when the last line is written, as opposed to the test-first paradigm where “done” necessitates passing all the tests.
How do you feel in that space between completing your last line of code and running your first test?
This reply is extremely late, but I’m annoyed at myself for not having responded at the time, so I’ll do it now in case anyone runs across this at some point in the future:
I guess I feel a little trepidation or edge-of-my-seat feeling when I first run a test (I have surprisingly often ended up crossing my fingers), but I try to write tests in a nice modular way, so that I’m never writing more than ~5-10 lines of code before I can test again. I feel a lot more trepidation when I break this pattern, and have a big chunk of new code that hasn’t been tested at all yet.
Hmm, maybe this is part of the motivation for test-first programming? Since I was originally trained to do test-first, I don’t have this problem, because there are always already tests before I write any code. And I pretty much always know my code works, because it wouldn’t be done if the tests weren’t passing yet.
Although, I haven’t explicitly done test-first programming, it appears as though it could be a great way to remove the trepidation. I do, however, often work on problem sets for school which come with pre-written tests, and I find myself mildly anxious before I run those tests on my code. Perhaps, the problem here is that I have internalized that code is “done” when the last line is written, as opposed to the test-first paradigm where “done” necessitates passing all the tests.
How do you feel in that space between completing your last line of code and running your first test?
This reply is extremely late, but I’m annoyed at myself for not having responded at the time, so I’ll do it now in case anyone runs across this at some point in the future:
I guess I feel a little trepidation or edge-of-my-seat feeling when I first run a test (I have surprisingly often ended up crossing my fingers), but I try to write tests in a nice modular way, so that I’m never writing more than ~5-10 lines of code before I can test again. I feel a lot more trepidation when I break this pattern, and have a big chunk of new code that hasn’t been tested at all yet.