Are there established alternatives to ISomething / ISomethingable for interfaces?

后端 未结 9 1982
囚心锁ツ
囚心锁ツ 2021-02-08 04:37

The .NET standard of prefixing an interface name with an I seems to be becoming widespread and isn\'t just limited to .NET any more. I have come across a lot of Java code that u

9条回答
  •  太阳男子
    2021-02-08 04:52

    I would just accept it, to be honest. I know what you mean about being a bit like Hungarian notation (or at least abuse of the same) but I think it gives sufficient value to be worth doing in this case.

    With dependency injection being in vogue, often I find I end up with an interface and a single production implementation. It's handy to make them easily distinguishable just with the I prefix.

    One little data point: I work with both Java and C# a fair amount, and I regularly find myself having to check which types in Java are actually interfaces, particularly around the collection framework. .NET just makes this simple. Maybe it doesn't bother other people, but it bothers me.

    +1 for IFoo from me.

提交回复
热议问题