On Invariants.

What is an invariant?

Andrew Pritchard

--

  • The specification of a program should be its class invariants
  • Aim to write programs so that you cannot create invalid objects or data.

I’ll use Rust as the language to describe the concepts behind this post, but try to make it accessible to those using other languages.

--

--

Andrew Pritchard

The stories I write are a part of a learning journey through life, logic and programming. Share this journey with me.