Basic

Why versions exist

A program is not one thing, it is a thing at a moment. Someone's saved file, the API you shipped last month, the build on the server in March, all point at a version that is not the one in front of you now. Versions are the names for those moments, and without them the question 'which one produced this?' has no answer.

What you will see

The thing that must not be shipped: 'latest' means different things on different days.

About 1 min of reading

Try It

Name the moment.

1

The artifact

print('app-2.4.1')

Before you run it, say out loud what it will print. Then open the answer.

What it prints
A name with a version in it, which is what a complaint can be traced to.
2

The moving name

print('app-latest')

Before you run it, say out loud what it will print. Then open the answer.

What it prints
The thing that must not be shipped: 'latest' means different things on different days.

Data Flow

A moment becomes a name.
1 Something shipped
↓
2 It carries a version
↓
3 A report names that version
↓
4 The right build is reachable
Line by line

Read the first example one line at a time. A line that prints shows what appears on screen; the rest set things up quietly.

print('app-2.4.1') A name with a version in it, which is what a complaint can be traced to.
Why this works
Put it in the artifact

The version has to be in the thing you ship: the file, the log line, the response header, the footer of the report. A version that lives only in your head is not a version.

Start at zero

A project with no versions yet starts at 0.1.0 or 1.0.0 and says which. The first release is the one that sets the convention, and it should be a deliberate choice, not an accident.

Examples

The bug report needs one

'It crashes on save' means nothing until you know the version that crashed. A version number in the report turns a complaint into a reproducible thing, and that is the first reason versions exist.

Semver is a promise

Major.minor.patch says what changes to expect: patch is fixes, minor adds backwards compatibility, major may break it. That promise is what lets a dependency range be written at all.

A name is not a version

'Latest' is a moving name. Two people asking for latest in the same week can get different things, which is why a build pins an exact number and never a moving name.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

Next Lesson
Semantic version numbers
Semantic version numbers →