News for hackers. Stuff that matters.
Re:Fix the versioning by jashkenas on Friday August 29, 2014 @07:05PM (#8244932)
If the asshole responsible for this mess can chime in for a moment ;)

I figured that it was worth a bit of a longer explanation (cross-posted from https://gist.github.com/jashkenas/cbd2b088e20279ae2c8e)

---

Spurred by this thread, here's is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that will be affected by the change, the severity of the change (Is it easy to fix my code? Or do I have to rewrite everything?) — into a single number. And unsurprisingly, it's impossible for that single number to contain enough meaningful information.

If your package has a minor change in behavior that will "break" for 1% of your users, is that a breaking change? Does that change if the number of affected users is 10%? or 20? How about if instead, it's only a small number of users that will have to change their code, but the change for them will be difficult? — a common event with deprecated unpopular features. Semantic versioning treats all of these scenarios in the same way, even though in a perfect world the consumers of your codebase should be reacting to them in quite different ways.

Ultimately, breaking changes are no fun, and we should strive to avoid them when possible. To the extent that SemVer encourages us to avoid changing our public API, it's all for the better. But to the extent that SemVer encourages us to pretend like minor changes in behavior aren't happening all the time; and that it's safe to blindly update packages — it needs to be re-evaluated.

Some pieces of software are like icebergs: a small surface area that's visible, and a mountain of private code hidden beneath. For those types of packages, something like SemVer can be helpful. But much of the code on the web, and in repositories like npm, isn't code like that at all — there's a lot of surface area, and minor changes happen frequently.

Ultimately, SemVer is a false promise that appeals to many developers — the promise of pain-free, don't-have-to-think-about-it, updates to dependencies. But it simply isn't true. Node doesn't follow SemVer, Rails doesn't do it, Python doesn't do it, Ruby doesn't do it, jQuery doesn't (really) do it, even npm doesn't follow SemVer. There's a distinction that can be drawn here between large packages and tiny ones — but that only goes to show how inappropriate it is for a single number to "define" the compatibility of any large body of code. If you've ever had trouble reconciling your npm dependencies, then you know that it's a false promise. If you've ever depended on a package that attempted to do SemVer, you've missed out on getting updates that probably would have been lovely to get, because of a minor change in behavior that almost certainly wouldn't have affected you.

If at this point you're hopping on one foot and saying — wait a minute, Node is 0.x.x — SemVer allows pre-1.0 packages to change anything at any time! You're right! And you're also missing the forest for the trees! Keeping a system that's in heavy production use at pre-1.0 levels for many years is effectively the same thing as not using SemVer in the first place.

The responsible way to upgrade isn't to blindly pull in dependencies and assume that all is well just because a version number says so — the responsible way is to set aside five or ten minutes, every once in a while, to go through and update your dependencies, and make any minor changes that need to be made at that time. If an important security fix happens in a version that also contains a breaking change for your app — you still need to adjust your app to get the fix, right?

SemVer is woefully inadequate as a scheme that determines compatibility between two pieces of code — even a textual changelog is better. Perhaps a better automated compatibility scheme is possible. One based on matching type signatures against a public API, or comparing the runs of a project's public test suite — imagine a package manager that ran the test suite of the version you're currently using against the code of the version you'd like to upgrade to, and told you exactly what wasn't going to work. But SemVer isn't that. SemVer is pretty close to the most reductive compatibility check you would be able to dream up if you tried.

If you pretend like SemVer is going to save you from ever having to deal with a breaking change — you're going to be disappointed. It's better to keep version numbers that reflect the real state and progress of a project, use descriptive changelogs to mark and annotate changes in behavior as they occur, avoid creating breaking changes in the first place whenever possible, and responsibly update your dependencies instead of blindly doing so.

Basically, Romantic Versioning, not Semantic Versioning.

All that said, okay, okay, fine — Underscore 1.7.0 can be Underscore 2.0.0. Uncle.

(typed in haste, excuse any grammar-os, will correct later)

Re:Fix the versioning by thaumaturgy on Friday August 29, 2014 @07:19PM (#8244977)
> For most of software history, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was a small patch. You could evaluate a given piece of software by name, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

> But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to make a mechanistic understanding of a codebase more important than a human one. Any "breaking" change to the software must be accompanied with a new major version number.

I'm about 80% sure you're mistaken on this. I don't have a spec document or an example to back me up, but I've been slinging code for almost 30 years now, and cut my professional teeth on a big Unisys mainframe. Before version numbering in software became totally subjective, they were used to indicate break/change/patch, as described in semver.org.

It was later on that software projects started to move away from that, mostly shareware and desktop software in the 90s, and only recently that projects like Firefox entirely lost the plot.

The reason that "semver" used to be so popular, as you note, is because it made enterprise IT manageable. Developers don't think about that much anymore though; they just expect big IT departments to roll out nightly updates and then deal with the fallout the next day.

(I'm not piling on or picking a fight, I don't use Underscore, I don't have a horse in this race. I'd welcome cited corrections or opinions from even older developers.)

Re:Fix the versioning by mbrubeck on Friday August 29, 2014 @07:31PM (#8245005)
Every date-based Firefox update breaks compatibility with binary add-ons (ones that link to the libxul.so C++ library). According to both SevMer and traditional library versioning practices, incrementing the major version is the correct thing to do in this case. I'm not sure why you say it has "lost the plot."

Application software has generally used version numbers in different ways from library software. It's tricky for products like Firefox that are both application and library.

Re:Fix the versioning by thaumaturgy on Friday August 29, 2014 @07:53PM (#8245062)
I must be missing something.

I was under the impression that Mozilla was incrementing Firefox's major version number with every new release, even if new releases didn't have api changes. As described in http://jonoscript.wordpress.com/2011/07/18/its-not-about-the... for example.

Is that not the case? Is there actually some part of Firefox that other software relies on that's getting changed in not-backwards-compatible ways with every release?

Re:Fix the versioning by mbrubeck on Friday August 29, 2014 @08:02PM (#8245081)
For normal extensions that use supported JavaScript APIs, most releases will not break any APIs. The blog post you linked to is talking about the compatibility process for these normal JS extensions.

But there is a special class of extensions ("binary add-ons") that link to Firefox/libxul as a C++ library. This has been discouraged for a long time now, but still supported for legacy reasons. These extensions have full access to Firefox's internal C++ and XPCOM interfaces. Since Firefox 4, the ABI of this internal library changes with every major update, so every release is breaking for binary add-ons (except security patches, which take care not to change the ABI, and also do not increment the major version). This is mentioned briefly in the comments of the blog post you linked to.

Since that blog post was written, Firefox's add-on system has changed to address this dichotomy. Non-binary add-ons new use "lax" version checking by default (a minimum Firefox version is checked, but no maximum), while binary add-ons still use "strict" versioning. This is documented here:

https://developer.mozilla.org/en-US/docs/Mozilla/Developer_g...

https://developer.mozilla.org/en-US/Add-ons/Install_Manifest...

[disclosure: I'm an developer at Mozilla.]

Re:Fix the versioning by thaumaturgy on Friday August 29, 2014 @08:30PM (#8245152)
Thanks for the explanation. It cleared up some misconceptions. I'll bookmark this for future reference.
Re:Fix the versioning by Alupis on Friday August 29, 2014 @08:17PM (#8245121)
I sort-of think it's this guys library -- so he can change the major version number whenever he wants. Heck -- the Kernel project (now) just changes versions whenever they "feel it's right", and nobody complains... API changes or not.
Re:Fix the versioning by thaumaturgy on Friday August 29, 2014 @08:33PM (#8245157)
Yep. I wasn't arguing for or against one religion of version numbering or another, just trying to clear up some of the history of it.

I wouldn't offer my opinion on version numbering anyway, since my opinion isn't worth anything. It's definitely not in my own interest to argue for sane version numbering schemes; clients pay me hourly rates to fix issues with the software they use.

Re:Fix the versioning by akira2501 on Friday August 29, 2014 @07:36PM (#8245030)
I think the big problem with semver is point 2 in their summary: "MINOR version when you add functionality in a backwards-compatible manner"

That may make sense for very large software projects or operating systems where backwards compatibility is a huge concern, but it's not a good fit for the majority of software projects. This is especially true when these projects aren't compiled and thus don't even have an ABI to worry about.

This view on versioning I think comes from a time when most software was compiled and when compiling that software would take a _long_ time or require downtime; thus protecting ABI compatibility was worth the effort.

For modern projects that are in an interpreted language, I think constraining the middle version number to "non-breaking" changes is silly as it's copying a concern that no longer applies. It forces you to choose between "bug-fix" and "feature" releases and pace your project development in a rigid fashion that may not make much sense.

Also, I think it's ridiculous to require anything other than big-fix releases to be non-breaking in the first place. If 1.6.x worked for you, why are you even trying to use 1.7.x if not to access new features? If that's the case, you're going to be editing your code again anyways.

Worrying about a release manager automatically pulling a 1.7 codebase to upgrade a 1.6 codebase is silly; why is the package manager doing this in the first place?

Re:Fix the versioning by goldfeld on Friday August 29, 2014 @07:54PM (#8245067)
Having both MINOR and PATCH to mean non-breaking changes really seems excessive and based on very large waterfall-based software projects, because for most open source development it's completely arbitrary whether to bump patch or minor. I think it would be far more useful to have both MAJOR and MINOR to signify breaking changes (with MAJOR being close to the romantic versioning that Jeremy alludes to, where the software effectively enters a new phase.) And a number like 1.7.247 is more intelligible than 170.2.5, and really, if you're the rare monolithic long release-cycle software project, just use an extra number after PATCH. It's not like there'd be an acute concern over the verboseness of that version number internally compared to all the other highly bureaucratic processes going on in the organization.
Re:Fix the versioning by dllthomas on Friday August 29, 2014 @08:40PM (#8245179)
I interpret PATCH as "no change in the intended semantics, just a bug fix". Occasionally that's still ambiguous, when the bug was in the intended semantics, but I'm not sure that's a big problem. When adding new functionality, I prefer to see MINOR bumped, even if small.

Just one opinion, of course.

Re:Fix the versioning by dllthomas on Friday August 29, 2014 @08:37PM (#8245169)
What are your thoughts on splitting the SemVer "major" version number into two parts? Calling a change that will not break any code "major" seems... unlikely (though I guess I could be wrong about that?). If that's the case, then from W.X.Y.Z, "breaking change but won't effect too much, easy enough to update" bumps X, "entirely rethought the model, updating will be a pain" bumps W, "won't even break your code but we added some stuff" bumps Y, and "non-breaking bugfix" bumps Z (and I think "bugfix, but might break some stuff" probably bumps X). That should provide space enough to communicate both the mechanistic and a meaningful summary of the humanistic (with change logs for more detail, as ever).
Re:Fix the versioning by munificent on Friday August 29, 2014 @07:25PM (#8244989)
I appreciate your thoughts as always. I'm sure this is frustrating for you because you have a bunch of users yelling at you to do something in a way you don't agree with, and it's not like they pay you for the right to do that.

A couple comments:

> Node doesn't follow SemVer, Rails doesn't do it, Python doesn't do it, Ruby doesn't do it, jQuery doesn't (really) do it

Node does (because it's <1.0.0 where semver's rules are different). Everything else you list is older than semver, so short of a time machine or a radical change to their long-established versioning policies, there's not much they can do.

> the responsible way is to set aside five or ten minutes, every once in a while, to go through and update your dependencies, and make any minor changes that need to be made at that time.

That works fine for your immediate dependencies. The reason why I think things like semver are important is that the above doesn't work at all with transitive dependencies.

If my app uses foo which uses bar which uses baz and the maintainers of baz decide to make a breaking change in a minor version, I'm not in a happy place when that wolf in sheep's clothing appears in my dependency graph. I'll see that my app is broken, but unless I want to fork bar and maybe foo and start mucking around in code I've never touched before, my options are pretty limited.

I don't think semver is perfect, but I find it does make transitive and shared dependencies a lot more reliable to work with. I'm willing to sacrifice human-meaningful version numbers to get that.

Re:Fix the versioning by krebby on Friday August 29, 2014 @07:35PM (#8245025)
> Node does (because it's <1.0.0 where semver's rules are different)

You might've missed the paragraph preëmptively responding to that (it was added in an edit).

SemVer says that you shouldn't be pre-1.0.0 if you're actively used in production anywhere. Node has been out for years. Treating the current versions of Node as pre-1.0.0 is a joke.

From the semver.org FAQ:

> How do I know when to release 1.0.0?

> If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you're worrying a lot about backwards compatibility, you should probably already be 1.0.0.

Node definitely applies.

Re:Fix the versioning by sturadnidge on Saturday August 30, 2014 @07:09AM (#8246143)
There is no way an author / project can control when someone is going to use their software 'in production', I would certainly argue that condition is the weakest of indicators as to whether something is 1.0.0 or not.

Aside from that, the other 2 indicators definitely do not apply to Node (API is not stable, there is not a lot of worry about backwards compatibility as you'll see in the upcoming 0.12 release).

So no, Node is not '1.0.0' according to SemVer.

Re:Fix the versioning by jashkenas on Friday August 29, 2014 @09:19PM (#8245244)
Part of what I'm saying is that your transitive dependencies shouldn't be changing willy-nilly in the first place. The code you depend on is ultimate code you're responsible for — and having changes happening deep down that you're not aware of is a recipe for trouble.

Immediate dependencies are a relative thing, after all — foo's deep dependency is bar's immediate dependency. And if SemVer'ing them only works some of the time, but won't save you all of the time, then why bother pretending in the first place?

The actual appearance of breaking changes in software that end up affecting you occurs at the same interval regardless of the version number we decide to label them with. We can do better for determining compatibility than a three or four character version number.

Re:Fix the versioning by abritishguy on Friday August 29, 2014 @07:13PM (#8244960)
I can accept everything you have written here - my feelings towards semver are very similar to your own. I feel in this instance what transpired was a deviation from what you have written - I went to start a new project and 2 of the dependencies I installed (out of 10) had problems, this release changed a lot of stuff that affected many of the dependent modules.

>If the asshole responsible...

If anyone was the asshole it was me, however I truly believe that underscore is better off and I would like to thank you for all the work you have put into it. :)

Re:Fix the versioning by nevir on Friday August 29, 2014 @11:34PM (#8245551)
There is great benefit to being able to bump your dependencies in a consistent manner. Specifically:

* We want to be able to easily pick up non-breaking bug/security fixes that should not cause us to change code.

* We want to be able to pick up newer features, and are ok to make changes to our own in response.

In both cases, we need to be confident about which sort of upgrade we are getting.

Semver gives that; it's just unfortunate that it doesn't map to the human notion of what a major version is.

Re:Fix the versioning by tylerlh on Friday August 29, 2014 @07:12PM (#8244957)
Jeremy, you make some great points here and I agree with you on most of them -- it's just that Underscore doesn't seem like the right place to start the battle.
Re:Fix the versioning by goldfeld on Friday August 29, 2014 @07:21PM (#8244979)
Why is it not the right place? Why do people even have to update underscore--just keep with the older version. They also have a mostly drop-in replacement in lodash (well, last I've seen, at least). So I think it's a perfectly good place, it's not a library of "shiny new features", rather a staple that most people probably don't need to update, and even has an alternative.

And you don't fight battles without a deal of incoveniencing. The mere fact of the publicity this is generating makes it a fair ground to fight that battle. Which is to say I can see his position, despite liking semver myself--though it could be distilled into a better standard and that could be a net positive long term on software development that far offsets the man-hours now being lost.

Re:Fix the versioning by tylerlh on Friday August 29, 2014 @07:34PM (#8245016)
You know what they say...opinions are like assholes...