2026-09-29
每日一句 · 技术圈趣话
“Program testing can be used to show the presence of bugs, but never to show their absence.”

程序测试可以用来证明错误的存在,但永远无法证明错误的不存在。

— Edsger W. Dijkstra

背后的故事

这句话出自计算机科学家Edsger W. Dijkstra,他在1969年的经典论文《Notes on Structured Programming》中提出。Dijkstra是结构化编程的先驱,主张通过数学证明来保证程序正确性,而非依赖测试。他认为测试只能发现错误,不能证明程序没有错误,因此不能作为正确性的保证。这一观点在软件工程领域影响深远,提醒开发者测试的局限性,并推动了形式化验证、代码审查等方法的探索。在技术圈,这句话常被引用来说明测试的局限性,强调严谨设计和数学证明的重要性。它也是形式化方法支持者的重要论据,与Dijkstra的其他名言一起体现了他对编程严谨性的追求。这句话至今仍是软件工程中的经典格言,被无数程序员引用。

小测

1. What does Dijkstra's quote imply about the role of testing in software development?

2. Who is credited with the quote "Program testing can be used to show the presence of bugs, but never to show their absence"?

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