开发者

How Does One Implements Lists in Domain Driven Design?

开发者 https://www.devze.com 2022-12-23 19:58 出处:网络
How does one implement lists such as开发者_如何学Go a list of months in the year, or a list of years in DDD? Where does the logic go, inside value objects, a service, is it part of the domain layer?IM

How does one implement lists such as开发者_如何学Go a list of months in the year, or a list of years in DDD? Where does the logic go, inside value objects, a service, is it part of the domain layer?


IMHO Lists can be Entities, Value Objects and Aggregates as well. It depends on what kind of Lists they are. List of months in year could be Value Objects, when used often in different contexts, maybe the logic should be in services. List of items in the cart (when you don't expect it can grow too big) might be an Entity. List of users in the system with relationships could be implemented as an Aggregate.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号