[design pattern series 1] template pattern & Strategy Pattern

Describe the usage posture of template mode and policy mode, as well as the differences between them, based on java. Brother Lou, it's boring to see you write articles every day. Why don't you tell us a joke first. "Well, what are you talking about? Let me think about it first..." A reporter went to Antarctica to interview ...

Added by james_creasy on Wed, 05 Jan 2022 15:36:16 +0200

On design pattern and its application in Unity: II. Factory pattern

What is the factory model Factory Pattern is one of the most commonly used design patterns. This type of design pattern is a creation pattern, which provides the best way to create objects. In factory mode, when creating objects, we do not expose the creation logic to the client, and point to the newly created objects by using a common ...

Added by yhingsmile on Wed, 05 Jan 2022 13:06:22 +0200

RxJava3. Getting started with X -- creating and transforming operators

RxJava3. Getting started with X (2) -- create operators and transform operators Create Operator 1, Foundation creation 1.create() Use the Create operator to Create a complete Observable, which can pass onNext, onError, onCompleted and other events. Demo code: Observable.create((ObservableOnSubscribe<Integer>) e -> { ...

Added by Qazsad on Wed, 05 Jan 2022 12:44:40 +0200

Explain the possible memory leakage caused by Handler and the solutions at one time

Author: shrimp Mi Jun 1. Improper use of handler? First find out what is improper use of} Handler? Generally, it has the following characteristics: Handler adopts anonymous internal class or internal class extension, and holds the reference of external class {Activity} by default: // Anonymous Inner Class override fun onCreate(savedInst ...

Added by minds_gifts on Wed, 05 Jan 2022 12:03:06 +0200

Design pattern_ Factory mode

Simple factory Introduction: the simplest factory mode is not part of the standard design mode, but it is very in line with people's programming habits. All products are produced by simple factories advantage: The factory class contains the necessary logical judgment to decide when to create an instance of which product. The client can avoid t ...

Added by Dark_Archon on Wed, 05 Jan 2022 06:06:21 +0200

Detailed explanation of Vue source code: preparations before generating 'Vue' instances

Detailed explanation of Vue source code (I): preparations before generating Vue instances 1. Start with new Vue() vue/src/core/index.js : import Vue from './instance/index' // 1. Introduce Vue constructor import { initGlobalAPI } from './global-api/index' // 2. Introduce the dependency to initialize the global API import { isServerRendering ...

Added by delassus on Wed, 05 Jan 2022 05:52:44 +0200

Teach you how to use the singleton pattern of design pattern

Singleton mode of design mode definition A class has only one instance. The class provides a global access point for external access to the instance. For example, windows can only open one task manager, which can avoid the waste of memory resources caused by opening multiple task manager windows. characteristic A singleton class has on ...

Added by gersh on Tue, 04 Jan 2022 22:30:30 +0200

RxJava3.x Getting Started Guide - filter operators

RxJava3.x Getting Started Guide (IV) -- filter operator 1, Filter events based on specified event criteria 1.filter() Function: filter the events sent by the observer through certain logic. If true is returned, the event will be sent, otherwise it will not be sent Demo code: Observable .just(1,2,3,4,5) ...

Added by stb74 on Tue, 04 Jan 2022 20:54:56 +0200

Responsibility chain model of design model

preface As the name suggests, the Chain of Responsibility Pattern creates a chain of receiver objects for requests. This pattern gives the type of request and decouples the sender and receiver of the request. This type of design pattern belongs to behavioral pattern. In this pattern, each recipient usually contains a reference to another reci ...

Added by biohazardep on Tue, 04 Jan 2022 12:54:36 +0200

Abstract factory pattern

1. General Compared with the factory method pattern, the abstract factory pattern is for one product family, while the abstract factory pattern is for multiple product families, that is, the factory method pattern is a product family and a factory class, while the abstract factory pattern is a factory class for multiple product families. In th ...

Added by jiayanhuang on Tue, 04 Jan 2022 11:47:26 +0200