Singleton mode from simple to deep (C# version)

Singleton mode from simple to deep (C# version) Sometimes, we want a class to have only one instance. The benefits are: 1. Data sharing can be realized 2. Avoid creating and destroying a large number of instances to improve performance In order to implement the singleton mode, the usual methods are: 1. Privatize the constructor to avoid exter ...

Posted by bentobenji on Wed, 13 Oct 2021 02:06:23 +0200

[design mode] template mode

Template mode is a behavioral strategy mode. It defines the algorithm framework in the superclass, allowing subclasses to override specific steps without modifying the structure 1. Use If there is a requirement to generate a file, the file format is Line 1: file version Line 2: receiver Line 3: sender Line 4: Data You can define an abs ...

Posted by Harry57 on Mon, 11 Oct 2021 20:46:46 +0200

[Design Mode] Observer Mode

1. Background This content is from the second chapter of the book Head First Design Patterns, Observer Patterns (let the object know what you are doing) 2. OO Base encapsulationinheritpolymorphicabstract 3. OO Design Principles Encapsulate changes, encapsulate changed parts, separate from fixed partsInterface-oriented programming, ...

Posted by embtech on Sat, 09 Oct 2021 20:20:16 +0200

Design mode - front page - single case mode, factory mode

Singleton mode definition Singleton design pattern generally refers to the singleton design pattern of a class, which is to take certain methods to ensure that there can only be one object instance for a class in the whole software system, and the class only provides a method to obtain its object instance (static method). example For exampl ...

Posted by ashell on Fri, 08 Oct 2021 05:32:21 +0200

Design pattern -- mediator pattern (mediator pattern)

A module may be composed of multiple objects, and there may be mutual references between these objects, as shown in the following figure:   In order to reduce the complex reference relationship between objects and reduce the coupling degree of the system, the mediator pattern is introduced, which is also the motivation for the creation ...

Posted by suttercain on Wed, 06 Oct 2021 18:37:20 +0200

Java filter pattern

Java filter pattern introduce What is filtering mode? For example, in cement manufacturing, sand is used to mix cement. If there are too many large stones in the sand, the mixed cement will not crack easily. Therefore, before mixing water and mud, we need to use a filter screen to filter out the large stones in the sand, and the filter we le ...

Posted by svivian on Sat, 02 Oct 2021 01:54:20 +0200

Java builder pattern

Java builder pattern introduce Main solutions: it mainly solves the problem of creating "a complex object" in software system, which is usually composed of sub objects of each part with certain algorithms; Due to the change of requirements, each part of this complex object often faces drastic changes, but the algorithm that combines ...

Posted by gilgimech on Sat, 02 Oct 2021 00:08:19 +0200

Decorator Pattern C + + implementation of design pattern

Refer to the book Head First design pattern Design pattern and design principle         Decorator Pattern dynamically attaches responsibility to objects. To extend functionality, decorator pattern provides a more flexible alternative than inheritance. The decorator pattern follows the following design p ...

Posted by TripleDES on Tue, 28 Sep 2021 20:12:39 +0200

When Alipay App meets AndroidX...

Author: Yangzhou This article mainly introduces some new (xin) Suan (lei) in Alipay Android end embrace AndroidX process. What are the differences / difficulties of upgrading Alipay to AndroidX?How is the Migrate AndroidX of Android Studio implemented?How does APK product fit Android x? background Since Android Support was "revoluti ...

Posted by ryanthegecko on Tue, 28 Sep 2021 11:41:32 +0200

Richter replacement principle of 23 design modes

Richter substitution principle Thinking and explanation of inheritance in OO 1. Inheritance contains a layer of meaning: all implemented methods in the parent class are actually setting specifications and contracts. Although it does not force all subclasses to follow these contracts, if subclasses arbitrarily modify these implemented methods, ...

Posted by blacklotus on Mon, 27 Sep 2021 13:27:58 +0200