EN: The client code is supposed to work with all objects (both subjects and proxies) via the Subject interface in order to support both real subjects and proxies. In real life, however, clients mostly work with their real subjects directly. In this case, to implement the pattern mor
(subject: Subject)
| 87 | |
| 88 | |
| 89 | def client_code(subject: Subject) -> None: |
| 90 | """ |
| 91 | EN: The client code is supposed to work with all objects (both subjects and |
| 92 | proxies) via the Subject interface in order to support both real subjects |
| 93 | and proxies. In real life, however, clients mostly work with their real |
| 94 | subjects directly. In this case, to implement the pattern more easily, you |
| 95 | can extend your proxy from the real subject's class. |
| 96 | |
| 97 | RU: Клиентский код должен работать со всеми объектами (как с реальными, так |
| 98 | и заместителями) через интерфейс Субъекта, чтобы поддерживать как реальные |
| 99 | субъекты, так и заместителей. В реальной жизни, однако, клиенты в основном |
| 100 | работают с реальными субъектами напрямую. В этом случае, для более простой |
| 101 | реализации паттерна, можно расширить заместителя из класса реального |
| 102 | субъекта. |
| 103 | """ |
| 104 | |
| 105 | # ... |
| 106 | |
| 107 | subject.request() |
| 108 | |
| 109 | # ... |
| 110 | |
| 111 | |
| 112 | if __name__ == "__main__": |