Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > BOOK: Professional ASP.NET Design Patterns
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 24th, 2011, 09:58 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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?
Reply With Quote
  #2 (permalink)  
Old October 24th, 2011, 12:12 PM
elbandit's Avatar
Wrox Author
Points: 569, Level: 8
Points: 569, Level: 8 Points: 569, Level: 8 Points: 569, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2007
Location: Southsea, Portsmouth, Hampshire, United Kingdom.
Posts: 104
Thanks: 11
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
Reply With Quote
  #3 (permalink)  
Old October 24th, 2011, 12:15 PM
elbandit's Avatar
Wrox Author
Points: 569, Level: 8
Points: 569, Level: 8 Points: 569, Level: 8 Points: 569, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2007
Location: Southsea, Portsmouth, Hampshire, United Kingdom.
Posts: 104
Thanks: 11
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
Reply With Quote
  #4 (permalink)  
Old October 25th, 2011, 07:58 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 03:53 AM
can i use method and datatypes if we inherite base jaychandra_1983 C# 2005 1 December 18th, 2006 03:30 AM
Difference between Entity and Entity type arshad mahmood C++ Programming 0 May 8th, 2004 12:34 AM



All times are GMT -4. The time now is 08:03 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.