Wrox Programmer Forums
|
BOOK: Professional ASP.NET Design Patterns
This is the forum to discuss the Wrox book Professional ASP.NET Design Patterns by Scott Millett; ISBN: 978-0-470-29278-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET Design Patterns section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2012, 04:31 PM
Registered User
 
Join Date: Nov 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trying to understand DTO justification

First off, awesome book. I've been waiting for a book like this to come along for a very long time.

While I was showing the "Millett Stack" to a coworker the other day I was asked about the justification for the DTOs and not letting the model bleed up to the UI. I couldn't remember why you did this so I went back to your book to look it up and couldn't find the justification. I think perhaps it's just so the UI layer is only dependent on the Service layer? Just kind of want to hear the formal explanation from the man himself. If you'd prefer to reference the book I'm fine with that as well. BTW, We're actually using EF code first (clean POCO) with EF layer separated in the repository layer within the stack.

Thanks for again for a great book!

Last edited by ludwigs3rd; February 22nd, 2012 at 04:34 PM..
 
Old February 25th, 2012, 06:03 AM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Hi ludwigs3rd,

Thanks for reading the book!

I cover ViewModels on page 349. Sometimes the UI needs to show a summary of different parts of the domain model. Passing back a full model for the UI would be too clunky, better to have a ViewModel specific to the view. If however you have a nice one to one mapping between the UI and the entity then you can just return the model. Does that answer your question?

I prefer now to follow the CQRS pattern and have a query service separate from my domain model to provide the ViewModels/Dtos for my views. This enables my domain model to only be concerned with enforcing business rules and not how it's displayed. This is something I will cover in my new book. I am on iPad at mo but will knock up a quick diagram when I'm home to show you what I mean.

Let me know if you want any more info or if you have any questions.

Cheers
Scott





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 5: justification.php DTackett BOOK: Beginning PHP 5.3 0 October 7th, 2010 10:48 PM
Please help me understand SeanDunn BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 3 November 14th, 2009 02:38 PM
I don't understand... jmsherry ASP.NET 2.0 Basics 17 July 23rd, 2007 12:28 PM
Full Justification through Text Box in VB2005/VB6 saurabh_diwan Visual Studio 2005 1 April 2nd, 2007 08:36 AM
I still do not understand aude_poullain ASP.NET 1.0 and 1.1 Basics 2 February 7th, 2007 09:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.