on the last Friday I gave a talk, just after Andrea Saltarello’s one, on WCF Services design guidelines at Venezia Mestre for Xe.Net user group. As all the other times it has been a wonderful experience, Xe.Net guys are simply great!
I’ve just uploaded the slide deck to slideshare, but I want to add some details on a comment made by Davide Vernole:
At a certain point I said that generalization at the service contract level is evil. We can summarize the statement with this really trivial sample:
[ServiceContract]
public interface IService
{
    [OperationContract]
    void Save( DomainEntity entity );
}
The main pain point, from a DDD point of view, in that trivial sample (and a bit extreme) is that you completely loose context and intent, save in the user mental model, generally, does mean nothing.
Davide simply said that he does not agree, saying that he is used to generalize, WCF services contracts, using a messaging based approach…does it sound familiar? I love that approach! (sorry it’s in Italian)
In that talk there is this slide, jumped only due to time constraint:
image
Let me say that messaging at the service level is not generalization, well not the type of generalization that must be defined evil Smile
It is one of the coolest pattern to approach WCF, from my point of view, that let you to move from the RPC style, imposed by WCF, to a message based style. Basically something, trivially, like this:
[ServiceContract]
public interface IMessageBrokerService
{
    [OperationContract]
    MessageResponse[] Dispatch( MessageRequest[] requests );

    [OperationContract]
    void Broadcast( MessageRequest[] requests );
}
This is a really huge and wide generalization, but absolutely you do not loose the intent, because the service intent is really clear, and the application intent is moved at the message level:
[DataContract]
public class CreateNewCustomerCommand : MessageRequest
{
    //bla...bla...bla...
}
The message intent is crystal clear, nothing can lead to misunderstanding.
.m