Is using one-to-one interfaces with domain entities a good or bad practice? Why?

后端 未结 6 1137
梦谈多话
梦谈多话 2021-02-01 17:16

One thing I see in some DDD enterprise apps that I work on, is the use of interfaces that are identical to the domain entities, with a one-to-one mapping of properties and funct

6条回答
  •  执笔经年
    2021-02-01 17:37

    I agree with you. Interfaces should act as a contract, so there is no value from having one-to-one interfaces with domain entities. It may be useful if you would like to abstract a certain behaviour. But, this will work in certain cases.

提交回复
热议问题