News for hackers. Stuff that matters.
Re:Is Semantic Versioning an Anti-Pattern? by taeric on Wednesday January 11, 2017 @08:36PM (#13379175)
My biggest beef with semver is that it is pushed by people encouraging this concept that additions are always safe. Or the lie that people will do security and other updates on older versions.

By and large, especially in an org, if you make a change that requires another place to change, you should go ahead and make that change. Period. Thinking people can stay on the old version till they want to update is BS. They will update when they have to. And it is rarely easy, then.

Re:Is Semantic Versioning an Anti-Pattern? by thaumaturgy on Wednesday January 11, 2017 @09:02PM (#13379289)
It used to work that way, though; software in the 90s and early 2000s did have sane semantic versioning, updates were backported to earlier major versions, and revision updates generally didn't break anything in production.

I bet semantic versioning is mostly championed by older veterans who have worked in maintenance or systems administration roles and are trying to get the industry to return to a versioning system that made sense once upon a time.

For my part ... while I'd dearly love to see semantic versioning come back, along with a few other good habits from a long time ago, I've given up on that and now just accept that updates will break things sometimes and there's always something to update and so something will be broken most of the time and that's just how it is so charge accordingly.

Re:Is Semantic Versioning an Anti-Pattern? by flomo on Thursday January 12, 2017 @01:28AM (#13380209)
I half-agree with you, because at some point, software versioning and the notion of stable apis went all post-modern (especially with open source).

But we used to pay software vendors a lot of money to care about boring things like backwards-compatibility, legacy support, and etc. Semantic versioning as a standard is a way of applying social pressure to authors to do the 'dirty work', regardless of whether they are being paid to do so. And if they don't feel like it, the result is usually "too bad for you". There's no real good answer for this that I can think of. Nobody wants to pay for leftpad.js Enterprise Edititon.

Re:Is Semantic Versioning an Anti-Pattern? by taeric on Wednesday January 11, 2017 @09:37PM (#13379431)
I think there used to just be less things versioned. Conway's law is probably hiding here. If there is an org to maintain it, it will be maintained. If you have more things to maintain than you do org structures, something is not getting maintenance.
Re:Is Semantic Versioning an Anti-Pattern? by eeZah7Ux on Thursday January 12, 2017 @06:42AM (#13381501)
A lot of people are still doing that, including Linux distributions. Keeping earlier major versions alive and backporting security fixes is very useful.
Re:Is Semantic Versioning an Anti-Pattern? by Sean1708 on Thursday January 12, 2017 @09:20AM (#13382349)
I'm not sure I understand your argument. If someone's not going to backport a v2.1 fix to v1.6, why would they backport a v20170106-1009 fix to v201610-1005?
Re:Is Semantic Versioning an Anti-Pattern? by taeric on Thursday January 12, 2017 @11:38AM (#13383645)
I'm not sure what you are saying. My argument is that it is a myth that most things will get only security updates.

That is, the version scheme States the point is to somehow be in a position to get only security updates. However, unless there is an org specifically for maintaining a library, your only hope of getting updates is to take all updates. So, to stay on the latest.

Re:Is Semantic Versioning an Anti-Pattern? by Sean1708 on Friday January 13, 2017 @11:36AM (#13392176)
I think I must have got myself confused at some point, disregard my previous comment.
Re:Is Semantic Versioning an Anti-Pattern? by viraptor on Wednesday January 11, 2017 @11:10PM (#13379774)
Have you got an example where pure addition breaks the existing compatibility?

> the lie that people will do security and other updates on older versions.

Semver does not say anything will be supported. You still have to know what's going on with your dependencies as far as big releases and patches go. It simply says that is old versions are still supported, they're updates will preserve compatibility.

Re:Is Semantic Versioning an Anti-Pattern? by fenomas on Thursday January 12, 2017 @12:17AM (#13379980)
> Have you got an example where pure addition breaks the existing compatibility?

Surely they're mutually exclusive terms. I think GP was talking about cases where the developer releases a change thinking it's just an addition, but it actually breaks compatibility.

Of course, that boils down to saying that software updates sometimes have bugs. What that has to do with semver, I have no idea.

Re:Is Semantic Versioning an Anti-Pattern? by taeric on Friday January 13, 2017 @12:51AM (#13388727)
Sorry for the very late response. I should have written it as "additions are safe." I am more reflecting on additions being more liability (commonly called "tech debt") that you have.

I think others covered the edge cases where additions literally break. The sibling that said I was likely referring to just plain bugs hits it pretty well, I think. I was not going for esoteric scenarios.

And yes, semver doesn't say anything about if a version is supported. However, it is a strong indication that it is. In a social expectations sort of way. If you don't plan on supporting old versions of what you are doing... use a new name for the new stuff. Nobody expects google guava to support apache commons, even though they are doing a lot of the same things. We do expect, however, that apache commons will make sure any bugs in old versions are dealt with.

Re:Is Semantic Versioning an Anti-Pattern? by flukus on Wednesday January 11, 2017 @11:37PM (#13379863)
> Have you got an example where pure addition breaks the existing compatibility?

With c/c++ additions can break binary compatibility can't they? Adding a field to a struct for instance will mean existing code that does a malloc for that struct won't allocate coorectly. I think there are a million other cases to consider too.

Re:Is Semantic Versioning an Anti-Pattern? by viraptor on Thursday January 12, 2017 @12:09AM (#13379951)
Normally in a library you'd provide functions that allocate and free structures defined by that library. That's how successful C libraries do it.

I think semver covers this pretty well actually. The public API is not just the function signatures, but basically anything that makes your API - whether it's code or documentation. So either:

- your structs in the library are opaque and the library handles all the memory management itself - addition of fields is backwards compatible, or

- your structs are open and your functions expect the structs from outside - addition of fields is not backwards compatible

The second one is still falls under "Major version X (X.y.z | X > 0) MUST be incremented if any backwards incompatible changes are introduced to the public API."

To make a comparison in a dynamic language: you've got public function `f(d)` where `d` is some dictionary with elements `a` and `b`. Now in the next version you start to require `c` - same signature in the code, but it's not backwards compatible. It's still a public API, even if defined by the documentation.

Re:Is Semantic Versioning an Anti-Pattern? by caf on Thursday January 12, 2017 @12:22AM (#13380000)
your structs are open and your functions expect the structs from outside - addition of fields is not backwards compatible

Sometimes it's possible to handle this case (if you've planned ahead) by including unused space within the original struct defintion that you can then repurpose later.

Re:Is Semantic Versioning an Anti-Pattern? by flukus on Thursday January 12, 2017 @12:15AM (#13379972)
> That's how successful C libraries do it.

What about c++? Object allocation is always handled by new on the consumer side isn't it? Also in C, does the order of function declarations matter?

Re:Is Semantic Versioning an Anti-Pattern? by viraptor on Thursday January 12, 2017 @12:25AM (#13380005)
I don't do C++ normally, but the situation seems similar. There's http://wiki.c2.com/?PimplIdiom for opaque objects, so you don't have to make their members part of the public API. But for things you do want to make public it's the same solution - make it a your public API by documenting it. If you know it breaks compatibility, it requires major version bump.

And no, after compilation, I don't believe the symbol order matters.

Re:Is Semantic Versioning an Anti-Pattern? by flukus on Thursday January 12, 2017 @01:26AM (#13380204)
The pimpl method looks like it ads a level of indirection to every private member access. Is that an issue in practice?
Re:Is Semantic Versioning an Anti-Pattern? by slavik81 on Thursday January 12, 2017 @01:48AM (#13380287)
Qt uses it extensively. For big, complex objects like QTextEdit it's probably the least of your concerns, but they do avoid it for simple value types like QPoint.
Re:Is Semantic Versioning an Anti-Pattern? by flukus on Thursday January 12, 2017 @02:08AM (#13380387)
A good chunk of these questions I'm asking are because I half remember Qt's binary compatibility guidelines from when I did an internship at Trolltech many years ago :) A similar list is here: https://community.kde.org/Policies/Binary_Compatibility_Issu... . It looks like the virtual function restrictions are what I was talking about, that's where pure additions can break compatibility.
Re:Is Semantic Versioning an Anti-Pattern? by slavik81 on Thursday January 12, 2017 @03:56AM (#13380838)
If you worked at Trolltech, you almost certainly know more than me. I was just a user of Qt who peeked under the covers occasionally.
Re:Is Semantic Versioning an Anti-Pattern? by jstimpfle on Thursday January 12, 2017 @06:35AM (#13381465)
It's an issue if the methods on that object are short-lived enough that the overhead of indirection is significant.

It's also an issue if very performance-sensitive routines need to read data from the object. In which case they already know exactly what's in there, so "pimpl" hiding has no benefit in the first place.

Implementations should be hidden if they are likely to change. In other words, there are are non-obvious data or method members and/or it's likely that functionality will be added in the future. These are the high-level architectural situations, not the leaf level ones where you optimize out every cyle possible.

Re:Is Semantic Versioning an Anti-Pattern? by netheril96 on Friday January 13, 2017 @04:36AM (#13389597)
> Adding a field to a struct for instance will mean existing code that does a malloc for that struct won't allocate coorectly.

Really? Do you ever call `malloc(4)` instead of `malloc(sizeof(int))` or `malloc(sizeof(*ptr))`?

Re:Is Semantic Versioning an Anti-Pattern? by fjdlwlv on Thursday January 12, 2017 @12:10AM (#13379955)
C/C++ is hopeless for binary compatibility, under any version scheme
Re:Is Semantic Versioning an Anti-Pattern? by wahern on Thursday January 12, 2017 @02:52AM (#13380564)
Linux's support for ELF symbol versioning makes maintaining binary compatibility of C libraries easier than perhaps any other platform or language. It's patterned after Solaris' ELF symbol versioning, but more powerful.

glibc uses it extensively, but alas few other people know about it. Theoretically languages, like Rust, which compile to ELF executables could leverage the capability. But none do.

There are a series of posts from a libvirt developer which explain some of the mechanics:

  https://www.berrange.com/posts/2011/01/13/versioning-in-the-libvirt-library/
I personally don't bother with semantic versioning at all. Where ABI compatibility matters, I'll commit to maintaining backward ABI compatibility in perpetuity using symbol versioning.[1] And maintaining backwards API compatibility is something I try to commit to as a matter of course; if I can't then I make sure builds will break loudly.

I don't begrudge people using semantic versioning, I don't just don't think it's the best approach for most cases. It's just one of several crappy choices. But at least with C on Linux, ELF symbol versioning is a slam dunk when you're serious about the matter.

[1] I usually avoid depending on proprietary platform features. But this is the one area I'm comfortable and eager to lean on Linux.

Re:Is Semantic Versioning an Anti-Pattern? by slavik81 on Thursday January 12, 2017 @01:56AM (#13380330)
Qt is C++ and only breaks binary compatability on major version changes (~6 years apart).

It's hard, but certainly not hopeless.

Re:Is Semantic Versioning an Anti-Pattern? by viraptor on Wednesday January 11, 2017 @11:45PM (#13379879)
I don't think so. Have you got an example?
Re:Is Semantic Versioning an Anti-Pattern? by flukus on Wednesday January 11, 2017 @11:46PM (#13379885)
Just updated with one.
Re:Is Semantic Versioning an Anti-Pattern? by fjdlwlv on Wednesday January 11, 2017 @11:29PM (#13379839)
Your biggest beef with semver is that that some people don't follow the semver spec
Re:Is Semantic Versioning an Anti-Pattern? by flukus on Wednesday January 11, 2017 @08:43PM (#13379216)
I agree, SemVersion is a technical solution for what is often a human/corporate problem.

A good solution to this is to have an "edge" build that will upgrade dependencies and let you know about breakages early, but that still requires companies to acknowledge that all software needs maintaining.

Re:Is Semantic Versioning an Anti-Pattern? by azernik on Wednesday January 11, 2017 @10:12PM (#13379568)
It's more of a technical tool for implementing a certain human/corporate behavior. If your organization is actually following a versioned process, then semver-aware tools are really handy; if you're note, then those tools are at best irrelevant and at worst just get in your way.
Re:Is Semantic Versioning an Anti-Pattern? by taeric on Wednesday January 11, 2017 @09:38PM (#13379436)
The lure of technical solutions is huge. I keep calling for them, at least.
Re:Is Semantic Versioning an Anti-Pattern? by justicezyx on Thursday January 12, 2017 @01:10AM (#13380150)
IIRC, Amazon deprecates old versions after some time period. That solves the "no one wants to update" problem. It also shows clearly that when a major version will not be maintained regularly.
Re:Is Semantic Versioning an Anti-Pattern? by kelnos on Thursday January 12, 2017 @06:12AM (#13381376)
For a smaller org, sure, especially if you have a monolithic build that would break if you made a change like that.

For a larger org, it's basically impossible to do that if you want to make forward progress.

But very much agreed that it's usually not easy to upgrade farther down the road when many things have changed. I've been trying to spread a culture of forethought and not changing things for the sake of "making things pretty", but it's an uphill battle.

Re:Is Semantic Versioning an Anti-Pattern? by Xylakant on Thursday January 12, 2017 @03:06AM (#13380606)
> Or the lie that people will do security and other updates on older versions.

counterpoint: rails. At least two versions are supported at any time, sometimes older versions still receive fixes for critical security issues. Rails follows semver and they're doing fairly well. I rarely see breakages from upgrading anything but major releases.

Re:Is Semantic Versioning an Anti-Pattern? by pjc50 on Thursday January 12, 2017 @06:43AM (#13381505)
> Thinking people can stay on the old version till they want to update is BS. They will update when they have to.

You can just about get away with this within an organisation, but you cannot do it to your customers if you have a competitor which doesn't impose this workload on them.

I'd like to kill off a decade-old toolchain I have to target, but people are still using the hardware it's required for. They don't want to spend the money on replacements when the current hardware still works, and why should they?

Re:Is Semantic Versioning an Anti-Pattern? by taeric on Wednesday January 11, 2017 @10:47PM (#13379696)
I realized too late for editing it in, but I do want to add that I do not think it is solely pushed by people encouraging this. I honestly think that most proponents of this are incredibly well intentioned.

Which just highlights, to me, that semver is ultimately good intentions masqueraded as a mechanism.