Advanced search
Evgenij LegotskojOct. 1, 2018, 2:34 p.m.

Design PatternsStructural Design Patterns - Adapt

шаблоны проектирования, приспособленец, flyweight

Goals

  • Using sharing to effectively use a large number of objects.
  • Motif's GUI strategy to replace heavyweight widgets with lightweight widgets.

Problems

Designing objects down to the lowest levels of system "granularity" provides optimal flexibility, but can be prohibitively expensive …

Evgenij LegotskojSept. 26, 2018, 5:55 p.m.

Python 3Example - Object Pool in Python

python, pool, пул, шаблоны проектирования

Example of the design pattern An object pool in the Python programming language.


"""
Offer a significant performance boost; it is most effective in
situations where the cost of initializing a class instance is high, the
rate of instantiation of …
Evgenij LegotskojSept. 26, 2018, 5:53 p.m.

JavaExample - Object Pool in Java

Java, пул, шаблоны проектирования

Example of the design pattern An object pool in the Java programming language.


// ObjectPool Class

public abstract class ObjectPool<T> {
  private long expirationTime;

  private Hashtable<T, Long> locked, unlocked;

  public ObjectPool() {
    expirationTime = 30000; // 30 seconds
    locked = …
Evgenij LegotskojSept. 26, 2018, 4:55 p.m.

C++Example - Object Pool in C++

шаблоны проектирования, пул, C++

Example of the design pattern An object pool in the C ++ programming language.


#include <string>
#include <iostream>
#include <list>
class Resource
{
    int value;
    public:
        Resource()
        {
            value = 0;
        }
        void reset()
        {
            value = 0;
        }
        int …
Evgenij LegotskojSept. 26, 2018, 4:01 p.m.

Design PatternsStructural Design Patterns - Decorator

шаблоны проектирования, decorator, декоратор

Goals

  • Add additional features and functionality to the object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
  • Client-specified decoration of the interface of the main object by recursively wrapping it.
  • Wrap the gift, put it in the …
Evgenij LegotskojSept. 25, 2018, 4:16 p.m.

PHPExample - Factory method in PHP

шаблоны проектирования, factory, method, PHP

In the Factory Method Pattern, a factory method defines what functions must be available in the non-abstract or concrete factory. These functions must be able to create objects that are extensions of a specific class. Which exact subclass is created …

Evgenij LegotskojSept. 25, 2018, 4:09 p.m.

DelphiExample - Factory method in Delphi

Delphi, шаблоны проектирования, factory, method

This pattern is useful when you want to encapsulate the construction of a class and isolate knowledge of the concrete class from the client application through an abstract interface.

Один из примеров этого может возникнуть, если у вас есть объектно-ориентированное …

Evgenij LegotskojSept. 25, 2018, 3:46 p.m.

Design PatternsStructural Design Patterns - Composite

шаблоны проектирования, composite, компоновщик

Goals

  • Arrange objects into tree structures to represent entire parts of the hierarchy. The linker allows clients to treat individual objects and compositions of objects in the same way.
  • Recursive composition
  • "Directories contain entries, each of which can be a …
Evgenij LegotskojSept. 24, 2018, 8:43 p.m.

Python 3Example - Factory method in Python

шаблоны проектирования, factory, Python, method

An example of a factory method in the Python programming language


"""
Define an interface for creating an object, but let subclasses decide
which class to instantiate. Factory Method lets a class defer
instantiation to subclasses.
"""

import abc


class …
Evgenij LegotskojSept. 24, 2018, 8:34 p.m.

JavaExample - Factory Method in Java

шаблоны проектирования, factory, method, Java, JAVA

In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done …

Fornex

Let me recommend you a great European Fornex hosting.

Fornex has proven itself to be a stable host over the years.

For Django projects I recommend VPS hosting

Following the link you will receive a 5% discount on shared hosting services, dedicated servers, VPS and VPN

View Hosting
V

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:50points,
  • Rating points-4
DK

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:20points,
  • Rating points-10
s
  • storm
  • Jan. 20, 2023, 10:30 p.m.

C++ - Тест 003. Условия и циклы

  • Result:0points,
  • Rating points-10
Popular publications in the last 90 Days
Last comments
S

Qt WinAPI - Lesson 004. QtIFW - Automation WinDeployQt and build installers with Qt Installer Framework

Hello Evgenij, regarding the online installer, I've tried many times to use web host for the created repo after repogen step. I tried using github but I found people talking it is not …
  • juvf
  • Jan. 17, 2023, 9:18 a.m.

Qt/C++ - Lesson 051. QMediaPlayer – simple audio player

PS. Почти дописал плеер на QML. Уперся в ограничения QML. Переписываю плеер на с++/qt, а графика останится в qml. Нашел то, что мне надо, а именно индикатор звука. Qt может перехватывать аудиопо…

Qt/C++ - Lesson 039. How to paint stroke in QSqlTableModel by value in the column?

В этом случае вижу только какой-нибудь костыль в стиле перебора по всем индексам в заголовке с помощью методу headerData . То есть пройтись в for цикле пока не будет совпадения н…
a
  • avt
  • Dec. 12, 2022, 8:06 p.m.

Qt/C++ - Lesson 039. How to paint stroke in QSqlTableModel by value in the column?

Спасибо за ответ. Нет, дело не в читаемости кода, в разных таблицах у меня есть столбцы с одинаковым именем, но с разными индексами. Хотел сделать решение по имени столбца для всех таблиц сразу.…
  • juvf
  • Dec. 12, 2022, 3:06 p.m.

Qt/C++ - Lesson 051. QMediaPlayer – simple audio player

Спасибо.
Now discuss on the forum

Как создать уникальное значение поля на основе существующих значений

В принципе это можно сделать так: def unique_field(self): return '{0}_{1}'.format(self.title, self.price)class Tovar(models.Model): title=models.CharField('Наименование',max_length=…
W
  • Wayne
  • Jan. 27, 2023, 12:47 p.m.

Здравствуйте помогите с qml

как сделать так, чтобы зеленая фигура при движения за пределы круга пропадала на qml
AB

Sorting the added QML elements in the ListModel

I am writing an alarm clock in QML, I am required to sort the alarms in ascending order (depending on the date or time (if there are several alarms on the same day). I've done the sorting …

QSqlRelatipnalTabelModel Qt 4.8.1 как получить id внешней связи?

Наконец-то готовы представить полноценное развитие Qt QSqlTableModel и QTableView. Посмотреть можно у нас на сайте здесь На github здесь здесь Радостная новос…
P
  • Pisych
  • Jan. 25, 2023, 10:01 p.m.

Ввод бухгалтерского документа в одной форме

вопрос снят. спасибо за ответы. сообразил, как сделать:)
About
Services
© EVILEG 2015-2022
Recommend hosting TIMEWEB