Parts of a version-numberA version number should consist of a group of 3 numbers separated by a dot. The first number is called major, the second minor and the third one patch. After that a small text called meta-data can be appended to the version-number, but this is not discussed here.
Rules for incrementationWhen you create a new version of a new component, you should follow these rules.
- Major is incremented when you make API changes incompatible to the current version
- Minor is incremented when you add functionality that is backwards compatible
- Patch is incremented when you fix a bug and the API is not affected
Adding functionality means adding (new) non-private functions or overloading existing ones. If the parameter-list of an existing non-private function is changed, it is an API-change.
Fixing a bug means only changing code of a non-private function for correcting errors, but without changing expected behaviour.
General rulesIf you need a version number for a component you should obey these general rules.
- Every release gets a new version-number
- Patch is reset to 0, if Minor is incremented
- Minor and Patch are reset to 0, if Major is incremented
- Meta-data may be appended after Patch
Advantages of using semantic versioningIf you are using a component supporting semantic versioning, you can safely upgrade to a version with the same major, but higher minor or patch level.
If you want to use a library with a higher major, then you know that it might be incompatible with your code.