In grad school, I TAed a 2nd-year theory course many times that devoted about half the term to teaching specifications and invariants. Students always asked me why they were learning this. I told them to wait until they got to 3rd-year algorithms, then they'd see.
Comments
Article: https://matklad.github.io/2023/08/06/fantastic-learning-resources.html