Design pattern - builder pattern
background
When the internal data of a class is too complex (it is usually a class that is responsible for holding data, such as Config, VO, PO, Entity...). To create it, you may need to understand the internal structure of this class and how these things are organized and assembled. At this time, the learning cost will be increased and it ...
Posted by seeker2921 on Sun, 26 Dec 2021 07:00:01 +0100
Learning notes (design mode - factory mode)
Factory mode
1. General factory mode
Factory Pattern is one of the most commonly used design patterns in Java. This type of design pattern belongs to 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 object ...
Posted by klainis on Sat, 25 Dec 2021 23:46:17 +0100
The picture selector in android realizes the function of selecting and uploading multiple pictures of wechat publishing circle of friends
This article is based on the ideas required by the project to learn from the improved ideas of other bloggers. The ideas will be the same, but this article does belong to my original creation, and the reference link will be displayed at the end of the article (ah, good official...)
Let's talk about the functional requirements of the project, ...
Posted by Ralf Jones on Sat, 25 Dec 2021 16:21:10 +0100
Design mode - command mode
Related links:
[design mode] column: [design mode] column
Relevant examples can be downloaded: Examples of common Java design patterns
Command mode
Command Pattern is a data-driven design pattern, which belongs to behavioral pattern. The request is wrapped in the object in the form of command and passed to the calling object. The calling ...
Posted by lobski on Sat, 25 Dec 2021 16:00:35 +0100
There are two ways to encapsulate the Retrofit + collaboration to achieve elegant and fast network requests
objective
Simple call and less repetitive code Independent of third-party libraries (only including Retrofit+Okhttp + collaboration) You can start immediately even if you don't understand the collaborative process at all (template code) What does it mean to write Kotlin code in Kotlin's way? Compare the following two codes:
mViewModel.wx ...
Posted by moagrius on Sat, 25 Dec 2021 04:31:32 +0100
Responsibility chain model
1. Basic concepts
1. Definition
Enables multiple objects to process requests, thereby avoiding coupling between the sender and receiver of the request. Connect these objects into a chain and pass requests along that chain until one object processes it.
4. Examples of similar backgrounds
Request process, need main procedure approval wi ...
Posted by we4freelance on Sat, 25 Dec 2021 01:12:56 +0100
[Design Mode] - Bridge Bridge Bridge Mode
Bridge mode
In the design of software components, if the responsibility division is not clear, the result of inheritance tends to be a rapid expansion of subclasses with duplicate code as demand changes.
motivation
Because of some fixed inherent implementation logic, they have two or more changing dimensions, and even more.
How do you c ...
Posted by Fixxer on Fri, 24 Dec 2021 20:18:12 +0100
C + + design pattern
Design pattern
1, Overview
1. Definition: a set of widely known, widely used, classified and catalogued reliable template code design experience summary.
2. Features: high cohesion and low coupling (also the ultimate goal)
3. Core idea: isolate changes and encapsulate changes
4. Significance: using design patterns can enhance the reusa ...
Posted by goclimb on Fri, 24 Dec 2021 05:50:10 +0100
Strategy pattern of Java design pattern
Strategy mode
Definition: define a series of algorithms, encapsulate them one by one, and make them replaceable. This pattern allows the algorithm to vary independently of the customers using it. Advantages: (1) policy pattern provides a way to manage related algorithm families. The hierarchical structure of policy class defines an algorithm ...
Posted by chocopi on Thu, 23 Dec 2021 14:56:30 +0100
On the responsibility chain model of design model
Responsibility chain model
1, Definition
Responsibility chain pattern: multiple objects have the opportunity to process the request, so as to avoid the coupling relationship between the sender and receiver of the request. Connect these objects into a chain and pass the request along the chain until an object has finished processing i ...
Posted by agge on Thu, 23 Dec 2021 07:35:35 +0100