4 ms·
> 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
by JadeNB 2y ago
> 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.
- MontagFTB 2y agoFor data structures, an invariant is something that must hold true at the end of all its public APIs. For example a doubly-linked list may have to break invariants around its pointers while in the middle of a splice or insert. But at the end of those public routines they must all be valid and conformant to the type’s requirements.
- lupire 2y agoRight. A "system" is the observable parts. If you have a good wall of abstraction, you have freedom in the internals and security in the observables.
- swatcoder 2y agoIndeed, but the author works through a deeply idiosyncratic train of thought before getting to that, and then quickly continues with some creative analogizing about how the idea of an invariant might be applied at other scales. For an essay titled "What is an invariant?", it doesn't really focus on answering the question at all and so the GP's failure to spot the traditional answer is pretty reasonable. A more fitting title may have been something more like "Invariants in software system design" -- better framing that it'll be a survey of examples and their rationales rather than an analysis of invariants.
- hansvm 2y agoIt's just the inductive reasoning version of the essay rather than the deductive version. A lot of software exposition fails on that front. If you're familiar with invariants as a crucial tool for reasoning about software systems, then the essay will be a bit fluffy. It looks decent for a newcomer to the topic to rapidly build up intuition though.