Wrox Programmer Forums
|
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 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 April 15th, 2017, 04:25 PM
Registered User
 
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
        }

}





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 07: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 03: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





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