软件研发公司,外观设计模式(Facade)

一个研发公司就如外观设计模式,它有诸多开发团队(子系统),前端开发团队,程序开发团队,数据库开发团队,测试团队等等。
为各个开发团队能高度协调,公司定义一个协调接口,使得各个开发团队更加协调。

前端开发团队:

FrontEndDevelopmentTeam
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;



/// <summary>

/// Summary description for FrontEndDevelopmentTeam

/// </summary>

namespace Insus.NET

{

    public class FrontEndDevelopmentTeam

    {

        public FrontEndDevelopmentTeam()

        {

            //

            // TODO: Add constructor logic here

            //

        }



        public void FrontEndDev()

        {

            HttpContext.Current.Response.Write("前端开发...");

        }

    }

}


程序开发团队:

ProgramDevelopmentTeam
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;



/// <summary>

/// Summary description for ProgramDevelopmentTeam

/// </summary>

namespace Insus.NET

{

    public class ProgramDevelopmentTeam

    {

        public ProgramDevelopmentTeam()

        {

            //

            // TODO: Add constructor logic here

            //

        }



        public void ProgramDev()

        {

            HttpContext.Current.Response.Write("程序开发...");

        }

    }

}


数据库开发团队:

DatabaseDevelopmentTeam
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;



/// <summary>

/// Summary description for DatabaseDevelopmentTeam

/// </summary>

namespace Insus.NET

{

    public class DatabaseDevelopmentTeam

    {

        public DatabaseDevelopmentTeam()

        {

            //

            // TODO: Add constructor logic here

            //

        }



        public void DatabaseDev()

        {

            HttpContext.Current.Response.Write("数据库开发...");

        }

    }

}


测试团队:

TestTeam
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;



/// <summary>

/// Summary description for TestTeam

/// </summary>

namespace Insus.NET

{

    public class TestTeam

    {

        public TestTeam()

        {

            //

            // TODO: Add constructor logic here

            //

        }



        public void Testing()

        {

            HttpContext.Current.Response.Write("测试...");

        }

    }

}


研发公司(外观类Facade):

SoftwareDevelopmentCompany
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;



/// <summary>

/// Summary description for SoftwareDevelopmentCompany

/// </summary>

namespace Insus.NET

{

    public class SoftwareDevelopmentCompany

    {

        FrontEndDevelopmentTeam objFrontEndDevelopmentTeam;

        ProgramDevelopmentTeam objProgramDevelopmentTeam;

        DatabaseDevelopmentTeam objDatabaseDevelopmentTeam;

        TestTeam objTestTeam;



        public SoftwareDevelopmentCompany()

        {

            objFrontEndDevelopmentTeam = new FrontEndDevelopmentTeam();

            objProgramDevelopmentTeam = new ProgramDevelopmentTeam();

            objDatabaseDevelopmentTeam = new DatabaseDevelopmentTeam();

            objTestTeam = new TestTeam();

        }



        public void DevelopmentAndOperation()

        {

            objFrontEndDevelopmentTeam.FrontEndDev();

            objProgramDevelopmentTeam.ProgramDev();

            objDatabaseDevelopmentTeam.DatabaseDev();

            objTestTeam.Testing();

        }

    }

}


asp.net网页运行:

FacadeDemo.aspx.cs
using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using Insus.NET;



public partial class FacadeDemo : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        SoftwareDevelopmentCompany objSoftwareDevelopmentCompany = new SoftwareDevelopmentCompany();

        objSoftwareDevelopmentCompany.DevelopmentAndOperation();

    }

}

  

你可能感兴趣的:(Facade)