8

What is the point of IHandleMessages<T> vs IMessageHandler<T> in NServiceBus 2.0?

One interface derives from the other and does not appear to add any new methods or new constraints on T. It is possible that one is a marker interface but there is no evidence for this in the comments.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Thomas Bratt
  • 48,038
  • 36
  • 121
  • 139

1 Answers1

9

The reason is that it follows the newer naming convention for interfaces in NServiceBus, where the name states explicitly what it does: IHandleMessages, IPersistSagas, IContainSagaData, etc. The letter 'i' at the beginning is the interface speaking of itself.

When taken together, these result in more readable code bases, if only slightly, but bring the language of the framework closer to that of the developer, thus decreasing the learning curve and friction of usage.

Udi Dahan
  • 11,932
  • 1
  • 27
  • 35
  • 7
    I don't exactly agree it decreases the learning curve. If anything, adds to complexity and confusion; hence, the very reason why Thomas is asking. I was in the very same situation. It took more time with Reflector and analysis to figure out what you were doing with both interfaces. – Brian Chavez Jan 26 '10 at 13:15
  • 2
    I understand, but I couldn't go and change the interface name without breaking compatibility with all existing code. – Udi Dahan Jan 27 '10 at 07:04
  • 7
    Udi, Maybe you should mark IMessageHandler with ObsoleteAttribute :) – John Simons May 17 '10 at 03:49
  • 2
    I also find it somewhat annoying, the amnt of info entropy gained with the first few letters of the type names also becomes minimal. It is like thumbing through a phonebook where everyone's name starts with "IWant", not very descriptive and pretty useless as an index, and the brain usually indexes this. – Alwyn May 17 '13 at 11:18