每日英语 · 2026-11-06
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?
Brian W. Kernighan · The Elements of Programming Style · 1978 · 与 P. J. Plauger 合著,第 2 版第 2 章;常称 Kernighan's Law。Wikiquote 收录此原句
译文
谁都知道,调试要比当初把程序写出来难上一倍。所以,如果你写代码时已经把聪明劲儿用到了极限,那你以后还怎么调试得了它?
语法
- 第一句主干:Everyone(主语)knows(谓语)+ that 引导的宾语从句。从句里 debugging(动名词作主语)is(系动词)twice as hard as writing…(表语,比较结构)。in the first place 是固定短语,意思是「起初、当初」。
- 第二句是 So 引出的推论,核心是 if 条件句 + 特殊疑问句:if you're as clever as you can be…(条件)how will you ever debug it?(结果)。as + 形容词 + as one can be 表示「尽可能地……」;ever 加强语气,带点「究竟/到底」的意味。
- writing a program / when you write it:前半用动名词短语作比较对象,后半用时间状语从句,同一件事换两种结构,读起来更自然。
词汇
-
debugging /ˌdiːˈbʌɡɪŋ/ n. (动名词)
调试、排错;句中指找出并修正程序缺陷的过程
搭配:debugging tools / remote debugging / spend hours debugging
Remote debugging saved us a trip to the lab.
-
twice as hard as /twaɪs əz hɑːrd əz/ phrase
比……难一倍;倍数比较的常见说法
搭配:twice as + adj. + as / twice as many/much + n. + as
This MCU is twice as fast as the old one.
-
in the first place /ɪn ðə ˈfɜːrst pleɪs/ phrase
起初、当初;也常用来补充理由「首先」
搭配:Why … in the first place? / shouldn't have … in the first place
We shouldn't have skipped the unit tests in the first place.
-
clever /ˈklevər/ adj.
聪明的;句中偏「耍小聪明、写得过于机巧」
搭配:a clever trick / too clever by half / as clever as you can be
That bit-twiddling trick is clever, but hard to maintain.
笔记
写嵌入式代码时也一样:能读懂、能单步跟完的写法,往往比「一行炫技」更值钱。今天试着把你最近一段「自己都觉得巧」的代码,改成同事一眼能看懂的版本。