Semantic Versioning

Photo by Jess Bailey on Unsplash

Semantic Versioning

·

4 min read

Let’s say I was late for the party. Sometime last week, I took the npm course on FCC. Don’t get me wrong, I’ve built APIs for fun and used the node package manager, but never really explored npm and all it’s about. I’d summarize by saying the npm course on FCC opened my eyes to what software versioning is.

Moving forward, I took the course and had an Aha moment. I’ve always underestimated those numbers- I thought they were just random numbers developers gave for their software(s), and then I tweeted about it only to discover that I wasn’t the only one late to the party and that’s the reason for this blog.

We’re going to go over the basics of software versioning together kicking off with what it is, its types and how those numbers come about.

What is Software versioning:

According to Wikipedia, “Software versioning is the process of assigning either unique version names or unique version numbers to unique states of computer software”. All that plenty of grammar simply means these numbers communicate to users the state of the/application.

Software version numbers indicate changes in a software product. As developers update and improve products, there are often several versions of the product available for end users.

Types of software versioning

There are several types of software versioning which include:

  • Semantic numbering

  • Date of release

  • Unary numbering

  • Alphanumeric codes

However, our focus is going to be on semantic numbering or versioning(SemVer) as it’s the most popular and vastly used across developers and makers of a product. Semver is a popular versioning scheme that is used by a vast amount of open-source projects to communicate the changes included in a version.

This begs the question of what Semver is.

What is SemVer?

Semver is a standardized way to give meaning to your software releases. It’s a way for software authors to communicate concisely to consumers of the software key information they should know about each release.

Semver is made up of just three numbers or components separated by a period sign(.). For example, the current version of preset-sails is 1.0.1.” With this number, I can easily tell all the compatibility information I need and can make decisions on whether or not to upgrade to the latest version and how much work that may take to do that.

Each number has its significance and represents something. Reading from left to right, the number represents:

  • Major release

  • Minor release and

  • Patch release

A what do you mean meme

If you’re wondering what these terms are, don’t worry I got you. Stay with me!

Patch release:

A Patch release is used to signify that the code changes have not added any new features and are backward compatible. It is most typically used to signify a bug fix.

What does backward compatibility mean? I also didn’t know what it was until I made further research on it.

Backward compatibility simply means that the flow of usage is not different from previous versions. You can read more about it and even more technically here

From the example cited above, if a patch release was made, the version number changes from 1.0.1 to 1.0.2.

Minor release:

A Minor release is used to signify that functionality has been added to the codebase, but it remains backward compatible.

Keeping with the preset-sails example, if a new function is added to an existing function then the version would be 1.1.0.

Major release:

When you make changes to the codebase and the application is no longer backward compatible, then you have made “breaking” changes.

A major release consists of major new features and/or large architectural changes which can mean a feature was either removed or functionality changed. Some existing features may be deprecated causing the flow of users to change as well.

From the same example, it will be 2.0.0 no longer 1.1.0 or 1.0.1

Something to take note of: when a number is increased, all numbers to the right start back at zero.”

Importance of Software Versioning

It is important to understand how software versioning works as it helps both users and software providers track different versions that the company releases.

It also helps to track the progress of each update and keeps every team member working on the right version.

Here’s a pictorial representation:

A pictorial example of the different components of semantic versioning

It’s worth noting that some additional labels like ‘alpha’ or ‘beta’ can be added at the end of the version number to indicate the status of the release.

Semver is a powerful tool; With three numbers, authors can communicate very important information to the consumers of their software.

Conclusion

I hope you were able to learn about the different types of software versioning and the most popular ones used by software authors today. If you’d want to go down the rabbit hole of semantic versioning, I’d recommend you check out this documentation on semVer semver.org.

Let me know what you think about this blog, and share it with friends!

Alrightie! see you in the next blog.

Ciao!