Hacker News new | ask | show | jobs
by msm_ 16 days ago
>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

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.

[1] https://0ver.org/

[2] https://www.hyrumslaw.com/

[3] https://en.wikipedia.org/wiki/Bug_compatibility

1 comments

Hyrum's law doesn't mean it's ok to knowingly make sweeping changes to your API... yes we all accept that every change might break someone. But that's why locking versions and immutable builds are a thing, it's expected that you should test everything every time you update, because there's always the possibility you're relying on undocumented/unsupported behavior.

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.