Saturday, February 12, 2011

Need help choosing a name for an interface

I'm refactoring a number of classes in an application to use interfaces instead of base classes. Here's the interfaces I created so far:

  • ICarryable implemented by all Item objects
  • IActable implemented by all Actor objects
  • IUseable implemented by some Item sub-classes
  • IWieldable implemented by some Item sub-classes

You can see the major base-classes are still Item and Actor. These have a common interface in that they both are located on a Map, so they have a Location property. The Map shouldn't care whether the object is an Actor or an Item, so I want to create an interface for it. Here's what the interface would look like

public interface IUnnameable {
    event EventHandler<LocationChangedEventArgs> LocationChanged;
    Location Location { get; set; }
}

That's no problem, but I can't think of what to call this interface. IMappable comes to mind by seems a bit lame. Any ideas?

  • Sounds like an ILocateable. Something whose location you can discover and track.

    • ILocatable
    • IGeo
    • IAmSomewhere
    • IIsSomewhere
    Mark A. Nicolosi : @BCS, seems you've beat Matt to ILocateable. I like it so far, but I'll see if something better comes along before I mark your answer as accepted. I do like ILocateable, though :)
    BCS : @Mark Matt got to it first... (sort by oldest)
    Matt Hamilton : Geez it must've been tight though. I don't mind if you mark BCS' as the answer.
    Matt Cruikshank : Drats - darn you Matt Hamilton! I swear I didn't see yours first. Sounds like there are at least two votes for it. :-)
    Mark A. Nicolosi : @BCS, You're right, I must have looked at it the other way around. I've already voted you both up though :)
    From BCS
  • I'd just use LOLCats notation.

    ICanHasLocation

    or maybe

    IHasLocation

    or the absurd

    ImInYourProgramHavingALocation

    Oh, and by the way - there's at least one Duck Typing library for C#, which is a pretty cool concept.

    Mark A. Nicolosi : Neat library, although, I don't believe its needed for this. I think I like IHasLocation the most, but I'm going to choose ILocateable to be consistent with some of the other interface names in my project. Thanks ;)
  • IWhereYouAtable - Boost mobile

    ITwentyable - as in what's your 20 (short for 10-20 - CB slang)

    seriously though ILocateable is good.

    From Hafthor

0 comments:

Post a Comment