The term "software bloat" was coined to describe the tendency of software to become slower and bigger over time as a result of a constant stream of additional features. While bloated software seems intuitively undesirable, its negative aspects become even more clear when considered from the SRE perspective: every line of code changed or added to a project creates the potential for introducing new defects and bugs. A smaller project is easier to understand, easier to test, and frequently has fewer defects. Bearing this perspective in mind, we should perhaps entertain reservations when we have the urge to add new features to a project. Some of the most satisfying coding I’ve ever done was deleting thousands of lines of code at a time when it was no longer useful.
术语“软件膨胀”用来描述软件随着时间的推移,不断增加的附加功能而使软件变得越来越慢和越来越大的趋势。虽然臃肿的软件在直觉上似乎是不可取的,但从SRE的角度考虑时,其消极方面变得更加明显:更改或添加到项目的每一行代码都有可能引入新的缺陷和错误。一个较小的项目更容易理解,更容易测试,并且通常有更少的缺陷。考虑到这一点,当我们有向项目添加新功能的冲动时,我们或许应该有所保留。我做过的一些最令人满意的编码是删除数千行无用代码。
Back to contents of the chapter(返回章节目录)
- Previous Section(上一节):I Won’t Give Up My Code!(我不会放弃我的代码!)
- Next Section(下一节):Minimal APIs(最小化API)