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 5th, 2013, 01:44 PM
Registered User
 
Join Date: Feb 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Post DDD Questions & Design Approach

Hi,

It's the first serious ASP.NET book I ever read. Recommended for each and every ASP.NET developer.

I am kind of new to the idea of DDD. How would I go about learning how to organize my model objects? Is there a way to think when creating such objects?

Thank you
 
Old February 5th, 2013, 01:54 PM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Create objects based around behaviour rather than nouns and verbs. For example don't create a customer because there is one in real life, instead look for behaviour and model that. In an e-commerce site you have a customer and she can subscribe to a newsletter. Instead of adding all of the behaviour for newsletter subscriptions onto a customer object model a NewsletterSubscriber object. Then perhaps Customer is just the personal details of a person placing an order.

Does that make sense?
 
Old February 5th, 2013, 02:00 PM
Registered User
 
Join Date: Feb 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I end up having a NewsletterSubscriber class having a property of type Customer to capture the Customer's Email for example?

The DDD book explains such concepts?

Thanks

Last edited by bhaidar; February 5th, 2013 at 02:04 PM..
 
Old February 5th, 2013, 02:19 PM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Maybe you end up with three objects, all built for a single purpose...

Code:
public class NewsletterSubscriber
{
   private int customer_id;
   private bool send_emails_on_offers;
   private bool share_my_info_with_other_companies;
  
}
Code:
public class ContactDetails
{
   private int customer_id;
   private string email;
   private string phone_number
  
}
Code:
public class PersonalDetails
{
   private int customer_id;
   private string first_name;
   private string family_name;
  
}
The objects all have a single reason to change and are focused on a single behaviour. All linked by a corrleation id, the 'customer_id' property. You see there is no 'customer', there is no spoon. :0)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Free DDD in C# .net book by Scott Millett (same author as ASP.NET Design Patterns) elbandit BOOK: Professional ASP.NET Design Patterns 4 August 26th, 2013 02:14 PM
Two Variable & Function optimization questions Asymmetricalman Book: Professional Flash Mobile Development: Creating Android and iPhone Applications 0 October 18th, 2012 05:44 PM
Questions about Inheritance & Polymorphism jimblanc Java Basics 1 December 31st, 2006 03:54 PM
I Need Interview Questions & Answers ... keyur_rhtdm .NET Framework 2.0 2 August 5th, 2006 10:55 AM
Design Questions trentrr182 BOOK: Expert One-on-One Access Application Development 0 December 6th, 2005 12:08 PM





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