Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Patterns, Principles and Practices of Domain-Driven Design
This is the forum to discuss the Wrox book Patterns, Principles and Practices of Domain-Driven Design by Scott Millett; ISBN: 978-1-118-71470-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Patterns, Principles and Practices of Domain-Driven Design 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 April 15th, 2017, 05:25 PM
Registered User
Points: 29, Level: 1
Points: 29, Level: 1 Points: 29, Level: 1 Points: 29, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Question Ch16 Designing for Distribution

What does Customer class looks like for the designing for distribution?

Below is the code sample provided with the book, but I cannot see the new version of Customer class.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PPPDDDChap17.Entities.Examples
{
    namespace BloatedCustomer
    {
        public class Customer
        {
            public Customer(Guid id, AddressBook addresses, Orders orderHistory, PaymentDetails paymentDetails, LoyaltySummary loyalty)
            {
                this.Id = id;
                this.Addresses = addresses;
                this.OrderHistory = orderHistory;
                this.PaymentDetails = paymentDetails;
                this.Loyalty = loyalty;
            }

            public Guid Id { get; private set;}

            public AddressBook Addresses { get; private set; }

            public Orders OrderHistory { get; private set; }

            public PaymentDetails PaymentDetails { get; private set; }

            public LoyaltySummary Loyalty { get; private set; }
        }
    }

    namespace DistributionAwareCustomer
    {
        namespace MarketingBoundedContext
        {
            public class Loyalty
            {
                // ..

                public Guid CustomerId { get; private set; }

                public LoyaltySummary Loyalty { get; private set; }

                // ..
            }
        }

        namespace AccountsBoundedContext
        {
            public class CustomerOrderHistory
            {
                // ..

                public Guid CustomerId { get; private set; }

                public Orders Orders { get; private set; }

                // ..
            }
        }

        namespace BillingBoundedContext
        {
            public class PaymentDetails
            {
                public Guid CustomerId { get; private set; }

                public CardDetails Default { get; private set; }

                public CardDetails Alternate { get; private set; }

                // ..
            }
        }

    }

    // Classes below are bare minimum to support example of Customer above spanning multiple contexts

        public class AddressBook
        {
            public Address Home { get; private set; }

            public Address Work { get; private set; }

            // ..
        }

        public class Address {}

        public class Orders
        {
            private IEnumerable<Order> orders;

            public Orders(IEnumerable<Order> orders)
            {
                this.orders = orders;
            }

            // ..
        }

        public class Order
        {
            public Guid Id { get; private set; }

            // ..
        }

        public class PaymentDetails
        {
            public CardDetails DefaultPayment { get; private set; }

            public CardDetails AlternatePayment { get; private set; }
        }

        public class CardDetails
        {
            public Guid Id { get; private set;}

            public string Number { get; private set; }

            public string SecurityCode { get; private set; }
        }

        public class LoyaltySummary
        {
            public LoyaltyStatus Status { get; private set; }

            public int Points { get; private set; }
        }

        public enum LoyaltyStatus
        {
            Gold,
            Silver,
            Bronze
        }

}
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
Can't seem to logout - CH16 Corewave BOOK: Professional ASP.NET 4 : in C# and VB 1 February 21st, 2012 10:13 AM
Can't seem to logout - CH16 Corewave BOOK: Beginning ASP.NET 4 : in C# and VB 1 February 20th, 2012 10:10 PM
Distribution scandalous Access 1 March 23rd, 2007 08:41 AM
Ch16 PasswordRecovery won't email smiller BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 October 11th, 2006 04:59 PM
view forum in ch16?!! the world BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 December 22nd, 2005 08:28 AM



All times are GMT -4. The time now is 04:28 AM.


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