TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Major Version Numbers Are Not Sacred

51 点作者 mojombo将近 3 年前

4 条评论

favorited将近 3 年前
&gt; You just have to internalize that major version numbers are not sacred, you’re not going to run out of them<p>I know of at least 1 popular app that caused integer overflow when their version was parsed by a host system, so YMMV. Who would ever release a version greater than 65535, anyway?
评论 #31486390 未加载
评论 #31486633 未加载
评论 #31488555 未加载
saulpw将近 3 年前
I was hoping that Tom was going to &#x27;loosen&#x27; SemVer a bit, but instead he&#x27;s doubling down, and that&#x27;s to our detriment. Following SemVer as stated--any &quot;breaking change&quot; to the API must be released with a major version bump--communicates <i>less</i> than an ad hoc versioning system. Because some &quot;breaking changes&quot; may be in areas of the API that is used by few people (and sometimes literally no one), but a major version bump communicates &quot;breaking change&quot; to everyone. Or, every release is a major version bump, and so contains no information at all. When this happens several times a year, users just don&#x27;t have the bandwidth to sincerely investigate how breaking the changes are going to be for their own use-cases. So either they delay upgrading out of fear, or they YOLO blindly upgrade to the latest, but either way, SemVer has contributed to a culture of &quot;who the hell even knows what&#x27;s going on in their computer (or with their project&#x27;s dependencies) anymore&quot;.<p>I think a better solution would be a less-strict SemVer: the notion of &quot;breaking changes&quot; that require a major bump would be tempered by the number of users affected by the change. If it&#x27;s rarely used feature or API edge case, then we can risk a minor bump. If we&#x27;ve changed a commonly used API that will break some large % of user experiences, or a large number of uncommonly-used APIs that might in aggregate affect a large % of users, then we do a major bump. Of course this require some intuition about usage, and a very human judgment call, but that&#x27;s all versions ever have been: a toplevel way for developers to communicate to users the degree of change and risk of upgrading.
评论 #31701521 未加载
badrabbit将近 3 年前
I&#x27;ve always wanted to ask this to a Chinese developer: How common is it to avoid the number four in Chinese developer&#x27;s version numbers? I know for example buildings in China avoid floor #4 in buildings like with #13 in the US.
mc4ndr3将近 3 年前
Semver is best treated as a defensive strategy: I choose to follow semver principles for the packages that I upload, but I never trust other packages to reliably follow semver.<p>For this reason, I often pin not just the major, but also the minor and patch version of a dependency in my package configurations. And also cache the artifacts (go mod vendor, private package registry, etc.) So that any breaking changes are easy to identify and triage in the development process before surprising production.<p>If you do pin only at major level, then try to target a Long Term Support (LTS) series. Because LTS releases are much more likely to receive active maintenance, security updates, and stable, non-breaking changes, compared to non-LTS releases.<p>Regular, automated testing will help to identify more breaking changes before deploying production changes.<p>In the worst case, a breaking dependency change occurs contemporary with a first party bug. You need to be able to quickly identify, isolate, reset the third party version to a safe, compatible version in a small, fast hotfix while also working on fixing the first party bug.<p>Don&#x27;t be like those lazy dev teams that don&#x27;t pin even the <i>major</i> version of their components. Remember, operating systems and programming languages can introduce breaking changes. Your Docker base image should already offer at least major version tags, so make use of them.<p>Some will prefer to strike a balance between specificity and flexibility, for example omitting the build version, patch version, and&#x2F;or minor version. That&#x27;s a reasonable approach, too. But that approach has some implications regarding production deployments, which one prefers not to accidentally update production. A breaking change can even arrive in scant seconds between pre-production testing and production release. So if you do choose to pin at major level, then make sure to deploy exactly the same, pre-tested, whole project artifact to production. Don&#x27;t, for example, rebuild a Docker image to production that targets insufficiently granular component versions.<p>Regardless of the versioning approach, I would not recommend doing it one way for pre-production environments and a different way for production environments.<p>Any divergence in packaging will make troubleshooting unnecessarily complicated, and you won&#x27;t truly have tested the production code anyway. Don&#x27;t try to pin full in production while pinning at a diffferent granularity in non-production environments. Do reuse the same package configuration throughout the pipeline, with changes going the normal forward path all the way from local development to testing to production.<p>The problem is not so much that breaking changes are occurring all the time. There&#x27;s the psychological aspect that we neglect to plan for long term bitrot. For example, the app the began as a slapdash hackathon project, is now in production and several months (or years) have passed. Well, in that timeframe the probability of a breaking change has dramatically increased. You may not even be able to build the project again, due to breaking changes. Pinning in both documentation and package configuration is a way to future-proof your project, so that you will have the important details ready when you need them.<p>Treat your projects like a science experiment in a timecapsule. So that you can reliably rebuild and redeploy, later, when suddenly the landscape has dramatically shifted.