我正在使用 PHP 中的域模型编写应用程序,并且想知道我应该采用哪种命名约定。
假设我有一个Customer
,Address
在它的聚合根中有一个。
我也有一个Product
,Option
在它的聚合根中有一个。
我有两种选择:
将聚合根保持在域模型的根部:
Customer Customer\Address Product Product\Option
Pro:我可以在同一个命名空间中同时 使用
Customer
和Con:必须引用它自己的Product
Customer
Address
Customer\Address
对同一命名空间中的所有聚合类进行分组,包括聚合根:
Customer\Customer Customer\Address Product\Product Product\Option
Pro :
Customer
可以将其地址引用为Address
Con : 从我的根域命名空间中,我必须引用:Customer
作为Customer\Customer
Product
作为Product\Product