Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't always write the tests first, I do what seems practical and feasible. Sometimes it feels more natural to write some code to understand the problem I'm solving.

That said - there is a problem with writing tests last: You don't actually know if your tests are going to fail when they should, because you haven't run them on a code-base that isn't fully implemented.

You can deal with this by stashing the implementation changes and running the tests to confirm they fail where expected, but sometimes this is very challenging because you need a partial implementation to reach some of the failed assertions. This requires thoughtfulness and discipline and so it is hard to maintain this consistently across a team. It isn't possible in a code review to confirm if people have done this, and often it isn't practical to do it yourself as part of reviewing code.



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

Search: