← 返回卡片

原书出处

Domain-Driven Design Tackling Complexity in the Heart of Software

75 原书第10章|Assertions

核验版本的摘录快照 · 导入于 2026-11-14T03:12:56.397Z

s it is: After p1.mixIn(p2): p1.volume is increased by amount of p2.volume. p2.volume is unchanged.

The trouble is, developers are going to make mistakes, because these properties don't fit the concepts we have invited them to think about. The straightforward fix would be change the volume of the other paint to zero. Changing an argument is a bad practice, but it would be easy and intuitive. We could state an invariant: Total volume of paint is unchanged by mixing.

But wait! While developers were pondering this option, they made a discovery. It turns out that the

此预览只包含定位所需的摘录和上下文。

原书定位详情

来源:a19c7933-4eda-4176-aebd-30fe7e1ad292

正文位置:extracted/Domain-Driven Design Tackling Complexity in the Heart of Software/_epub-src/0321125215_ch10lev1sec3.html

EPUB SHA-256:3e81897e8809ae8135b32e0563f9858b3020c5f5128531655f6d8e3a21c679ce