← Back to context

Comment by bluefirebrand

10 hours ago

> good tests show you how to use the code

If you can't find examples of how to use the code in the code then why does the code even exist?

There are multiple problems with that:

1. The code uses internal interfaces, not meant to be used by users of the code.

2. The code might not use the high level public interfaces you are interested in. Those interfaces are meant to be used by users, and tested by tests.

Having said that reading the code itself is often fruitful. Not for example usages, but to just learn how the thing is implemented.

Code is not always meant to be run by strangers, if it's internal to a team. The interface for customers should be documented.