Hacker News new | past | comments | ask | show | jobs | submit login

I also would like to see a system that forbid me to write code that is not covered by a unit test yet.

I suspect that would lead to the people who are currently not writing unit tests writing useless tests just to circumvent the requirement. It would also make exploratory programming, where you haven't completely figured out what you want it to do much more difficult.




See, THAT is why you think before you leap. Iteration #1: make it 'forbid to commit code' instead of 'forbid to write code'.

And I agree that that might only work fine in safety-critical code.

And writing useless tests won't help if this would be as strict as I envision. Imagine a project where you cannot commit

   if flag:
     doA
   else:
     doB
unless you have a test that hits the doA part and a test that hits the doB part. Complete code coverage, enforced by the system. I am thinking more and more that I do want to see such a tool, but not really will want to use it. Maybe iteration #2 is "hm, that is not the best of ideas". Although, if somebody would want to pay for such enforced code coverage, it could be fun to search for with design patterns that help it make easier to write such code...


Are you reinventing design by contract using tests?


Now you mention it: yes, probably.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: