Semantic Versioning

Learn about semantic versioning in the Ruby language.

Details of version number

We have probably already noticed that three numbers represent the Ruby version… For instance, Ruby 2.3.3, Ruby 2.5.1, etc. So, why do we need three numbers instead of just one?

The answer isSemantic Versioning (or SemVer). To summarize, consider the following.

The three numbers are the major, minor, and patch numbers. Given the version number major.minor.patch, we must increment the:

  • MAJOR version when we make incompatible API changes,
  • MINOR version when we add functionality in a backward-compatible manner, and
  • PATCH version when we make backward-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the major.minor.patch format.

For Ruby 2.3.1, the major is 2, the minor is 3, and the patch is 1. Let’s look closer into this concept because it is essential.

The software development process includes the following:

  • Fixing bugs where the patch version increases
  • Adding features and improvements, where the minor version is increases
  • Introducing breaking changes, where the major version increases

Problems in having different versions

While we fix bugs, the program logic mostly stays the same. Two versions may differ, but only slightly. Two versions of Ruby may have one or more bug fixes. We could easily replace one version with another, and have everything work the same way. Developers increase patch numbers because they emphasize that the new version is better; it has more fixes.

When we improve the functionality or introduce new features to the latest versions of Ruby, the older versions are not updated. What does this mean for Ruby?

Get hands-on with 1400+ tech skills courses.