2026-08-18
每日一句 · 技术圈趣话
There are only two hard things in Computer Science: cache invalidation and naming things.

计算机科学中只有两件难事:缓存失效和命名。

Phil Karlton(有时也被误传为 Martin Fowler 或其他人)

背后的故事

这句话最早由 Netscape 的工程师 Phil Karlton 提出,后来在技术圈广为流传。它精准地概括了程序员日常开发中最令人头疼的两个问题:缓存失效(cache invalidation)和命名(naming things)。缓存失效之所以难,是因为要保证数据一致性、处理过期策略、避免缓存雪崩等,稍有不慎就会引发隐蔽的 bug。而命名之所以难,是因为好的命名需要清晰表达意图、符合团队约定、易于维护,往往比写代码本身更费脑力。这句话后来被多次引用和改编,比如有人加上“off-by-one errors”作为第三件难事,但原版仍是经典。它反映了技术圈对简洁抽象和工程实践的幽默自嘲,也提醒程序员重视基础但易被忽视的细节。

小测

1. According to the quote, which of the following is considered one of the two hard things in Computer Science?

2. What is the second hard thing mentioned in the quote besides cache invalidation?

← 回到今天的「每日一文」