How do I initialize classes with lots of fields in an elegant way?

后端 未结 6 1178
伪装坚强ぢ
伪装坚强ぢ 2020-12-23 11:40

In my application, I have to instantiate many different types of objects. Each type contains some fields and needs to be added to a containing type. How can I do this in an

6条回答
  •  春和景丽
    2020-12-23 12:18

    Some nice answeres are already given here!

    What came to my mind as an addition is Domain Driven Design. Specific the Building blocks part, with Entity, Value Object, Aggregate, Factory etc.

    A nice introduction is given in Domain Driven Design - Quickly (pdf).

提交回复
热议问题