4 Comments

  • I also agree that the I prefix for interface naming is a positive thing.

    Concerning the example you gave about UserManager in the Java world it is not necessarely a bad thing to name the interface UserManager but class that implement these interfaces should have a more concrete name

    Eg:

    ActiveDirectoryUserManager : UserManager
    DatabaseUserManager : UserManager

    Therefore UserManagerImp : UserManager is bad naming convention and could indicate that the name for the interface is poorly chosen.

  • Microsoft already covers this issue in quite a bit of detail. We already have a standard as outlined by MS and it advises the use of "I".

    One would have to present compelling reason beyond "taste" to throw the standard in the bin.

  • I dislike the "I" prefix for interfaces; it shouldn't really matter whether something that is passed by pointer or reference is an interface or a concrete class. The only time it matters is when you have a value class that should be copied rather than referenced.

    I prefer to name the interface after the role that it takes, so "UserManager" is a good name. Calling the implementation "UserManagerImp" is just poor naming, but so is having the implementation of "IUserManager" being called "UserManager". In neither case does it say anything about what's special about this particular implementation.

    As Gabriel suggests, "ActiveDirectoryUserManager" and "DatabaseUserManager" are much better names, regardless whether or not the interface has an "I" prefix.

  • Regarding the implementation example of UserManagerImp, how about UserManagerClass or clsUserManager (as some VB guys do...)? :-)

    Cringeworthy...

    The specifics of a class implementation of an particular interface should be contained in the class name, whereas the interface name should really be about the generic and common functionality that all the implemented classes share.

Comments have been disabled for this content.