Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/RefactoringGuru/design-patterns-python
/ types & classes
Types & classes
95 in github.com/RefactoringGuru/design-patterns-python
⨍
Functions
212
◇
Types & classes
95
↓ 4 callers
Class
Leaf
EN: The Leaf class represents the end objects of a composition. A leaf can't have any children. Usually, it's the Leaf objects that do t
src/Composite/Conceptual/main.py:93
↓ 3 callers
Class
Composite
EN: The Composite class represents the complex components that may have children. Usually, the Composite objects delegate the actual work to
src/Composite/Conceptual/main.py:112
↓ 2 callers
Class
AlphabeticalOrderIterator
EN: Concrete Iterators implement various traversal algorithms. These classes store the current traversal position at all times. RU: Конк
src/Iterator/Conceptual/main.py:30
↓ 2 callers
Class
ConcreteStateA
src/State/Conceptual/main.py:102
↓ 2 callers
Class
Flyweight
EN: The Flyweight stores a common portion of the state (also called intrinsic state) that belongs to multiple real business entities. The
src/Flyweight/Conceptual/main.py:20
↓ 2 callers
Class
Singleton
src/Singleton/Conceptual/NonThreadSafe/main.py:42
↓ 2 callers
Class
Subsystem1
EN: The Subsystem can accept requests either from the facade or client directly. In any case, to the Subsystem, the Facade is yet another cli
src/Facade/Conceptual/main.py:65
↓ 2 callers
Class
Subsystem2
EN: Some facades can work with multiple subsystems at the same time. RU: Некоторые фасады могут работать с разными подсистемами одновременно
src/Facade/Conceptual/main.py:85
↓ 1 callers
Class
Abstraction
EN: The Abstraction defines the interface for the "control" part of the two class hierarchies. It maintains a reference to an object of the
src/Bridge/Conceptual/main.py:31
↓ 1 callers
Class
Adaptee
EN: The Adaptee contains some useful behavior, but its interface is incompatible with the existing client code. The Adaptee needs some ad
src/Adapter/Conceptual/class/main.py:26
↓ 1 callers
Class
Adaptee
EN: The Adaptee contains some useful behavior, but its interface is incompatible with the existing client code. The Adaptee needs some ad
src/Adapter/Conceptual/object/main.py:26
↓ 1 callers
Class
Adapter
EN: The Adapter makes the Adaptee's interface compatible with the Target's interface via multiple inheritance. RU: Адаптер делает интерф
src/Adapter/Conceptual/class/main.py:42
↓ 1 callers
Class
Adapter
EN: The Adapter makes the Adaptee's interface compatible with the Target's interface via composition. RU: Адаптер делает интерфейс Адапт
src/Adapter/Conceptual/object/main.py:42
↓ 1 callers
Class
Caretaker
EN: The Caretaker doesn't depend on the Concrete Memento class. Therefore, it doesn't have access to the originator's state, stored inside th
src/Memento/Conceptual/main.py:132
↓ 1 callers
Class
ComplexCommand
EN: However, some commands can delegate more complex operations to other objects, called "receivers." RU: Но есть и команды, которые дел
src/Command/Conceptual/main.py:48
↓ 1 callers
Class
Component1
src/Mediator/Conceptual/main.py:82
↓ 1 callers
Class
Component2
src/Mediator/Conceptual/main.py:92
↓ 1 callers
Class
ConcreteBuilder1
EN: The Concrete Builder classes follow the Builder interface and provide specific implementations of the building steps. Your program may ha
src/Builder/Conceptual/main.py:48
↓ 1 callers
Class
ConcreteClass1
EN: Concrete classes have to implement all abstract operations of the base class. They can also override some operations with a default imple
src/TemplateMethod/Conceptual/main.py:93
↓ 1 callers
Class
ConcreteClass2
EN: Usually, concrete classes override only a fraction of base class' operations. RU: Обычно конкретные классы переопределяют только час
src/TemplateMethod/Conceptual/main.py:110
↓ 1 callers
Class
ConcreteComponent
EN: Concrete Components provide default implementations of the operations. There might be several variations of these classes. RU: Конкр
src/Decorator/Conceptual/main.py:27
↓ 1 callers
Class
ConcreteComponentA
EN: Each Concrete Component must implement the `accept` method in such a way that it calls the visitor's method corresponding to the componen
src/Visitor/Conceptual/main.py:32
↓ 1 callers
Class
ConcreteComponentB
EN: Same here: visitConcreteComponentB => ConcreteComponentB RU: То же самое здесь: visitConcreteComponentB => ConcreteComponentB
src/Visitor/Conceptual/main.py:69
↓ 1 callers
Class
ConcreteCreator1
EN: Note that the signature of the method still uses the abstract product type, even though the concrete product is actually returned from th
src/FactoryMethod/Conceptual/main.py:79
↓ 1 callers
Class
ConcreteCreator2
src/FactoryMethod/Conceptual/main.py:95
↓ 1 callers
Class
ConcreteDecoratorA
EN: Concrete Decorators call the wrapped object and alter its result in some way. RU: Конкретные Декораторы вызывают обёрнутый объект и
src/Decorator/Conceptual/main.py:74
↓ 1 callers
Class
ConcreteDecoratorB
EN: Decorators can execute their behavior either before or after the call to a wrapped object. RU: Декораторы могут выполнять своё повед
src/Decorator/Conceptual/main.py:96
↓ 1 callers
Class
ConcreteFactory1
EN: Concrete Factories produce a family of products that belong to a single variant. The factory guarantees that resulting products are compa
src/AbstractFactory/Conceptual/main.py:43
↓ 1 callers
Class
ConcreteFactory2
EN: Each Concrete Factory has a corresponding product variant. RU: Каждая Конкретная Фабрика имеет соответствующую вариацию продукта.
src/AbstractFactory/Conceptual/main.py:63
↓ 1 callers
Class
ConcreteImplementationA
src/Bridge/Conceptual/main.py:92
↓ 1 callers
Class
ConcreteImplementationB
src/Bridge/Conceptual/main.py:97
↓ 1 callers
Class
ConcreteMediator
src/Mediator/Conceptual/main.py:34
↓ 1 callers
Class
ConcreteMemento
src/Memento/Conceptual/main.py:104
↓ 1 callers
Class
ConcreteObserverA
src/Observer/Conceptual/main.py:165
↓ 1 callers
Class
ConcreteObserverB
src/Observer/Conceptual/main.py:171
↓ 1 callers
Class
ConcreteProduct1
src/FactoryMethod/Conceptual/main.py:121
↓ 1 callers
Class
ConcreteProduct2
src/FactoryMethod/Conceptual/main.py:126
↓ 1 callers
Class
ConcreteProductA1
src/AbstractFactory/Conceptual/main.py:98
↓ 1 callers
Class
ConcreteProductA2
src/AbstractFactory/Conceptual/main.py:103
↓ 1 callers
Class
ConcreteProductB1
src/AbstractFactory/Conceptual/main.py:150
↓ 1 callers
Class
ConcreteProductB2
src/AbstractFactory/Conceptual/main.py:168
↓ 1 callers
Class
ConcreteStateB
src/State/Conceptual/main.py:112
↓ 1 callers
Class
ConcreteStrategyA
src/Strategy/Conceptual/main.py:110
↓ 1 callers
Class
ConcreteStrategyB
src/Strategy/Conceptual/main.py:115
↓ 1 callers
Class
ConcreteSubject
EN: The Subject owns some important state and notifies observers when the state changes. RU: Издатель владеет некоторым важным состояние
src/Observer/Conceptual/main.py:67
↓ 1 callers
Class
ConcreteVisitor1
src/Visitor/Conceptual/main.py:122
↓ 1 callers
Class
ConcreteVisitor2
src/Visitor/Conceptual/main.py:130
↓ 1 callers
Class
Context
EN: The Context defines the interface of interest to clients. It also maintains a reference to an instance of a State subclass, which represe
src/State/Conceptual/main.py:18
↓ 1 callers
Class
Context
EN: The Context defines the interface of interest to clients. RU: Контекст определяет интерфейс, представляющий интерес для клиентов.
src/Strategy/Conceptual/main.py:20
↓ 1 callers
Class
Director
EN: The Director is only responsible for executing the building steps in a particular sequence. It is helpful when producing products accordi
src/Builder/Conceptual/main.py:143
↓ 1 callers
Class
DogHandler
src/ChainOfResponsibility/Conceptual/main.py:93
↓ 1 callers
Class
ExtendedAbstraction
EN: You can extend the Abstraction without changing the Implementation classes. RU: Можно расширить Абстракцию без изменения классов Реа
src/Bridge/Conceptual/main.py:50
↓ 1 callers
Class
Facade
EN: The Facade class provides a simple interface to the complex logic of one or several subsystems. The Facade delegates the client requests
src/Facade/Conceptual/main.py:17
↓ 1 callers
Class
FlyweightFactory
EN: The Flyweight Factory creates and manages the Flyweight objects. It ensures that flyweights are shared correctly. When the client request
src/Flyweight/Conceptual/main.py:42
↓ 1 callers
Class
Invoker
EN: The Invoker is associated with one or several commands. It sends a request to the command. RU: Отправитель связан с одной или нескол
src/Command/Conceptual/main.py:101
↓ 1 callers
Class
MonkeyHandler
src/ChainOfResponsibility/Conceptual/main.py:77
↓ 1 callers
Class
Originator
EN: The Originator holds some important state that may change over time. It also defines a method for saving the state inside a memento and a
src/Memento/Conceptual/main.py:22
↓ 1 callers
Class
Product1
EN: It makes sense to use the Builder pattern only when your products are quite complex and require extensive configuration. Unlike in o
src/Builder/Conceptual/main.py:116
↓ 1 callers
Class
Proxy
EN: The Proxy has an interface identical to the RealSubject. RU: Интерфейс Заместителя идентичен интерфейсу Реального Субъекта.
src/Proxy/Conceptual/main.py:53
↓ 1 callers
Class
RealSubject
EN: The RealSubject contains some core business logic. Usually, RealSubjects are capable of doing some useful work which may also be very slo
src/Proxy/Conceptual/main.py:35
↓ 1 callers
Class
Receiver
EN: The Receiver classes contain some important business logic. They know how to perform all kinds of operations, associated with carrying ou
src/Command/Conceptual/main.py:83
↓ 1 callers
Class
SelfReferencingEntity
src/Prototype/Conceptual/main.py:4
↓ 1 callers
Class
SimpleCommand
EN: Some commands can implement simple operations on their own. RU: Некоторые команды способны выполнять простые операции самостоятельно.
src/Command/Conceptual/main.py:33
↓ 1 callers
Class
Singleton
src/Singleton/Conceptual/ThreadSafe/main.py:77
↓ 1 callers
Class
SomeComponent
Python provides its own interface of Prototype via `copy.copy` and `copy.deepcopy` functions. And any class that wants to implement custom
src/Prototype/Conceptual/main.py:12
↓ 1 callers
Class
SquirrelHandler
src/ChainOfResponsibility/Conceptual/main.py:85
↓ 1 callers
Class
Target
EN: The Target defines the domain-specific interface used by the client code. RU: Целевой класс объявляет интерфейс, с которым может раб
src/Adapter/Conceptual/class/main.py:13
↓ 1 callers
Class
Target
EN: The Target defines the domain-specific interface used by the client code. RU: Целевой класс объявляет интерфейс, с которым может раб
src/Adapter/Conceptual/object/main.py:13
↓ 1 callers
Class
WordsCollection
EN: Concrete Collections provide one or several methods for retrieving fresh iterator instances, compatible with the collection class. R
src/Iterator/Conceptual/main.py:91
Class
AbstractClass
EN: The Abstract Class defines a template method that contains a skeleton of some algorithm, composed of calls to (usually) abstract primitiv
src/TemplateMethod/Conceptual/main.py:19
Class
AbstractFactory
EN: The Abstract Factory interface declares a set of methods that return different abstract products. These products are called a family and
src/AbstractFactory/Conceptual/main.py:18
Class
AbstractHandler
EN: The default chaining behavior can be implemented inside a base handler class. RU: Поведение цепочки по умолчанию может быть реализов
src/ChainOfResponsibility/Conceptual/main.py:38
Class
AbstractProductA
EN: Each distinct product of a product family should have a base interface. All variants of the product must implement this interface. R
src/AbstractFactory/Conceptual/main.py:77
Class
AbstractProductB
EN: Here's the the base interface of another product. All products can interact with each other, but proper interaction is possible only betw
src/AbstractFactory/Conceptual/main.py:108
Class
BaseComponent
EN: The Base Component provides the basic functionality of storing a mediator's instance inside component objects. RU: Базовый Компонент
src/Mediator/Conceptual/main.py:51
Class
Builder
EN: The Builder interface specifies methods for creating the different parts of the Product objects. RU: Интерфейс Строителя объявляет с
src/Builder/Conceptual/main.py:21
Class
Command
EN: The Command interface declares a method for executing a command. RU: Интерфейс Команды объявляет метод для выполнения команд.
src/Command/Conceptual/main.py:21
Class
Component
EN: The base Component interface defines operations that can be altered by decorators. RU: Базовый интерфейс Компонента определяет повед
src/Decorator/Conceptual/main.py:14
Class
Component
EN: The Component interface declares an `accept` method that should take the base visitor interface as an argument. RU: Интерфейс Компон
src/Visitor/Conceptual/main.py:18
Class
Component
EN: The base Component class declares common operations for both simple and complex objects of a composition. RU: Базовый класс Компонен
src/Composite/Conceptual/main.py:19
Class
Creator
EN: The Creator class declares the factory method that is supposed to return an object of a Product class. The Creator's subclasses usually p
src/FactoryMethod/Conceptual/main.py:18
Class
Decorator
EN: The base Decorator class follows the same interface as the other components. The primary purpose of this class is to define the wrapping
src/Decorator/Conceptual/main.py:40
Class
Handler
EN: The Handler interface declares a method for building the chain of handlers. It also declares a method for executing a request. RU: И
src/ChainOfResponsibility/Conceptual/main.py:20
Class
Implementation
EN: The Implementation defines the interface for all implementation classes. It doesn't have to match the Abstraction's interface. In fact, t
src/Bridge/Conceptual/main.py:63
Class
Mediator
EN: The Mediator interface declares a method used by components to notify the mediator about various events. The Mediator may react to these
src/Mediator/Conceptual/main.py:19
Class
Memento
EN: The Memento interface provides a way to retrieve the memento's metadata, such as creation date or name. However, it doesn't expose the Or
src/Memento/Conceptual/main.py:84
Class
Observer
EN: The Observer interface declares the update method, used by subjects. RU: Интерфейс Наблюдателя объявляет метод уведомления, который изда
src/Observer/Conceptual/main.py:138
Class
Product
EN: The Product interface declares the operations that all concrete products must implement. RU: Интерфейс Продукта объявляет операции,
src/FactoryMethod/Conceptual/main.py:100
Class
SingletonMeta
EN: The Singleton class can be implemented in different ways in Python. Some possible methods include: base class, decorator, metaclass. We w
src/Singleton/Conceptual/NonThreadSafe/main.py:15
Class
SingletonMeta
EN: This is a thread-safe implementation of Singleton. RU: Это потокобезопасная реализация класса Singleton.
src/Singleton/Conceptual/ThreadSafe/main.py:17
Class
State
EN: The base State class declares methods that all Concrete State should implement and also provides a backreference to the Context object,
src/State/Conceptual/main.py:63
Class
Strategy
EN: The Strategy interface declares operations common to all supported versions of some algorithm. The Context uses this interface to ca
src/Strategy/Conceptual/main.py:81
Class
Subject
EN: The Subject interface declares a set of methods for managing subscribers. RU: Интерфейс издателя объявляет набор методов для управле
src/Observer/Conceptual/main.py:30
Class
Subject
EN: The Subject interface declares common operations for both RealSubject and the Proxy. As long as the client works with RealSubject using t
src/Proxy/Conceptual/main.py:18
Class
Visitor
EN: The Visitor Interface declares a set of visiting methods that correspond to component classes. The signature of a visiting method allows
src/Visitor/Conceptual/main.py:83