Facade Patterns : Facade Pattern « Design Patterns « C# / CSharp Tutorial






using System;

  public class Client{
    static void Main(string[] args){
      SoftwareRepresentative gopher = new SoftwareRepresentative();
      gopher.BuildSoftware();
    }
  }
  public class SoftwareRepresentative{
    private TestSystem test;
    private DeploySystem deploy;
    private CodeSystem code;
    private DesignSystem design;
    
    public void BuildSoftware(){
       this.test.DoTest();
       this.deploy.DoDeploy();
         this.code.DoCode();
         this.design.DoDesign();
    }
    
    public SoftwareRepresentative()
    {
      test  = new TestSystem();
      deploy  = new DeploySystem();
      code  = new CodeSystem();
      design  = new DesignSystem();
    }
  }
  public class TestSystem
  {
    
    public void DoTest()
    {
      Console.WriteLine ("test.");
    }
    public TestSystem(){;}
  }
  public class DeploySystem
  {
    
    public void DoDeploy()
    {
      Console.WriteLine("deploy.");
    }
    
    public DeploySystem(){;}
  }
  public class CodeSystem
  {
    
    public void DoCode()
    {
      Console.WriteLine("code.");
    }
    
    public CodeSystem(){;}
  }
  public class DesignSystem
  {
    
    public void DoDesign()
    {
      Console.WriteLine("design.");
    }
    
    public DesignSystem() {;}
  }








28.5.Facade Pattern
28.5.1.Facade Patterns