Data Layer Best Practices

后端 未结 8 1356
甜味超标
甜味超标 2021-02-04 12:43

I am in the middle of a \"discussion\" with a colleague about the best way to implement the data layer in a new application.

One viewpoint is that the data layer should

8条回答
  •  Happy的楠姐
    2021-02-04 13:23

    You can have both. Let data layer not know of your bussiness objects and make it capable of working with more than one type of data sources. If you supply a common interface (or an abstract class) for interacting with data, you can have different implementations for each type of data source. Factory pattern goes well here.

提交回复
热议问题