开发者

Is there a standard naming convention for implementations of interfaces that seem standard/default?

开发者 https://www.devze.com 2023-02-21 06:11 出处:网络
Trying to code to an interface so that unit testing and d开发者_如何学运维esign are better. Some things that I am coding doesn\'t seem to have any other implementation other than the obvious one. Is t

Trying to code to an interface so that unit testing and d开发者_如何学运维esign are better. Some things that I am coding doesn't seem to have any other implementation other than the obvious one. Is there a naming convention for this?


If you've only got one implementation, why not name your interface after it? You can always refactor the name later, if a second implementation comes along.

Most of the time, we do name our interfaces after the implementation that inspired them. If we then find that we get a second implementation of that interface, we'll either rename the original implementation to be more specific or rename the interface to be more general.

0

精彩评论

暂无评论...
验证码 换一张
取 消