Who Am I ?

I’ve just created an interface named:

/// <summary>
/// Defines an object which support xml representation in the system.
/// </summary>
public interface ISupportXmlFormat
   /// <summary>
   /// Return the object representation as xml string.
   /// </summary>
   /// <returns>Xml string</returns>
   string ToXml();

I know, this is a silly name but it made me laugh quite a bit so I thought to share with you my geeky sense of humor ;-)

It is hard sometimes to think about a good name for an interface. I general, I follow Roy Osherove‘s Interface naming guidelines and name my interfaces by their purpose or “what can be done to them”.

Do you have a better name to suggest ?


Oren Ellenbogen


8 thoughts on “Who Am I ?

  1. I think you should probably name interfaces the same way you name classes – according to what they do and not what can be done to them (tough it is sometimes hard to tell the difference…).

    The first thing I would think of if I saw an interface named "ISupportXmlFormat" is some sort of IO object that can read or write in Xml Format…

    In your case I would choose something like "ProvidesXmlRepresentation" (or "IProvideXmlRepresentation" if I must…)

    Which reminds me of an interface I saw a while ago named "DataProvider", it had only one method called "ProvideData" – this is probably as abstract as you can get…

  2. In extension of Justin-Josef’s comment: How about using the provided framework for xml serialization (System.Xml.Serialization) and maybe even the IXmlSerializable interface that resides in the namespace?

    If you need to apply a custom interface, I disagree slightly with Justin-Josef. In my opinion it seems ambigous to chosse the exact same name as the interface in the framework. On the other hand IXmlSaveable does not sound like something i would like to eat … ;)

  3. I have a interface called:

    IHaveNameAndId – I really like that

    But most often I ignore the I as a prefix and use things like:

    IRule, IValidable, ISecurable

  4. @Justin and Eran
    IXmlSerializable is, in my opinion, not a great name in this scenario. I agree with Jorn, it will cause too much confusion to the standard programmer. They will think that you can serialize\deserialize objects that implement this interface and that is not the case.

    IProvideXmlRepresentation was my second choice but I prefer Pasha’s IXmlFormattable a little more.

    IXmlFormatter makes you think that an object which implement this interface can format other objects and that is not the case. Therefore I’ll go with Pasha’s suggestion

    You’re a funny guy. IRule… ISecurable… this is good stuff :)

    You are implementing IRock !

    Thanks guys!

Comments are closed.