News for hackers. Stuff that matters.
Re:On Comments in Code by SilverRed on Wednesday June 16, 2021 @01:57AM (#27525350)
Unit tests have a much bigger chance of being seen as well. There have been a few times where I will write unit tests that don't really test something is working but just check if it has changed. For example there is one table where every time you add or remove a column, you have to make a considered change to another section of the code.

Rather than adding a comment saying "hey make sure you change that other section" I have test which lists the columns in the table and fails if they change. Then the person who changed it will see the comment on the test explaining why it failed and what they must do.

There are no comments on this comment yet.