Some people says that unit test are not maintainable...
... but that we should add more comments in our code.
This is just plain wrong. I think that untested code is not maintainable, and if you have a low test coverage of your code, soon you'll have developers that will say : "We can add that functionality because we would have to retest everything manually and it will take too much time". Correcting bug and adding feature will take more and more time
Unit test are compilable documentation of your code which are, by definition, more maintainable that plain text comment.
Most of the time the comments I see are useless at best, misleading at worst because they are almost never updated. They are useless because they explain what the code is doing which is duplication because the code already says what. The comments should answer the why instead.
If you have to choose between writing a test or comment, you should choose a test, because it is more maintainable. The reason for that is simple, as soon as your test is obsolete it will break and this is the time you have the best chance to know why the test broke.
This is just plain wrong. I think that untested code is not maintainable, and if you have a low test coverage of your code, soon you'll have developers that will say : "We can add that functionality because we would have to retest everything manually and it will take too much time". Correcting bug and adding feature will take more and more time
Unit test are compilable documentation of your code which are, by definition, more maintainable that plain text comment.
Most of the time the comments I see are useless at best, misleading at worst because they are almost never updated. They are useless because they explain what the code is doing which is duplication because the code already says what. The comments should answer the why instead.
If you have to choose between writing a test or comment, you should choose a test, because it is more maintainable. The reason for that is simple, as soon as your test is obsolete it will break and this is the time you have the best chance to know why the test broke.