Should I use set once variables?

后端 未结 8 764
闹比i
闹比i 2020-12-21 05:27

Does this smell?
I have a few properties you can only set once. They can be set at any time during the objects existence and can not be undone.
I implement then like

8条回答
  •  太阳男子
    2020-12-21 05:36

    if FooThingy is a value object like an int it will be 0 initialized instead of null. For the rest it looks okay

提交回复
热议问题