MCPcopy Create free account
hub / github.com/RefactoringGuru/design-patterns-python / operation

Method operation

src/Facade/Conceptual/main.py:45–62  ·  view source on GitHub ↗

EN: The Facade's methods are convenient shortcuts to the sophisticated functionality of the subsystems. However, clients get only to a fraction of a subsystem's capabilities. RU: Методы Фасада удобны для быстрого доступа к сложной функциональности подсистем.

(self)

Source from the content-addressed store, hash-verified

43 self._subsystem2 = subsystem2 or Subsystem2()
44
45 def operation(self) -> str:
46 """
47 EN: The Facade's methods are convenient shortcuts to the sophisticated
48 functionality of the subsystems. However, clients get only to a fraction
49 of a subsystem's capabilities.
50
51 RU: Методы Фасада удобны для быстрого доступа к сложной функциональности
52 подсистем. Однако клиенты получают только часть возможностей подсистемы.
53 """
54
55 results = []
56 results.append("Facade initializes subsystems:")
57 results.append(self._subsystem1.operation1())
58 results.append(self._subsystem2.operation1())
59 results.append("Facade orders subsystems to perform the action:")
60 results.append(self._subsystem1.operation_n())
61 results.append(self._subsystem2.operation_z())
62 return "\n".join(results)
63
64
65class Subsystem1:

Callers 1

client_codeFunction · 0.45

Calls 3

operation_nMethod · 0.80
operation_zMethod · 0.80
operation1Method · 0.45

Tested by

no test coverage detected