News for hackers. Stuff that matters.
Re:Go’s Major Versioning Sucks – From a Fanboy by nemothekid on Tuesday September 15, 2020 @10:30PM (#24488978)
What I dislike about Go's solution, and somewhat about semver in general is that no one makes major version changes anymore even if they break backwards compatibility.

However if I use semver internally, like it's supposed to and make regular major changes (let's say once a month), my code repo becomes a mess. After a 2 years, I'll have folders for v1 up to v24. And the fact that I have to copy -R/grep|sed, means that people will be less likely to properly signal that a backwards incompatible change has occured.

Disregarding uniformity, for the reasons above I don't think their design is a good one. It treats major version changes as a rare event.

Re:Go’s Major Versioning Sucks – From a Fanboy by Skinney on Wednesday September 16, 2020 @12:55AM (#24489653)
If you're introducing breaking changes once per month, then your library really isn't ready.

Tell people you have an unstable library. Breaking changes _will_ happen. Then, when you've used your library in production for a while and are reasonably sure it wont have to change, tell people it's stable. If you make breaking changes after that, then start with a v2 suffix.

For some reason, semver has made people stop going through the alpha, beta and rc stages of a release, even though the point of such things is to discover breaking changes before you're commited to maintaining the version for the time to come.

Major version changes should be a rare event. If it's not, you're really just shipping around a (pre)alpha library, and should be explicit about that.

Re:Go’s Major Versioning Sucks – From a Fanboy by barumi on Wednesday September 16, 2020 @01:36AM (#24489857)
> If you're introducing breaking changes once per month, then your library really isn't ready.

The whole software industry moved away from waterfall to agile because it's unreasonable to assume that no requirements will emerge. I would disagree, for example, that Python3 is not ready just because they're introduced backward incompatible changes in some minor releases.

Re:Go’s Major Versioning Sucks – From a Fanboy by curryst on Wednesday September 16, 2020 @12:54PM (#24494535)
> The whole software industry moved away from waterfall to agile because it's unreasonable to assume that no requirements will emerge.

There's also an insidious side effect that people tend to think of the more common semver of features than strict semver, and they associate versions with progress and effort. You could easily get to version 50.0.0 just sorting out finishing touches on the API with strict semver if you don't have good communication with the customer. Some enterprising middle manager will start asking you've spent 50 major versions worth of effort on this library or app.

As a result of those effects and the unequal application of semver, I usually encourage people at work to choose other versioning schemes. Without strictly enforcing semver, there's really not a huge advantage to semver over a plain incrementing version. Incrementing versions also have the nifty feature of making it trivial to see how many versions behind you are. Or some people go with timestamped versions, which tells you how old your version is.

Re:Go’s Major Versioning Sucks – From a Fanboy by tick_tock_tick on Wednesday September 16, 2020 @04:41AM (#24490744)
I mean python is basically the prime example of how to poorly manage version upgrades with their failure of 2 => 3.
Re:Go’s Major Versioning Sucks – From a Fanboy by barumi on Wednesday September 16, 2020 @12:05PM (#24493950)
Can you provide a single example that supports your thesis that migration from Python 2 to 3 was poorly managed semver-wise?

If anything, Python is chastised for having maintained two major versions in parallel without giving any compelling reason to force major rewrites on the while ecosystem.

Re:Go’s Major Versioning Sucks – From a Fanboy by bigiain on Wednesday September 16, 2020 @05:48AM (#24491077)
They were just desperate to do a better job of screwing up than Perl with it's 5 => 6 updates...

<grin>

Re:Go’s Major Versioning Sucks – From a Fanboy by masklinn on Wednesday September 16, 2020 @11:40AM (#24493705)
As we can see from the Perl ecosystem having completely moved over to the extent that Perl 5 is now out of support while Python is still mired in the update.
Re:Go’s Major Versioning Sucks – From a Fanboy by takeda on Wednesday September 16, 2020 @01:32PM (#24495000)
That's funny, because I see the opposite. Perl 6 was a failure that had to be spun into a separate language and people stayed with perl 5, recently work on perl 7 started, but as far as I know perl 5 is still the version in use, recently FreeBSD forced me to update perl to version 5.32.

Regarding Python, I no longer see 2.7 in the wild (I have no doubt it is still in some places) all projects I'm working on are in Python 3. AWS Lambda supports 3.8 (which is the latest stable version), Ubuntu comes with 3 installed by default. FreeBSD set 3.7 as default, depreciated and will remove 2.7 completely by the end of this year.

Many Python 3 packages were released as python 3 only, the packages that that previously supported 2 dropped their support. Currently running 2.7 is a liability. Not as much that it is EOL and there are no security fixes anymore, but also packages dropping support (which is IMO a bigger deal).

Re:Go’s Major Versioning Sucks – From a Fanboy by masklinn on Wednesday September 16, 2020 @03:42PM (#24496729)
Yes my comment was ironic.
Re:Go’s Major Versioning Sucks – From a Fanboy by takeda on Wednesday September 16, 2020 @06:39PM (#24498835)
ah, feeling dumb now :)
Re:Go’s Major Versioning Sucks – From a Fanboy by brabel on Wednesday September 16, 2020 @07:17AM (#24491485)
> The whole software industry moved away from waterfall to agile because it's unreasonable to assume that no requirements will emerge

That's completely unrelated to library versioning. The software industry that I work at absolutely relies on library authors to diligently introduce breaking changes only in rare occasions, and preferably using semver to the extent possible.

If you can't guarantee your library will be kept up-to-date with bug and security fixes, without me having to re-write my application on minor library updates because you decided to change your API to make it prettier, then I most certainly won't be using your library (indeed, I have removed dependencies from projects I worked on for this reason).

Re:Go’s Major Versioning Sucks – From a Fanboy by nemothekid on Wednesday September 16, 2020 @11:56AM (#24493867)
>re-write my application on minor library updates

This is the tension of semver - a minor library update might include a breaking change, but that doesn't mean you have to rewrite your application. For example, lets say I have a library that returned an int32 in a single function that would silently corrupt your data, but now has to return an int64.

The right thing to do would be to issue a major upgrade where the function returns an int64. If you never used this function you wouldn't have to rewrite your application. Major updates in semver only mean backwards compatibility is broken, it doesn't mean it's am whole new api.

To me, the Go approach takes your approach to major upgrades - reserve them for when you do something like rewriting the API. That's to me isn't a good assumption to bake in, I'd like to change a single function signature without having to copy my entire library to a new folder.

Re:Go’s Major Versioning Sucks – From a Fanboy by Skinney on Thursday September 17, 2020 @06:01AM (#24502806)
> To me, the Go approach takes your approach to major upgrades - reserve them for when you do something like rewriting the API. That's to me isn't a good assumption to bake in, I'd like to change a single function signature without having to copy my entire library to a new folder.

Then make a new function within the same folder that works in a new way. If necessary, mark the old function as deprecated. An exception can be made if the function never worked to begin with, but that should really have been cought by tests or people using a pre-release version of the library.

Re:Go’s Major Versioning Sucks – From a Fanboy by barumi on Wednesday September 16, 2020 @12:03PM (#24493933)
> That's completely unrelated to library versioning.

It really is not. The initial assertion was that stumbling on breaking changes once per month was somehow a sign that a library isn't ready. Thus assertion flies in the face of the reality of software engineering. If your whole process is designed to allow requirements to emerge then you will have to deal with emergent requirements that you need to accommodate, and in moderately sized projects that always involves changing behavior.

Re:Go’s Major Versioning Sucks – From a Fanboy by brabel on Monday September 21, 2020 @07:46AM (#24542188)
> It really is not.

You seem to be assuming we use libraries to implement the quickly changing business requirements? If you do that, then sure, you'll have a hard time using versioned libraries at all. But you don't need to do that. Doing that is just a pain.

Have a single code base with separate modules by all means, but don't pretend the modules are versioned separately and independent.

In other words: don't make them libraries unless you MUST. A library, by definition, is a re-usable software component. Something can only be re-usable when it's stable (if it keeps changing, it's by definition not re-usable as consumers would also be expected to keep changing, and that's not the case for everything as you seem to assume). Things like base64, encryption algorithms, data structures... even spec-backed things like OAuth and HTTP libraries don't just change every month.

Re:Go’s Major Versioning Sucks – From a Fanboy by hibbelig on Wednesday September 16, 2020 @02:58AM (#24490218)
I think GP was talking about internal software. Since business requirements are prone to change a lot, don’t blame the developers that the software needs to change.
Re:Go’s Major Versioning Sucks – From a Fanboy by Skinney on Wednesday September 16, 2020 @07:00AM (#24491406)
Were I work we have several internal libraries. When we crossed the point were one library was used in more than 3 services, we stopped doing breaking changes because it was simply to time consuming to upgrade to the next major version of the package.

Imagine spending an significant portion of your day migrating all your internal apps to the latest major version of an internal package, then you can imagine what we faced once a month.

We stopped doing breaking changes after a while. Instead we're effectively doing versioning at the module level. If module A could really use a fixup, we make an entirely new module A.V2, and start using that in new code. Things that don't need the new functionality can keep using the old API, which still works, and upgrade whenever we have some extra time (we never have extra time) or we really _really_ need to.

We've also adopted a policy that nothing gets added to our internal packages before they've been used in an application for a certain amount of time. Code duplication between applications is fine if we don't know exactly how the API should work, that way you have flexibility to change the code to fit a specific use case for a specific application.

If that common functionality really has to be common _straight_ away (which we surprisingly haven't hit yet) we could place it in a module A.Unstable to make certain everyone knows that it can break at any point.

In either case. It's just as important to avoid breaking changes in internal software as in everywhere else. Breaking changes are not free, except for the library authors.

Re:Go’s Major Versioning Sucks – From a Fanboy by jacobvosmaer on Wednesday September 16, 2020 @04:49AM (#24490783)
I think the issue is about having to cross a module boundary, which is really about monorepo vs multirepo. You have much more freedom to make breaking changes when you don't need to cross a (repo/module) boundary.

I think the Go module system encourages you to avoid adding unnecessary boundaries. As someone else pointed out already, one of the problems is that you don't find out that boundaries are bad until you hit v2, and then you discover that you have this chunk of technical debt (unnecessary repo boundaries that slow down development) that you didn't know about.

Re:Go’s Major Versioning Sucks – From a Fanboy by sagichmal on Wednesday September 16, 2020 @12:03PM (#24493936)
You don't get to define what "ready" means for me. I get to define that, as the author of the package.
Re:Go’s Major Versioning Sucks – From a Fanboy by atombender on Wednesday September 16, 2020 @01:35AM (#24489853)
Go doesn't require a folder for each version. You can simply change go.mod to declare the module as github.com/nemothekid/foolib/v2 or whatever.

That's one of the points of confusion — first that the go.mod module declaration doesn't need to exactly match the module location, and secondly, following this, that using a folder instead is a fallback option.

Go is famous for favouring simplicity in its design, but this is a rare instance where it's not made things simple enough.

Re:Go’s Major Versioning Sucks – From a Fanboy by infogulch on Wednesday September 16, 2020 @12:13AM (#24489464)
If you write something for internal use and can enforce version upgrades could you not just keep the last, say, 3 versions in the repo HEAD and delete folders v1-v20? Between go.mod and go.sum, historical dependencies will still resolve fine because they point at the old commit. If you know you will never release another patch for a particular major version I think you could just drop the directory from the repo.
Re:Go’s Major Versioning Sucks – From a Fanboy by andrewprock on Tuesday September 15, 2020 @10:42PM (#24489043)
For a designed library, major version changes should be a rare event.

For a collection of code that someone calls a library, all bets are off.

Re:Go’s Major Versioning Sucks – From a Fanboy by jerf on Tuesday September 15, 2020 @11:50PM (#24489375)
"For a designed library, major version changes should be a rare event."

If you properly honor semver, for any non-static library, major version changes will either be a modestly-frequent event, or you're really straightjacketing yourself with your first v1, or you're a genius who got everything right the first time and never have to make any changes.

Or, most likely, you're not honoring semver properly and kindasorta squint at your changes until they don't seem important anymore and then ship an incremental anyhow.

Go may make it somewhat more annoying than the average language to ship a new major version in some ways, but libraries either not rev'ing their major version number when they technically should have and mostly expecting to mostly get away with it, or libraries bending themselves slowly into pretzels to stay on the same major version according to semver when they really ought to just make a new major version are things I see in many languages.

Re:Go’s Major Versioning Sucks – From a Fanboy by wahern on Wednesday September 16, 2020 @12:11AM (#24489459)
> If you properly honor semver, for any non-static library, major version changes will either be a modestly-frequent event, or you're really straightjacketing yourself with your first v1, or you're a genius who got everything right the first time and never have to make any changes.

IMO, someone tackling a problem for the first time shouldn't be writing public libraries. At the very least, people shouldn't be using it.

Quality, stable libraries tend to be written by people who already have at least 1 or 2 iterations under their belt. Maybe not complete iterations, and rarely public, but enough experience with the nuts & bolts of the problem, including the problem of balancing concerns between caller & callee, to have a good idea about what the proper interfaces should look like to ensure long-term stability. If someone doesn't have a strong sense that they could support the v1 interface in perpetuity, then maybe don't create a separate project. Not only does it save everybody else from the pain, it often saves the author the pain of constant churn, presuming the author even uses it in more than a handful of their own projects.

For many of my own open source projects, I often have years of abandoned false starts lying around, or various just-so solutions manually copied and hacked into various other projects. Only when I feel like things have finally congealed do I then bother to write a dedicated library, whether private or public, and migrate everything to it. One way to know things are looking good is when you realize you're no longer fiddling with the API, or maybe just vacillating between two equally decent alternatives.

Re:Go’s Major Versioning Sucks – From a Fanboy by bigiain on Wednesday September 16, 2020 @05:51AM (#24491094)
> you're really straightjacketing yourself with your first v1, or you're a genius who got everything right the first time and never have to make any changes

In my head - that's what v0 is for. Many people try to jump the v1 gun well before they've allowed the real world to impose itself on the unwarranted assumptions that should have been shaken out in v0

Re:Go’s Major Versioning Sucks – From a Fanboy by gravypod on Wednesday September 16, 2020 @12:19AM (#24489489)
Rarely is not never.

"For a well architect house, fires should occur very rarely. As such we should not install smoke alarms."

If it can happen it will happen and whatever you're designing should be built with that in mind. Say nothing of an entire language's package management semantics

Re:Go’s Major Versioning Sucks – From a Fanboy by Skinney on Wednesday September 16, 2020 @12:51AM (#24489636)
There is a big gap between "breaking changes every month" and every couple of years.
Re:Go’s Major Versioning Sucks – From a Fanboy by gravypod on Wednesday September 16, 2020 @03:14PM (#24496309)
That doesn't really matter. For a large enough code base "a breaking change every couple of years" for each library in your source tree could easily be a breaking change every every day.

When the surface you're looking at is "all open source code supporting this language" are you confident saying that there will only be 1 breaking change every 2 years for your tools?

Imagine you're making a GUI. I don't think there's any GUI lib in the mobile OS space that hasn't added or deprecated a major feature in the last 2 years. Android is very good at this and there's still large deprecation events (see Jetpack).

Re:Go’s Major Versioning Sucks – From a Fanboy by Skinney on Thursday September 17, 2020 @06:08AM (#24502827)
I picked up a Clojure project I wrote three-four years ago last month and upgraded it to all its latest dependencies.

No breaking changes.

The HTML-based applications I've written going back the last six years all still work on modern browsers.

The few apps I've written for Android didn't work across all Android versions even when in active development. Android really is the best example of how miserable development can be when backwards compatibility (or really, just compatibility) isn't taken seriously.

Re:Go’s Major Versioning Sucks – From a Fanboy by Aeolun on Tuesday September 15, 2020 @11:37PM (#24489321)
What open source project is a designed library?

This will just pollute the API interface for the sake of maintaining backwards compatibility.

Re:Go’s Major Versioning Sucks – From a Fanboy by slavik81 on Tuesday September 15, 2020 @11:50PM (#24489378)
Qt hasn't broken binary compatibility since the release of Qt 5.0 in 2012. The last one before that was the release of Qt 4.0 in 2005. It's a very impressive standard they set out for themselves (and met). https://wiki.qt.io/Qt-Version-Compatibility