Appearance mode is a structural pattern
Overview: Provides a consistent interface for a set of interfaces in a subsystem that defines a high-level interface that makes this subsystem easier to use
The appearance mode is to let client clients in a simple way to invoke the more complex system to accomplish one thing;
Objective:
1. Provide a simple interface for a complex subsystem
2. Reduce the coupling between the client and the subsystem
Personal examples:
1 buy hand-picked cakes
namespace Haibao\design\web\view\design;
Use Haibao\design\web\common\design\adapter\translator;
Class Facade extends \haibao\design\web\view\base{
protected function PreRender () {
Header ("content-type:text/html; Charset=utf-8 ");
$facade = new \haibao\design\web\common\design\facade\facade ();
$facade->facade1 ();
Echo '
';
$facade->facade2 ();
}
}
/**
* Boss's hand-grasping cookies
*/
namespace Haibao\design\web\common\design\facade;
Class facade{
Public $object 1;
Public $object 2;
Public $object 3;
Public Function __construct () {
$this->object1 = new subsystem1;//cake
$this->object2 = new SubSystem2; Brush will
$this->object3 = new SubSystem3; Add a bowel.
}
Public Function Facade1 () {
$this->object1->getmessage ();
$this->object2->getmessage ();
}
Public Function Facade2 () {
$this->object2->getmessage ();
$this->object3->getmessage ();
}
}
/**
* Sub-class
*/
namespace Haibao\design\web\common\design\facade;
Class subsystem1{
Public Function GetMessage () {
Echo ' subsystem 1 ';
}
}
/**
* Sub-class
*/
namespace Haibao\design\web\common\design\facade;
Class subsystem2{
Public Function GetMessage () {
Echo ' Subsystem 2 ';
}
}
/**
* Sub-class
*/
namespace Haibao\design\web\common\design\facade;
Class subsystem3{
Public Function GetMessage () {
Echo ' Subsystem 3 ';
}
}