I think the main point is not that you should or could breach the contract, but rather to make you aware of the implicit parts of the contract, and how you can make some parts of it explicit as desired. For example, passing undefined or null when an actual value is expected is a breach of contract that does happen in practice, so you might want to defend against that.
I suppose that depends on how you learn best. For me, it helps to understand the bigger picture and abstract concepts so I will be able to generalise it to future situations.
But there is a scale of contracts in terms of how pure your function is, and they're easy to overlook - this article focuses on that bigger picture rather than just passing in undefined. But yes, I consider a look at more extensive typing systems and their encoding of function contracts (i.e. an even bigger picture) to be interesting as well.
0
u/[deleted] Aug 27 '16
[deleted]