Writing Tests Instead of Comments

Jon commented

Unit tests are the best comments you can leave a developer or your future self.

Well, these aren’t unit test exactly, but they are tests. The question is, do they adequately document the code?

First, the code

And, the tests.

Posted in VBA

2 thoughts on “Writing Tests Instead of Comments

  1. No, not for me.

    People are hero’s with comments, just write them, where and when you want and get on with it. :-)

  2. The tests pretty accurately describe what the code is trying to accomplish (offset long weekends properly). And if your future self needs to change or extend that you make sure you didn’t break it. What more would you you say in comments that isn’t said in the test code.

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.