你的代码是否过于复杂? 译文: 如果你的代码中出现了下列的情况,就说明你的代码过于复杂了:
-
你需要在代码中添加“hack”来使其正常工作。
-
其他的开发人员经常问你一些代码块是如何工作的。
-
其他的开发人员经常错误使用你的代码,并导致了不少的bug。
-
有经验的开发人员不能一眼看出你代码的含义。
-
你很害怕修改这部分的代码。
-
管理层认为需要多人共同维护一个简单的类或者文件。
-
很难添加新的特性。
-
开发者经常为如何实现这段代码的功能而争论。
-
这部分代码经常修改。
原文:
Here are some clues that tellyou that your code may be too complex:
-
Youhave to add “hacks” to make things keep working.
-
Otherdevelopers keep asking you how some part of the code works.
-
Otherdevelopers keep mis-using your code, and causing bugs.
-
Readinga line of code takes longer than an instant for an experienceddeveloper.
-
Youfeel scared to modify this part of the code.
-
Managementseriously considers hiring more than one developer to work on asingle class or file.
-
It’shard to figure out how to add a feature.
-
Developersoften argue about how things should be implemented in this part ofthe code.
-
People make utterlynonsensical changes to this part of the code very often, which youcatch only during code review, or only after the change has beenchecked in.
That’s what I can come upwith off the top of my head. What are some others?
链接: http://www.codesimplicity.com/post/clues-to-complexity/#comments