Design Patterns → Generative Design Patterns - Prototype
Prototype, шаблоны проектирования, Прототип, abstract
Goals
- Specify the types of objects to create using the prototype instance and create new objects by copying this prototype.
- Create one instance of the class to use as the source for all future instances.
- The new operator is considered …
Python → Example - "Builder" design pattern in Python
Строитель, Python, Builder, шаблоны проектирования
Example of "Builder" desnig pattern in Python
- """
- Separate the construction of a complex object from its representation so
- that the same construction process can create different representations.
- """
- import abc
- class Director:
- """
- Construct an object using the Builder …
C++ → Example - "Builder" design pattern in C++
cpp, Builder, Строитель, шаблоны проектирования
Discussion. The forte of Builder is constructing a complex object step by step. An abstract base class declares the standard construction process, and concrete derived classes define the appropriate implementation for each step of the process. In this example, "distributed …
Java → Example - "Builder" design pattern in Java
Java, шаблоны проектирования, Builder
Example of "Builder" design pattern in Java
- /* "Product" */
- class Pizza {
- private String dough = "";
- private String sauce = "";
- private String topping = "";
- public void setDough(String dough) {
- this.dough = dough;
- }
- public void setSauce(String …
Delphi → Example - Abstract Factory in Delphi
abstract, шаблоны проектирования, Delphi
This pattern is ideal where you want to isolate your application from the implementation of the concrete classes. For example if you wanted to overlay Delphi's VCL with a common VCL layer for both 16 and 32 bit applications, you …
Design Patterns → Generative Design Patterns - Object Pool
шаблоны проектирования, object, pool
Goals
Object pooling can greatly improve performance; it is most effective in situations where the cost of initializing an instance of a class is high and the rate of instantiation of the class is high, while the number of instances …
Java → Example - Abstract Factory in Java
Abstract Factory classes are often implemented with Factory Methods, but they can also be implemented using Prototype. Abstract Factory might store a set of Prototypes from which to clone and return product objects.
- Factory Method: creation through inheritance.
- Prototype: creation …
PHP → Example - Abstract Factory in PHP
An example of a design pattern An abstract factory in PHP
- <?php
- /*
- * Abstract Factory classes
- */
- abstract class DB_Abstraction_Factory {
- protected $settings = array();
- protected function __construct() {
- $this->settings = Settings::getInstance();
- }
- abstract public function createInstance();
- }
- class …
Design Patterns → Generative Design Patterns - Factory Method
шаблоны проектирования, abstract, cpp
Goals
- We define an interface for creating an object, but let the subclasses decide which class to create. A factory method allows you to instantiate a class for subclasses.
- Definition of a "virtual" constructor.
- The new operator is harmful.
Problems …
EVILEG → Adding initial support for photos and photo albums
The weekend was not in vain. For a couple of days, I managed to write enough functional support for uploading photos through the WYSIWYG website editor. What I would like to inform the users of the site in the form …
- Last comments
- ИМNov. 22, 2024, 9:51 p.m.Добрый вечер Евгений! Я сделал себе авторизацию аналогичную вашей, все работает, кроме возврата к предидущей странице. Редеректит всегда на главную, хотя в логах сервера вижу запросы на правильн…
- Подскажите как это запустить? Я не шарю в программировании и кодинге. Скачал и установаил Qt, но куча ошибок выдается и не запустить. А очень надо fb3 переконвертировать в html
- ИМOct. 5, 2024, 4:51 p.m.Приветствую Евгений! У меня вопрос. Можно ли вставлять свои классы в разметку редактора markdown? Допустим имея стандартную разметку: <ul> <li></li> <li></l…
- Здравствуйте, возникает такая проблема (я новичок): ApplicationWindow неизвестный элемент. (М300) для TextField и Button аналогично. Могу предположить, что из-за более новой верси…
- Now discuss on the forum
- fFeb. 15, 2025, 1:46 p.m.Подскажите, пожалуйста! Как данный класс можно дополнить, чтобы созданные объекты можно было перемещать мышкой по сцене?
- Не запускается компьютер (точнее работает блок , но сам монитор вообще жесть)В общем я ничего с интернета не скачивала в последнее время. На компе никаких левых пр…
- Вопрос решен. Узнать QModelIndex элемента на который мы перетаскиваем другой элемент, можно с помощью функции indexAt(event->position().toPoint()) представления QTreeViev вызываемой в переопр…
- Спасибо большое за помощь и простите за то что отнял время своей невнимательностью.