How to design an immutable object with complex initialization

后端 未结 6 1154
北恋
北恋 2021-02-02 15:59

I\'m learning about DDD, and have come across the statement that \"value-objects\" should be immutable. I understand that this means that the objects state should not change aft

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-02 16:41

    Although it is probably part of the domain of what you are doing, and thus my suggestion may be invalid, what about attempting to break down the 8 parameters into logical groups?

    Whenever I see heaps of parameters, i feel like the object/method/contructor ought to be simpler.

提交回复
热议问题