Hacker News new | ask | show | jobs
by Waterluvian 1386 days ago
When I was newer I tried it as a hard rule and it sucked. So much wasted time and silly tests that didn’t test anything interesting.

Now I have a sixth sense for what I should write tests for and when I should write them before vs after the implementation.

Rules are misleading and teach the wrong thing. Instead, here’s one loose question I ask myself: “does the interface inform the implementation or the other way around?”

When the interface is super important and known, I can write a test first. When the implementation will reveal what the interface’s shape might be like, the test might come after.