Ask HN: Do you experience a crippling fear of “writing low quality software”?
For some time, I just assumed it was something like burnout; I write code at work and don't wish to do it at home. But even when I do have a day off and I feel like writing something... I rarely get anything done.
However, yesterday, in my spare time, I started working on a small program. I had an idea that I wanted to explore, but very quickly I ran into some trouble writing unit tests for it. Eventually, I got overwhelmed with two unacceptable options:
1) Write this thing without tests.
2) Build an -insane- amount of scaffolding to make tests possible.
A whole day of struggling to do TDD and I have nothing to show for it. It has really ruined my mood, and I realize now how often that has happened when writing software. In a way, "ignorance is bliss" -- had I never learnt about software correctness, I'd be producing more. Though I fear it would be 'lower quality' in some way.
Has anyone else felt this? The solution can't be to abandon tests, static analysis, and so on. I did initially think perhaps tests should only be written when a bug is discovered - i.e. reproduce the bug with a failing test, then fix the software. That particular function's rewrite/repair can be guided by static analysis.
I guess so long as the code is written to be reasonably testable, that may work?
Even though I want to write good code, the pressure I put on myself to produce good work seems to drain my soul.
5 comments
[ 2.8 ms ] story [ 32.0 ms ] threadIf you're doing something as a hobby, don't sweat about the tests. Just do it because it's fun - and the second it stops being fun do something else.
For personal projects I do really minimal testing if any at all. Again especially for "exploratory" projects.
There is a spot I think for personal projects where lots of tests make all kinds of sense. But just for playing around. Meh. Trust your abilities and embrace the dark side. :)
I can relate to the general sentiment; I have little ideas all the time, and my desire to "do things right" leads me to go off on tangents configuring CI/CD pipelines and other tools, but I enjoy that too, so I don't feel like it's a waste of time. I just might not end up working on the thing I started out wanting to do.
I realized this morning I could have used a mock/test double -- at the time I was thinking I'd need to have some in-memory filesystem so I could later run assertions. I guess I needed to sleep on it.
Anyhow, I'm sure I have run into similar issues where I've felt some pressure to pick between getting some code out and getting some good code out. That is more what this post is about. I was using that as a recent example.