interface names

Recently I've been experimenting with interface names and pondering over the best way of naming them based on my progress into the realms of behaviour driven design.

I have been looking at making the names more about behaviour, so instead of the usual "IWhatIAm" (such as IDataRetriever) I've played with three patterns that I could choose from:

IWhatIAm
IWhatIDo
IWhatIAmAbleToDo

Let me give a hypothetical example:
I have a codebase that has a class to save order data, a class to catch the results of an asynchronous order process and one that can retrieve some order data.

Using the above interface naming patterns I could have:

IWhatIAm pattern (commonly used)

IOrderDataWriter orderDataWriter;
IOrderService orderService;
IOrderDataRetriever orderDataRetriever;

IWhatIDo

IWriteOrderData orderDataWriter;
ICatchOrdersService orderCatchingService;
IRetrieveOrderData orderDataRetriever;

IWhatIAmAbleToDo

ICanWriteOrderData orderDataWriter;
ICanCatchOrdersService orderCatchingService;
ICanRetrieveOrderData orderDataRetriever;

The behaviour style names definitely feel catchy and I've experimented with the last examples although I must admit that it has been unusual to see that interface name in a WCF url (for example). But it does convey more context and that's got to be a good thing right?



0 comments: