Programming principles

# Programming first principles - 8. First principle - Proof that code works

Video version of this article: https://youtu.be/k8Swf3apDVg

This article is part of the "Programming first principles series":

- Purpose - What this series is about
- Audience - Who this series is for
- Requirements of software
- Premise - Minimal information
- Premise - We must understand what we're doing
- Premise - Minimize propagating changes throughout the system
- Premise - Complexity increases exponentially with scale
- First principle - Proof that code works (this article)
- First principle - Principle of least astonishment
- First principle - Principle of least knowledge
- First principle - Separation of concerns
- First principle - Abstraction
- Side effects

Also suggested:

We require proof that code works.

## Why we need proof that code works

It follows from our basic requirement that what we produce must work:

- Without proof that the system works, we do not know whether it works or not.
- If we do not know whether it works, it means it may not work.
- If it does not work, we have failed the requirement that the system must work.
- On the other hand, if we have proof that the system works then we know that it works and we have fulfilled our requirement.

Therefore we require proof that the system works.

## Requirements for our proof

Our proof must:

- Be reproducible on demand, because we need it for every single change we make, because we must know the system works at all times.
- Must be as effective as possible.

## Suggested proof

Currently the only thing I know of is a good test suite.

This article is part of the "Programming first principles series":

- Purpose - What this series is about
- Audience - Who this series is for
- Requirements of software
- Premise - Minimal information
- Premise - We must understand what we're doing
- Premise - Minimize propagating changes throughout the system
- Premise - Complexity increases exponentially with scale
- First principle - Proof that code works (this article)
- First principle - Principle of least astonishment
- First principle - Principle of least knowledge
- First principle - Separation of concerns
- First principle - Abstraction
- Side effects

Also suggested: