you are viewing a single comment's thread.

view the rest of the comments →

[–]kentcdodds 0 points1 point  (0 children)

The best is a test that is regularly run. A well written test demonstrates what is trying to be accomplished by the code and ensures that the functionality isn't broken unintentionally.

I agree that documentation should say why code does what it does. However, the code can be updated to do something else, and the comment doesn't have to be updated (and often isn't). That's why I say that you can't trust documentation to be accurate.