2026-08-16
每日一句 · 技术圈趣话
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
调试代码的难度是编写代码的两倍。因此,如果你尽可能写出最聪明的代码,那么按定义,你就不够聪明去调试它。
— Brian Kernighan
背后的故事
这句话出自计算机科学家 Brian Kernighan(布莱恩·克尼汉),他是 C 语言和 Unix 系统的重要贡献者,与 Dennis Ritchie 合著了《C 程序设计语言》。该名言常被引用于《编程风格的元素》或《编程实践》等经典著作中。Kernighan 用幽默而尖锐的方式点出了一个普遍现象:程序员往往追求写出极其精巧、聪明的代码,以此展示智力,却忽略了调试的难度。他提醒大家,调试比写代码更难,如果代码过于晦涩,连作者自己都可能无法理解其逻辑,更不用说修复 bug 了。这句话在技术圈广为流传,成为强调代码可读性和简洁性的经典警句,也常被用来反驳“炫技式编程”的倾向。
小测
1. What is the main message of this quote?
2. Who is the author of this quote?