Game Development Reference
In-Depth Information
private class SubSystem3
{
public void DoSomethingSpecific()
{
MessageBox.Show(“Hello World #3”);
}
}
public class Facade
{
private SubSystem1 _subSystem1 = new SubSystem1();
private SubSystem2 _subSystem2 = new SubSystem2();
private SubSystem3 _subSystem3 = new SubSystem3();
public void DoSomething()
{
_subSystem1.DoSomethingSpecific();
_subSystem2.DoSomethingSpecific();
}
public void DoAnotherThing()
{
_subSystem1.DoSomethingSpecific();
_subSystem3.DoSomethingSpecific();
}
}
public class Client
{
public void Run(Facade facade)
{
facade.DoSomething();
facade.DoAnotherThing();
}
}
The façade pattern is quite useful when building new frameworks, but because this
chapter is mainly addressing cohesion issues between existing frameworks, the
adapter pattern is best suited for this problem.
Search Nedrilad ::




Custom Search