非循环依赖原则 - 组件依赖循环如何成为 "morning-after syndrome" 的原因?

Acyclic Dependency Principle - How could component dependency cycles be reason for "morning-after syndrome"?

我正在阅读 Robert Martin 的 "Agile Principles, Patterns, and Practices in C#"。 目前我正在阅读非循环依赖原则(ADP)。我无法理解该部分中的一个部分。让我简短地解释一下这部分。

首先作者给出了"morning-after syndrome"的定义。

Have you ever worked all day, gotten some stuff working, and then gone home, only to arrive the next morning to find that your stuff no longer works? Why doesn't it work? Because somebody stayed later than you and changed something you depend on! I call this "the morning-after syndrome."

然后他解释了如何解决这个问题:

The solution to this problem is to partition the development environment into releasable components. The components become units of work that can be the responsibility of a developer or a team of developers. When developers get a component working, they release it for use by the other developers. They give it a release number, and move it into a directory for other teams to use, and continue to modify their component in their own private areas. Everyone else uses the released version. As new releases of a component are made, other teams can decide whether to immediately adopt the new release. If they decide not to, they simply continue using the old release. Once they decide that they are ready, they begin to use the new release.

然后他给我们展示了一个没有任何依赖循环的组件结构的例子:

What isimportant is the dependency structure of the components. Note that this structure is a directed graph. The components are the nodes, and the dependency relationships are the directed edges.

然后假设一个新需求迫使我们更改 MyDialogs 中的 classes 之一,以便它使用 MyApplication 中的 class ].您可以猜到,它会创建依赖循环:

然后他注意到:

The cycle forces MyApplication, MyTasks, and MyDialogs to always be released at the same time.

我的问题是:为什么? 如果我们使用可发布的组件,为什么其他两个组件必须与[=11=同时发布]?

提前致谢。

"The cycle forces ... to always be released at the same time"实际上不是真的。

但是循环依赖意味着你可以同时改变相互依赖的MyApplicationMyDialogs然后你将不得不同时释放它们。

如果您确保您的组件依赖项是非循环的,那么您永远不会被迫同时释放它们。

此外,如果在 第一次 发布组件时存在依赖循环,那么您将不得不在最初同时发布它们。