Introduction to observer mode
Observer pattern is the most commonly used design pattern in design patterns. It is often used in one to many software design scenarios. A popular example is the relationship between a newspaper and its subscribers. Anyone who needs a newspaper only needs to subscribe to the newspaper, and the newspaper office wil ...
Posted by ashrust on Thu, 21 Apr 2022 01:12:48 +0300
Loose coupling is realized from the program structure, which can expand the overall class structure
(1) Adapter mode
realization:
So that classes with incompatible interfaces can work together
For example, the usb interface is incompatible with the network cable interface. One usb transfer interface can be used to make the two work together ...
Posted by metalblend on Wed, 20 Apr 2022 14:08:53 +0300
catalogue
1, Appearance mode
1. What is appearance mode
2. Appearance mode cases
2, Sharing mode
1. What is the sharing mode
2. Cases of sharing mode
1, Appearance mode
1. What is appearance mode
Facade Pattern is one of the appearance patterns and structural design patterns. The appearance mode provides a consistent and simple interf ...
Posted by gilgimech on Wed, 20 Apr 2022 07:07:28 +0300
Guidance
1, Proxy pattern
The principle of AOP is dynamic agent
Dynamic proxy solves the tight coupling between methods, and additional operations can be carried out dynamically in the middle of method calls
IOC solves the tight coupling between classes!
1. Core roles and application scenarios
Core role:
Abstract object
Public e ...
Posted by ranman on Wed, 20 Apr 2022 03:20:33 +0300
This Blog continues to learn about structural patterns and how to more gracefully layout classes and objects. Structural patterns describe how to combine classes or objects according to a certain layout in order to obtain a better and more flexible structure. Although the object-oriented inheritance mechanism provides the most basic function of ...
Posted by jarcoal on Mon, 18 Apr 2022 18:06:06 +0300
1, Definition
Composite Pattern: one of the structural patterns, which combines multiple objects to form a tree structure to represent the hierarchical structure of "whole part" relationship. The combination mode has consistency in the processing of leaf nodes and container nodes, which is also called whole part mode.
2, UML class d ...
Posted by guest on Mon, 18 Apr 2022 11:56:04 +0300
With Kubernetes becoming the de facto standard in the field of container choreography, Golang is more and more used in cloud native. Today, we follow the steps of K8s and learn which classic design patterns are used in K8s.
Create mode
As the name suggests, the creation pattern provides an object creation mechanism, encapsulates the internal ...
Posted by wwfc_barmy_army on Mon, 18 Apr 2022 06:34:22 +0300
preface
If a cross platform software is implemented, how to deal with the platform related and platform independent parts, that is, the relationship between abstraction and implementation, involves the Bridge bridging mode.
1 Definition
Separate the abstract part from the implementation part so that they can change independently
2 appli ...
Posted by Sealr0x on Sun, 17 Apr 2022 07:12:16 +0300
The last part of the book is about the structural mode - decorator design mode
Decorator design mode
Definition: dynamically attach functions to objects without changing the original objects.
Extension: different from inheritance, it enhances the function of the original object through the decorative object, which belongs to dynamic combinat ...
Posted by voyde on Sat, 16 Apr 2022 08:09:38 +0300
Agent mode:
Why learn the agent mode? Because the underlying mechanism of AOP is dynamic agent!
Agent mode:
Static proxy
Dynamic agent
Before learning aop, we should first understand the agent mode!
Static proxy
Static agent role analysis
Abstract role: it is generally implemented using interfaces or abstract classes
Real role: the r ...
Posted by Jeroen Oosterlaar on Fri, 15 Apr 2022 13:50:09 +0300