2020年/03月/01日
美在于简单
摘录自《程序员97件事》
Beauty of style and harmony and grace and good rhythm depends on simplicity.
风格之美,和谐,优雅以及优美的节奏尽在于简单
There are a number of things we strive for in our code:
• Readability
• Maintainability
• Speed of development
• The elusive quality of beauty
可读性
可维护性
开发速度
难以捉摸的美的品质
What is beautiful code? This is potentially a very subjective question. Per- ception of beauty depends heavily on individual background, just as much of our perception of anything depends on our background. People educated in the arts have a different perception of (or at least approach to) beauty than people educated in the sciences. Arts majors tend to approach beauty in software by comparing software to works of art, while science majors tend to talk about symmetry and the golden ratio, trying to reduce things to formulae. In my experience, simplicity is the foundation of most of the arguments from both sides.
美是一个主观问题,受过艺术训练的人更容易发现美。
The bottom line is that beautiful code is simple code. Each individual part is kept simple with simple responsibilities and simple relationships with the other parts of the system. This is the way we can keep our systems maintain- able over time, with clean, simple, testable code, ensuring a high speed of development throughout the lifetime of the system.
Beauty is born of and found in simplicity.
美来自于简单,亦存在于简单