Builder pattern vs. config object

后端 未结 9 420
执笔经年
执笔经年 2021-01-31 08:40

The builder pattern is popular to create immutable objects, but there is some programming overhead to create a builder. So I wonder why not simply using a config object.

9条回答
  •  孤街浪徒
    2021-01-31 09:37

    You should not use the public field, but protected or private. For accesing then you should use the getters and setter to keep the encapsulation..

提交回复
热议问题