《Clean Code》第十四章读后

Posted at — May 20, 2019

蹩脚的译文看着实在费解,干脆去看《Clean Code》的原版。第14章“Successive Refinement(逐步改进)”讲的是对一个用Java实现的解析命令行参数的类Args重构的过程。





Programmers who satisfy themselves with merely working code are behaving unprofessionally. They may fear that they don’t have time to improve the structure and design of their code, but I disagree. Nothing has a more profound and long-term degrading effect upon a development project than bad code.



But bad code rots and ferments, becoming an inexorable weight that drags the team down. Time and time again I have seen teams grind to a crawl because, in their haste, they created a malignant morass of code that forever thereafter dominated their destiny.



Most freshman programmers (like most grade-schoolers) don’t follow this advice particularly well. They believe that the primary goal is to get the program working. Once it’s “working,” they move on to the next task, leaving the “working” program in whatever state they finally got it to “work.” Most seasoned programmers know that this is professional suicide.

当你还是个“freshman”的时候,你觉得精益求精无关紧要是可以被短暂地容忍的,而当你不再fresh的时候还表现得像个freshman,你的职业生涯几乎就走到头了(professional suicide)。