forked from Sean-Bradley/Design-Patterns-In-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfacade.py
More file actions
41 lines (30 loc) · 760 Bytes
/
facade.py
File metadata and controls
41 lines (30 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
Facade Design Pattern
"""
class SubSystemClassA:
@staticmethod
def method():
return "A"
class SubSystemClassB:
@staticmethod
def method():
return "B"
class SubSystemClassC:
@staticmethod
def method():
return "C"
# facade
class Facade:
def __init__(self):
self.sub_system_class_a = SubSystemClassA()
self.sub_system_class_b = SubSystemClassB()
self.sub_system_class_c = SubSystemClassC()
def create(self):
result = self.sub_system_class_a.method()
result += self.sub_system_class_b.method()
result += self.sub_system_class_c.method()
return result
# client
FACADE = Facade()
RESULT = FACADE.create()
print("The Result = %s" % RESULT)