1 min read

6

This is a special post for quick takes by boggler. Only they can create top-level comments. Comments here also appear on the Quick Takes page and All Posts page.

For thoughts that fail to qualify to blog-post status. Thank you for the inspiration Hazard and zlrth.

6 comments, sorted by Click to highlight new comments since:

Noting: I feel trepidation towards testing my code. I believe this is because I suspect that my code has bugs and bugs are equated to debugging (i.e. work). Yet, once I get over my trepidation and test my code with all the supplied test cases, I become giddy and want to test everything. I believe this is because I feel that my code is free of bugs and every test is then a testament to what I've created. Has anyone else experienced something similar?

Though I don't often get super excited about testing, I have noticed that the number of false positives (I anticipate it being difficult, but it's not that hard) is higher than I want it to be.

Yep, I love testing when I've just done it a bunch, and hate testing when I haven't done it recently. I think a large part is just that testing actually requires a very different thinking style than coding, and I hate context-switches.

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.