forked from onionmccabbage/beyondAdvancedPythonApril2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_facade.py
58 lines (50 loc) · 1.53 KB
/
my_facade.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# facade hides complexity behind an interface (the facade)
class Coder(object):
def __init__(self):
print('Bring coding skills')
def __isAvailable__(self):
print('coding skills are available')
return True
def bookTime(self):
if self.__isAvailable__():
print('coder booking made\n')
class Tester(object):
def __init__(self):
print('Preparing test')
def testing(self):
print('tests are in place')
class Artisan(object):
def __init__(self):
print('Designing Stuff')
def makePrototype(self):
print('prototyes are ready')
class Technician(object):
def __init__(self):
print('sound and vision for the team')
def doStuff(self):
print('PA project, virtual fridge')
# the facade
class Manager(object):
def __init__(self):
print('manager says: I can arrange the team')
def arrange(self):
self.tester = Tester()
self.tester.testing()
self.technician = Technician()
self.technician.doStuff()
self.coder = Coder()
self.coder.bookTime()
self.artisan = Artisan()
self.artisan.makePrototype()
class You(object):
def __init__(self):
print('we need a team...')
def askManager(self):
print('lets contact the manager')
m = Manager()
m.arrange()
def __del__(self):
print('all done')
if __name__ == '__main__':
you = You()
you.askManager()