1 分钟阅读
你的 Bug 可能正是别人的功能
软件工程的魔幻定律(13)
Part IV-III:质量、维护与演化
Kernighan’s Law:调试比编写困难两倍
Brian Kernighan 写道:
“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.”
这条定律有很强的实践含义:代码的首要受众是人,其次才是机器。炫技的代码节省了编写时间,却成倍增加了后续维护的成本——包括调试、代码审查和功能迭代的成本。
可读性不是奢侈品,是工程实践的基础设施。