冷血软件
Cold-blooded software

原始链接: https://dubroy.com/blog/cold-blooded-software/

本文讨论某些技术选择如何影响软件项目的寿命。 正如生物对温度的耐受程度不同一样,一些软件可以处理长时间的停滞,而另一些则不能。 这种“小乌龟”方法利用无聊技术和供应商依赖项,允许项目在长时间间隔后保持完整,即使没有进行重大修改。 提供的一个例子是作者自己的网站,该网站最初是作为以前安装的 WordPress 的替代品而开始的,尽管其最初提交已近十二年,但仍然保持功能。 相反,耐用性较差的软件可能会由于外部服务损坏或丢失、过时的编译器以及开发人员无法控制的其他因素而变得无法使用。 为了进一步深入研究这些概念,作者建议查看他们即将出版的出版物“WebAssembly From the Ground Up”。 作者通过 RSS 和电子邮件提供订阅选项来结束本文。

冷血软件面临的挑战在于在遵守既定原则和技术与在不断变化的技术环境中保持相关性之间取得平衡。 虽然冷血可能意味着简单和极简主义,但它也需要创造力和足智多谋。 此外,实现冷血状态通常需要在灵活性和稳定性之间进行权衡,因为后者通常优先于前者。 最终,某个东西是否符合冷血软件的资格在很大程度上取决于上下文和意图,并且可能会因目标受众、业务影响和操作环境等因素而有很大差异。 如前所述,冷血软件主要在敏感性和安全风险较低的环境中提供优势,而较温暖的软件解决方案则适合风险较高的场景。
相关文章

原文
December 28, 2023

It’s 2004 and I’m sitting in one of the largest lecture halls at my university. I’m a computer science major but I’m taking a course on natural history — plants and animals — as one of my electives.

The professor tells us that he’s brought something from home, something he found in his freezer. He reaches down behind his desk, and then holds his arm out to show us what’s sitting in his palm: a baby painted turtle. We’re learning about cold-blooded animals, and it turns out that painted turtle hatchlings are pretty special — they’re one of only a few species that can survive being frozen.

Now, the lecture hall is pretty modern for 2004: there’s an overhead camera at the podium, where the professor can write notes that are displayed on screens around the hall. But instead of writing notes, he puts the turtle under the camera and starts his lecture.

Over the next hour, we watch this little reptile slowly come to life as the professor lectures. The first movements were nearly imperceptible. An eyelid cracking open, a leg inching forward. By the end of the lecture, the turtle has moved about halfway across our screens.

I’ll never forget that class, because it’s where I really understood what it means for an animal to be cold blooded. You see, warm-blooded animals — like humans or mice — have a stable body temperature that stays within a pretty narrow range. For humans, it’s around 37 degrees Celsius. A few degrees higher or lower and we’re in big trouble. Cold-blooded animals like the painted turtle can adapt their metabolism to the temperature around them. They’re active when it’s warm out, and as the environment (and their bodies) get cooler, they move more slowly. Very few of them can survive being frozen like the baby painted turtle can.

I see a similar dichotomy with software projects. Certain technology decisions lead to projects that are warm-blooded: everything is great when there’s constant motion on the project, generating heat. But put warm-blooded software in the freezer, and you’ll pull out a corpse six months later.

Maybe your CI isn’t working because one of the services you depend on got bought or ran out of money. You add a new dependency and find yourself needing to upgrade your compiler. Another package you depend on is deprecated, and doesn’t work with the latest version of the compiler.

Some projects are different. You work alone, make some changes when you’re inspired, and then don’t touch it again for another year, or two, or three. You can’t run something like that as a warm-blooded project. There’s not enough activity to keep the temperature up.

A cold-blooded project is like the baby painted turtle. You can freeze it for a year and then pick it back up right where you left off.

A cold-blooded project uses boring technology. The build and test scripts don’t depend on external services that might change, break, or disappear entirely. It uses vendored dependencies.

The software that powers this blog is cold-blooded. The first commit was nearly twelve years ago — a simple little static site generator to replace my out-of-date Wordpress installation:

commit 68949229ad426c1e8795ee640808db9987ab30ab
Author: Patrick Dubroy [email protected]>
Date:   Sun Jan 8 19:10:24 2012 +0100

    Add templates and site-building script.

It’s written in Python (2, not 3). It depends on four third-party modules, and they’re all committed to the project repository. Everything runs locally, and I deploy the result with rsync over ssh.

And boy am I glad I decided to do it that way. I’ve made a few small improvements over the years, but otherwise it’s continued to work without modification. And I fully expect that it will still be working in another twelve years.

🐢

👉 You might also want to check out the discussion on Hacker News.

Thanks to Thorsten Ball for helpful suggestions on this post.

联系我们 contact @ memedata.com