《我所知的良好的系统设计》-摘要

by kevin 23. 八月 2025 09:56 >
1、 程序设计是组装代码,系统设计是组装服务。 程序设计的组件是变量、函数、类等,系统设计的组件是服务器、数据库、缓存、队列、事件总线、代理等。 2、 如果一个系统很长时间不出错,它的设计就是良好的。 如果你进一步看了代码,脱口而出:"哈,这比我想的要简单",或者"这个部分不用我操心,即使出问题也容易解决",它的设计就是优秀的。 3、 良好的系统设计,总是从一个有效的简单系统发展而来。千万不要从零开始设计一个复杂的系统。 4、 系统设计的难点在于状态。尽量采用无状态组件,最小化"有状态组件"的数量。 状态的复杂性在于,你无法简单地重启服务。一旦出错,往往需要手动修复状态。 5、 状态需要保存在数据库。数据库是最重要的系统组件,用来管理状态。 数据库的设计目标是每张表易于理解:打开看一下表结构,就能大致了解... [更多...]

软件开发中的康威定律

by kevin 6. 三月 2024 13:31 >
        "设计系统的架构受制于产生这些设计的组织的沟通结构。"康威定律是马尔文·康威1967年提出的。即系统设计本质上反映了企业的组织机构。系统各个模块间的接口也反映了企业各个部门之间的信息流动和合作方式。 康威定律包含4个子定律: 第一定律 组织沟通方式会通过系统设计表达出来 第二定律 时间再多一件事情也不可能做的完美,但总有时间做完一件事情 第三定律 线型系统和线型组织架构间有潜在的异质同态特性 第四定律 大的系统组织总是比小系统更倾向于分解 康威定律的意义具体来说,包括以下3点: 指导系统设计:系统的结构受到设计它的组织结构的影响,因此在设计系统时需要考虑到组织结构对系统的影响,尽可能地将组织结构与系统结构相匹配,以便更好地管理和... [更多...]

《Software Engineering at Google》摘抄(18)

by kevin 7. 七月 2023 13:25 >
The compiler also doesn’t know anything about how to handle external dependencies, such as third-party JAR files in Java. Often the best we can do without a build system is to download the dependency from the internet, stick it in a lib folder on the hard drive, and configure the compiler to read libraries from that directory. Over time, it’s easy to forget what libraries we put in there, where th... [更多...]

《Software Engineering at Google》摘抄(17)

by kevin 30. 十一月 2022 18:32 >
能够立即有效地浏览整个代码库意味着很容易找到相关的库来重用和好的例子来复制。 Most of the time, developers won’t notice when indices are out of date. They only care about a small subset of code, and even for that they generally won’t know whether there is more recent code. However, for the cases in which they wrote or reviewed the corresponding change, being out of sync can cause a lot of confusion. It tends not to matter whether the ... [更多...]

《Software Engineering at Google》摘抄(16)

by kevin 18. 十一月 2022 12:27 >
In all of this thinking, we’re assigning special significance to the trunk branch. But of course, “trunk” in your VCS is only the technology default, and an organization can choose different policies on top of that. Perhaps the default branch has been abandoned and all work actually happens on some custom development branch—other than needing to provide a branch name in more operations, there’s no... [更多...]

《Software Engineering at Google》摘抄(15)

by kevin 15. 十一月 2022 13:44 >
Our discussion of deprecation begins from the fundamental premise that code is a liability, not an asset. After all, if code were an asset, why should we even bother spending time trying to turn down and remove obsolete systems? Code has costs, some of which are borne in the process of creating a system, but many other costs are borne as a system is maintained across its lifetime. These ongoing co... [更多...]

《Software Engineering at Google》摘抄(14)

by kevin 9. 十一月 2022 13:53 >
Unit tests are limited by the imagination of the engineer writing them. That is, they can only test for anticipated behaviors and inputs. However, issues that users find with a product are mostly unanticipated (otherwise it would be unlikely that they would make it to end users as issues). This fact suggests that different test techniques are needed to test for unanticipated behaviors.(单元测试受到编写它们的... [更多...]

《Software Engineering at Google》摘抄(13)

by kevin 20. 十月 2022 18:27 >
Writing testable code requires an upfront investment. It is especially critical early in the lifetime of a codebase because the later testability is taken into account, the more difficult it is to apply to a codebase. Code written without testing in mind typically needs to be refactored or rewritten before you can add appropriate tests.(编写可测试代码需要前期投入。在代码库生命周期的早期,这一点尤其重要,因为越晚考虑可测试性,就越难应用到代码库中。在没有考虑... [更多...]

《Software Engineering at Google》摘抄(12)

by kevin 11. 十月 2022 13:41 >
At Google, we’ve found that engineers sometimes need to be persuaded that testing via public APIs is better than testing against implementation details. The reluctance is understandable because it’s often much easier to write tests focused on the piece of code you just wrote rather than figuring out how that code affects the system as a whole. Nevertheless, we have found it valuable to encourage s... [更多...]

《Software Engineering at Google》摘抄(11)

by kevin 1. 十月 2022 13:43 >
Unlike the QA processes of yore, in which rooms of dedicated software testers pored over new versions of a system, exercising every possible behavior, the engineers who build systems today play an active and integral role in writing and running automated tests for their own code. Even in companies where QA is a prominent organization, developer-written tests are commonplace. At the speed and scale... [更多...]