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 October 24th, 2011, 09:58 AM
Registered User
 
Join Date: Jul 2011
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Validate Method on Base Entity

Scott,

Another developer made this comment referring to your use of a Validate() method on the base Entity class:

Quote:
Just the fact that you have a Validate() method on the entity means that you can mutate it into an invalid state. You should NEVER be able to mutate an entity to an invalid state.
Any insight/comments regarding this?
 
Old October 24th, 2011, 12:12 PM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Hi getoutofmylaboratory,

I wrote the book around 2 years ago now and since my views on validation and DDD have changed a bit. I agree that domain entities shouldn't be able to get into an invalidate state and where possible I try and use immutable vlaue objects that have to be valid on construction. I also try not to use getters and setters and prefer methods that map to business user cases to ensure an always valid entitiy state.


Cheers
Scott
 
Old October 24th, 2011, 12:15 PM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

I have a git hub account https://github.com/elbandit where I have been working on a number of code katas (TicTacToe and Minesweeper) to demonstrate how I am implementing DDD since writing the book that maybe of intrest to you.

Cheers
Scott
 
Old October 25th, 2011, 07:58 AM
Registered User
 
Join Date: Jul 2011
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for the reply! I will be checking out the code samples made available.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Workflow Validate Method Question Corsair BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio 2 April 21st, 2009 12:31 PM
character entity into numeric character entity srkumar XSLT 1 November 22nd, 2007 04:53 AM
can i use method and datatypes if we inherite base jaychandra_1983 C# 2005 1 December 18th, 2006 04:30 AM
Difference between Entity and Entity type arshad mahmood C++ Programming 0 May 8th, 2004 12:34 AM





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