On naming interfaces

Just about every programming book or OOP example I look at has the annoying habit of prefixing interface names with an I. Yes, IInterface, ICar, IWallet, IMoney, IIAmStupid. It’s one of my pet peeves, I admit, but every time I come across code like this I find myself suppressing murderous tendencies.

Why oh why would you do this? “To clearly indicate that it’s an interface”. Why the hell do I need to know that it’s an interface in the first place? If I want to use your library, I really don’t give a toss whether I’m talking to an interface or a concrete class. If I do want to know (because I’m extending or initialising it) then I’m quite capable of figuring out for myself whether I’m dealing with an interface, abstract class or concrete class. The only thing this random I does is make it harder to look for suitable classes. I want to search for Car, or Wallet, or Money. Not to mention that I don’t want to type that extra letter every single time I’m assigning an instance to a variable.

Seriously, how ugly is this

IFoo foo = IFooFactory.createIFoo();

The irony here is that I used “I” 32 times in this post. But for crying out loud, pick a meaningful name, not some silly prefixed monstrosity.

— Elric