Csharp/CSharp Tutorial/Design Patterns/Facade Pattern — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 12:17, 26 мая 2010

Facade Patterns

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() {;}
  }