The trouble with large enterprises is that... well, they're large, and that means that they are made up of smaller departments, and these departments may have a different "view" of the same business entity. For example, the billing department's view of a Customer is going to be different from the sales department's view.

So, what happens if you are in the sales department and you have to use a Customer object built by the billing department? I mean, you can't change the interface of the class, otherwise you will break it for the billing department, and you don't want to create another version of a Customer, otherwise where would it end, you could have dozens of Customer classes in the enterprise. No, what you want to do is to implement the Adaptor Pattern.

The Adaptor Pattern uses an intermediary class to transform the implementation of one interface into an implementation of another interface.

The UML diagram for this pattern looks like this

And the implementation looks something like this

using System;
using System.Collections.Generic;
using System.Text;

namespace garyshort.org.patterns.adaptor
{
    //Define a Customer interface
    public interface ICustomerOld
    {
        string GetName();
        string GetAddress();
        string GetEmail();
        DateTime GetLastOrderedDate();
        string GetCreditRating();
    }
   
   
    //Define a Customer to implement the interface
    public class Customer : ICustomerOld
    {
        private string _Name;
        private string _Address;
        private string _Email;
        private DateTime _LastOrderedDate;
        private string _CreditRating;

        public Customer(string name, string address,
            string email, DateTime lastOrderedDate,
            string creditRating)
        {
            _Name = name;
            _Address = address;
            _Email = email;
            _LastOrderedDate = lastOrderedDate;
            _CreditRating = creditRating;
        }

        public string GetName()
        {
            return _Name;
        }

        public string GetAddress()
        {
            return _Address;
        }

        public string GetEmail()
        {
            return _Email;
        }

        public DateTime GetLastOrderedDate()
        {
            return _LastOrderedDate;
        }

        public string GetCreditRating()
        {
            return _CreditRating;
        }
    }

    //Define an new interface that the customer
    //must now support
    public interface ICustomerNew
    {
        string CustomerName();
        string CustomerEmailAddress();
        bool HasGoodCreditRating();
    }

    //Define a class to adapt the old interface
    //to the new one
    public class AdaptedCustomer : ICustomerNew
    {
        private Customer _Customer;

        public AdaptedCustomer(Customer c)
        {
            _Customer = c;
        }
       
        public string CustomerName()
        {
            return _Customer.GetName();
        }

        public string CustomerEmailAddress()
        {
            return _Customer.GetEmail();
        }

        public bool HasGoodCreditRating()
        {
            return _Customer.GetCreditRating() == "GOOD";
        }
    }
   
    class Program
    {
        static void Main(string[] args)
        {
            //Let's test the pattern!

            //Create a customer object
            Customer c = new Customer("Gary Short",
                "My house in Scotland", "me@myhouse.com",
                DateTime.Now, "GOOD");

            //Show it implements the ICustomerOld interface
            StringBuilder sb = new StringBuilder();
            sb.AppendLine(c.GetName());
            sb.AppendLine(c.GetAddress());
            sb.AppendLine(c.GetEmail());
            sb.AppendLine(c.GetLastOrderedDate()
                .ToLongDateString());
            sb.AppendLine(c.GetCreditRating());
            Console.Write(sb.ToString());

            //Wrap the customer in the adaptor
            AdaptedCustomer ac = new AdaptedCustomer(c);

            //Show the adapted customer
            //implements ICustomerNew
            sb.Remove(0, sb.Length - 1);
            sb.AppendLine(ac.CustomerName());
            sb.AppendLine(ac.CustomerEmailAddress());
            sb.AppendLine(ac.HasGoodCreditRating()
                .ToString());
            Console.Write(sb.ToString());
           
            //Wait for the user to press a key before closing the
            //command window
            Console.WriteLine(Environment.NewLine +
                "Press any key to continue...");
            Console.Read();
        }
    }
}