Useless interfaces

后端 未结 25 1659
南笙
南笙 2020-12-14 01:42

Why would you ever use an interface if you are only going to have one implementation of it?

25条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-14 02:38

    because you might end up having two or more in the future

    ADDITION After reading some of the comments: Object mocking: this would imply that you WOULD have more than one implementation of your interface, yoru mock IS another implementation.

提交回复
热议问题