[Java design patterns, design patterns and paradigms] structural mode 4: bridging mode

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

Composite Pattern

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

Golang design pattern in Kubernetes

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

Design mode - bridge

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

Discussion on design mode decorator

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

Static / dynamic proxy mode

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

[design pattern learning notes] detailed explanation of single case mode (lazy type meets multithreading problem analysis based on C + +)

catalogue 1, What is singleton mode 1. Design mode 2. Singleton mode 2, Implementation of singleton mode 1. Lazy singleton mode 1.1 how to ensure that there is only one instance object 1.2 defects of lazy singleton mode 2. Lazy singleton mode and multithreading 2.1 multithreaded construction object 2.2 starving Han style single instan ...

Posted by dkode on Fri, 15 Apr 2022 04:34:51 +0300

Design mode - builder mode

What is the builder model Builder pattern, also known as generator pattern definition, separates the construction of a complex object from its representation, so that the same construction process can create different representations (dependency inversion) Four roles of builder model 1)Product role: a specific product object. 2)Builder (Abst ...

Posted by DylanBlitz on Thu, 14 Apr 2022 16:32:42 +0300

Java design pattern part2

Chapter 6 abstract factory class When it is necessary to add gender to people, there will be six combinations of race and gender. Therefore, when opening factories, two factories can be opened according to the difference between men and women. The current class diagram includes 1. Person (Interface) 2. Black and white yellow man (abstract ma ...

Posted by mwd2005 on Thu, 14 Apr 2022 04:56:10 +0300

Responsibility chain model

Responsibility chain model As the name suggests, the Chain of Responsibility Pattern creates a chain of receiver objects for requests. This mode 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 ...

Posted by oakld on Wed, 13 Apr 2022 19:38:24 +0300