3 ms·
Reusable modules of code involve implementation and the interface. If you just write out an implementation without thought for how others are to use it, there'
by rgoulter 3y ago
Reusable modules of code involve implementation and the interface.
If you just write out an implementation without thought for how others are to use it, there's a risk that you'll end up with an interface that's more complex to use than it needs to be.
The idea is that by 'using' the interface of the module first (e.g. by writing tests first, or by writing documentation first), then the design of the interface isn't left to be an afterthought of the implementation.
Similarly, it's easier to consider edge cases when thinking about unit tests / documentation, etc.