Saturday, June 4, 2011

This is no Domain Service

After reading this blog entry about why and how to use the command processor pattern in your service layer. While the blog post is worth reading a code example provided by Ian made me think.

public class MyFatDomainService
{
    public void CreateMyThing(CreateMyThingCommand createMyThingCommand)
    {
        /*Stuff*/
    }

    public void UpdateMyThingForFoo(FooCommand fooHappened)
    {
       /*Other Stuff*/
    }

     public void UpdateMyThingForBar(BarCommand barHappened)
     {
        /*Other Stuff*/
     }

     /*Loads more of these*/
}

The service signature looks more than a repository, we have these CRUD methods with the "create" and "update" prefix.

Is this a domain service? I don't think so...

My suggestions is to step back and ask yourself whether you need all this "best practice"/layered architecture/DDD stuff when providing API methods like create, update and delete? Are you building the next excel like business tool creating and updating cells and rows while doing a couple of validations on the input object?

And in case you really identify a domain service give the methods some semantic names :)

8 comments:

  1. Domain services are Windows Communication Foundation (WCF) services that encapsulate the business logic of a WCF RIA Services application. A domain service exposes a set of related operations in the form of a service layer. When you define a domain service, you specify the data operations that are permitted through the domain service.

    ReplyDelete
  2. Register web Domain is a good and very cheap web hosting company in India. They provide affordable and reliable hosting services in India.indian web hosting companies

    ReplyDelete
  3. Thanks for such a nice and updated information.Very long time i am searching this type of the information keep sharing more post,keep up your good work..Web hosting forum

    ReplyDelete
  4. Very interesting blog. A lot of blogs I see these days don't really provide anything that attract others, but I'm most definitely interested in this one. Just thought that I would post and let you know.

    ReplyDelete
  5. I really appreciate your professional approach. These are pieces of very useful information that will be of great use for me in future.

    ReplyDelete
  6. This is the precise weblog for anybody who needs to seek out out about this topic. You notice so much its almost arduous to argue with you. You positively put a brand new spin on a subject that's been written about for years. Nice stuff, simply nice!

    ReplyDelete
  7. Very informative, keep posting such good articles, it really helps to know about things.

    ReplyDelete
  8. I wish to say that this post is awesome, nice written and include almost all important info’s. I’d like to see more posts like this.

    ReplyDelete