top | item 39489914

(no title)

bbojan | 2 years ago

> Another way, if you know what the code is supposed to do, why write it down in two places?

This would be like criticizing double-entry accounting by asking "if you know what the amount is, why write it down in two places?"

We write the code down in two places because that gives us advantages that far outweigh the added effort:

- Once written, your test will catch regressions forever

- A test is often excellent documentation on what the code does

- It's now much easier to refactor the code, making it more likely that it will be refactored when needed.

discuss

order

No comments yet.