Hacker News new | ask | show | jobs
by MrDosu 4086 days ago
I think you misunderstood me.

What I meant was that contracts in a language like C# give me the ability to statically verify the program at compile time. It is not a "nicer way to add conditional testing logic" but a way to formally prove correctness in my programs.

1 comments

IIUC, contracts are specifically for creating verifications at runtime.

In some cases, sanity checking can happen up front/at compile time. In other cases, these must occur at runtime.

The Pragmatic Programmer has a whole section on contracts; it is pretty good.