Data Pull vs. Push OOP Approach

后端 未结 12 750
旧时难觅i
旧时难觅i 2021-01-30 02:41

When I design my system from scratch, I often face a dilemma whether my object should push information into another objects OR whether the objects should

12条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-30 02:59

    According to tell dont ask, push is better - or more OO. You don't want to query object for data so you can do something, you want object to do it, because he's the one who knows his data.

    Related article about evil getters

提交回复
热议问题