Data Transfer Objects in Domain-Driven Design Patterns

Data Transfer Object. A simple pattern for exchanging information between the Presentation Layer and the Service Layer.

The basics are explained in lots of articles all over the web, but there are some details that are not so obvious. I implemented DTOs following my instincts, but I always had the feeling I was asuming things and not doing it well.

That’s whay I keep on asking about the insights of patterns like this.

I found a very interesting article about DTOs by Bozhidar. I recommend you to read it because it gives several hints and advices on how to use this pattern sucessfully.

Bozho’s tech blog – On DTOs

The last part I want to notice is the question I posted. As you see, Bozher was really kind and answered really quick.



4 thoughts on “Data Transfer Objects in Domain-Driven Design Patterns

    1. Súper JMN

      Thanks for your comment! Fixed 🙂 By the way, I’m thinking about writing a series of articles about patterns that are used in Domain Driven Design. I think the next one will be the Value-Object. Have you worked with NHibernate or Entity Framework?


      1. Súper JMN

        By the way, one question:
        I ever wondered how to add a relationship from entity to another in the Service layer. For example: Adding a Payment to a User.

        * paymentService.makePayment(userId, paymentDto)?

        * paymentService.makePayment(userDto, paymentDto)?

        * userService.makePayment(userId, paymentDto)?

        What one, if any, sounds good to you? Is passing Ids to methods a good practice? Shouls a service retrieve DTOs or entities from the model?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s