What is the rationale behind this naming convention?
I don't see any benefit. The extra prefix just pollutes the API.
My thinking is inline with Konrad's response to this related question; the chosen answer of which is mostly what I am asking for here.
Its the complete opposite, the naming convention clearly identifies an interface.
For example if you have:
public class Dog : IPet, IMammal { ....
Just from reading it, I can safely assume that IPet and IMammal are probably interfaces.
The .NET CLR allows for single class inheritance. So, if I have a base class..I can only inherit one class from it. Lets change the IPet interface to a base class..our example now becomes
public class Dog : Pet, IMammal { ....
I am inheriting from the Pet class and implementing the IMammal interface.
If we did it what you are suggesting and removed the letter "I" we have this:
public class Dog : Pet, Mammal { ....
Which one is the class I am inheriting from? Which is the interface I am implementing? It gets confusing right? (FYI..you are supposed to put the base class always first, so you could argue that point...but if you are arguing to remove the letter I from prefixing interface names I doubt you follow that practice as well)
As you can see that naming convention easily tells me a lot about my object without me having to investigate further. I can easily see what I am inheriting vs what I am implementing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With