What's hot ? (and I mean really ...) - scroll down for more
1).  Code Templating - advanced usage of delegates & generics: my slides & demos are available for download! CodeProject article is also available.

2).  My series "TDD in the eyes of a simpleminded" is in progress(including code!): preface, part1, part2, Q&A 1, Manual Stub .vs. Mock Stub

3).  TDD Workshop: SeeCompass v0.1 and v0.2 are out.
# Tuesday, June 27, 2006

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 ?

Tuesday, June 27, 2006 9:53:41 PM (Jerusalem Standard Time, UTC+02:00)
IXmlSerializable would be a good choice (since that's what the interface does).
Tuesday, June 27, 2006 9:57:35 PM (Jerusalem Standard Time, UTC+02:00)
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...
Yoni
Tuesday, June 27, 2006 10:55:57 PM (Jerusalem Standard Time, UTC+02:00)
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 ... ;)
Wednesday, June 28, 2006 12:25:02 AM (Jerusalem Standard Time, UTC+02:00)
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
Wednesday, June 28, 2006 1:20:05 AM (Jerusalem Standard Time, UTC+02:00)
I think the standard translation would be IXmlFormattable.
Pasha
Wednesday, June 28, 2006 4:42:00 PM (Jerusalem Standard Time, UTC+02:00)
mate,
I think about something like IXmlFormatter

Dror Engel
Wednesday, June 28, 2006 6:13:19 PM (Jerusalem Standard Time, UTC+02:00)
IXmlSerializeable
Friday, June 30, 2006 3:39:39 AM (Jerusalem Standard Time, UTC+02:00)
@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.


@Yoni
IProvideXmlRepresentation was my second choice but I prefer Pasha's IXmlFormattable a little more.

@Dror
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

@Ayende
You're a funny guy. IRule... ISecurable... this is good stuff :)

@Pasha
You are implementing IRock !


Thanks guys!
Comments are closed.