Monday, November 07, 2011

Semantic Versioning (

Semantic Versioning

"In the world of software management there exists a dread place called "dependency hell." The bigger your system grows and the more packages you integrate into your software, the more likely you are to find yourself, one day, in this pit of despair.

In systems with many dependencies, releasing new package versions can quickly become a nightmare. If the dependency specifications are too tight, you are in danger of version lock (the inability to upgrade a package without having to release new versions of every dependent package). If dependencies are specified too loosely, you will inevitably be bitten by version promiscuity (assuming compatibility with more future versions than is reasonable). Dependency hell is where you are when version lock and/or version promiscuity prevent you from easily and safely moving your project forward.

As a solution to this problem, I propose a simple set of rules and requirements that dictate how version numbers are assigned and incremented. For this system to work, you first need to declare a public API. This may consist of documentation or be enforced by the code itself. Regardless, it is important that this API be clear and precise. Once you identify your public API, you communicate changes to it with specific increments to your version number. Consider a version format of X.Y.Z (Major.Minor.Patch). Bug fixes not affecting the API increment the patch version, backwards compatible API additions/changes increment the minor version, and backwards incompatible API changes increment the major version.

I call this system "Semantic Versioning." Under this scheme, version numbers and the way they change convey meaning about the underlying code and what has been modified from one version to the next.


I've been hearing about Semantic Versioning recently, but didn't know there was a page/url/site dedicated to it until today... sigh... I need a faster Brain-World interface. When is BWv2 coming out? :P

Also the fact this page is hosted/managed/version controlled on Github is cool too, (which given the author, I guess that makes sense... ;)

1 comment:

dotnetchris said...

I love SemVer, the only thing I've noticed to use SemVer in a commercial product you need to add a 4th range. ProductCycle.MajorVersion.MinorVersion.Patch.

Having to go from major 1, to major 2 just because you renamed a public property is quite hard to deal with licensing implications if you don't have a perpetual license scheme.