原书出处
Domain-Driven Design Tackling Complexity in the Heart of Software
74 原书第10章|Side -Effect-Free Functions
he mixIn() method. When we moved out the color data, we should have taken related behavior with it.
Before we do, note that Pigment Color is a VALUE OBJECT. Therefore, it should be treated as immutable. When we mixed paint, the Paint object itself was changed. It was an ENTITY with an ongoing life story. In contrast, a Pigment Color representing a particular shade of yellow is always exactly that. Instead, mixing will result in a new Pigment Color object representing the new color.
Figure 10.7. public class PigmentColor { public PigmentColor mixedWith(PigmentColor other, double r
原书定位详情
来源:a19c7933-4eda-4176-aebd-30fe7e1ad292
正文位置:extracted/Domain-Driven Design Tackling Complexity in the Heart of Software/_epub-src/0321125215_ch10lev1sec2.html
EPUB SHA-256:3e81897e8809ae8135b32e0563f9858b3020c5f5128531655f6d8e3a21c679ce