#/* Appearance mode: Provides a unified interface for external calls and extracts the methods needed in other classes
# * out, called by the skin class. The skin class is then instantiated in the call segment to indirectly invoke the required
# * method. This approach is similar to the proxy model. However, according to the Dimitri Law, the agent
# * Patterns should be proxied as much as possible for a single object. And the appearance pattern is more like extracting from many classes.
# * A useful method to combine into a new class */
Class Invoke1:
def methon1 (self):
print ' Call 1 '
Class Invoke2:
def methon2 (self):
print ' Call 2 '
Class Invoke3:
def methon3 (self):
print ' Call 3 '
Class FACDE:
def __init__ (self):
SELF.A = Invoke1 ()
self.b = Invoke2 ()
SELF.C = Invoke3 ()
def unit1 (self):
Self.a.methon1 ()
Self.b.methon2 ()
Self.c.methon3 ()
def unit2 (self):
Self.a.methon1 ()
Self.b.methon2 ()
if __name__ = = "__main__":
FACDE = FACDE ()
Facde.unit1 ()
Facde.unit2 ()
Python design mode (9)-Appearance mode