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

What happens when you want to rename and/or split your consequence_method? How many tests do you have to rewrite?


What happens when you refactor your code? It's fairly obvious what happens: you change the name of the method being called. However, the benefit here with TDD is you still retain your testing ability. More importantly, anywhere in the code also using the method can be easily discovered. Finally, by doing this, you've automatically updated your documentation as well.

So, let's see, you've updated tests, code, and documentation all in one. Whereas if you didn't have tests, you'd have to update the code through manually searching and testing everything, and still have to remember to update the documentation.


Conversely, what happens if someone else renames/splits consequence_method? Without this unit test, how would they have known they broke something?

Unit tests help refactorability in dynamicly typed languages. Whether this is an argument for static typing is left as an exercise for the reader.




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

Search: