Skip to content(if available)orjump to list(if available)

What is an invariant? (2023)

What is an invariant? (2023)

2 comments

·January 9, 2025

efitz

I’m not sure that I agree with the article.

In the course of my work, I think of an invariant as a state that must hold true at all points during the software’s execution.

For example, “port xxx must never accept inbound traffic”.

I don’t think of invariants as mindsets; I think of them as runtime requirements that are observable and testable at any point during execution, and whose violation is an indication that some assumption about state that the proper execution of the software depends on, no longer holds.

Maybe a good analogy would be “a runtime assert”.

JadeNB

> In the course of my work, I think of an invariant as a state that must hold true at all points during the software’s execution.

That seems quite close to the author's answer:

> Perhaps it’s time to answer the title question: invariant is some property which holds at all times during dynamic evolution of the system.