문제

If I have a Tank entity, would it be correct to have a Capacity value consisting of Capacity.Value and Capacity.Unit?

I would usually have Tank.CapacityValue and Tank.CapacityUnit, but I think this is not correct in a DDD scenario. Thank you for your input.

도움이 되었습니까?

해결책

I think you're after the Quantity pattern as described here by Martin Fowler:

... But using objects invites us to add new fundamental types whenever they add value, and having a specific type for dimensioned quantities adds quite a lot of value.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top