by ninkendo · 1w ago · 0 comments
The problem with SemVer is it encourages you to "move fast and break things", constantly bumping major versions as a standard practice, rather than thinking very deeply about what abstractions you make public in your library (often minimizing the surface area as much as possible) to avoid painting yourself into a corner, and being extremely deliberate about any time you need to break the API in order to make a change. Ideally forking things with the changes and releasing the new library "all at once" once enough accumulated changes have built up, rather than bumping the major once every time.
The real issue I'm complaining about is the cavalier attitude towards breaking changes that library maintainers tend to have, and how much I believe SemVer caused it. If this attitude was not prevalent I'd have no problems with SemVer.
That's why we have zerover[1]!
But I don't think I agree with blaming semver. Semver is just a tool to make the version number meaningful. There are projects that never have breaking changes, and stay on 1.x.x. There are projects that churn breaking changes like they get paid per major version. Versioning scheme doesn't really impact this.
The alternative to semver is not "projects don't make breaking changes", it's the old bad "projects make breaking changes randomly from release to release, and without carefully reading the changelog you will never know". But back then dependencies were rare, releases were a big thing, and people were OK with reading changelogs. At our current scale this is impossible.
Finally, there's also Hyrum's Law[2]. There is no way to change anything if you don't accept breaking any, even theoretical, workflow. We even have a word for "Bug compatibility"[3]. Fixing a bug will break software of people that depend on this bug.
But then you have projects that just decide every other month that the abstractions they just introduced are now out of style and decide to rework everything. Changing names of functions, taking formerly-public types and making them private, utterly (and intentionally) breaking every single person that uses the library. I think we can agree that these types of changes are distinct from what you'd put under hyrum's law.
> The alternative to semver is not "projects don't make breaking changes", it's the old bad "projects make breaking changes randomly from release to release, and without carefully reading the changelog you will never know". But back then dependencies were rare, releases were a big thing, and people were OK with reading changelogs. At our current scale this is impossible.
I don't disagree with this, but you can't separate the good from the bad with semver. It makes bad engineering practices easier to spot, yes. But it also normalized them. Intentionally breaking compatibility in a software library is bad engineering practice. SemVer lets people pretend that's not true because they can increment a version number and skirt all blame for it.
(Edit: I'd be happy if the semver quasi-rfc at least paid lip service to the effect of "Backward incompatible changes SHOULD NOT be introduced a public API" or something, but it doesn't even say anything of the effect, just "Major version X MUST be incremented". The FAQ even says "Deprecating existing functionality is a normal part of software development and is often required to make forward progress", which just reinforces the attitude. It shouldn't be "normal" at all... a better wording might be "Deprecating existing functionality is regrettable but sometimes required to make forward progress.")
Again I want to stress that the actual thing I'm against, is the cavalier attitude towards backward compatibility. Like this thread starting from someone saying "I wanted to go into $crate and change everything and was met with resistance!" as if we should be sympathetic to them. No, I'm sympathetic to the maintainers of $crate who understand that if you don't like its API's you should start a new crate, not simply change an existing one to suit your tastes. We need more of this resistance.