Java interview design pattern summary and case code demonstration
Java design pattern
Design pattern classification: design patterns are divided into three types, a total of 23
Create pattern
Singleton pattern, factory pattern, abstract factory pattern, prototype pattern, builder pattern
Structural model
Adapter mode, decorator mode, appearance mode, agent mode, bridge mode, assembly combination mode and ...
Added by Jem on Mon, 27 Dec 2021 06:48:48 +0200
Spring boot and spring listener mode
Recently, I read the source code of SpringBoot and found a strange phenomenon: there are two places in the project with the function of publishing events. One is the SpringApplicationRunListener interface; The other is the publishEvent method of the ApplicationEventPublisher interface, which is implemented by the ApplicationContext interface. T ...
Added by p_h_p on Mon, 27 Dec 2021 06:02:20 +0200
Common design patterns of front end
Design principles
Solid (stable)
Single Responsibility Principle A class should have only one reason to change. In short, each class only needs to be responsible for its own part, and the complexity of the class will be reduced. Open Closed Principle
A software entity, such as classes, modules, and functions, should be open to extensions ...
Added by jamcoupe on Sun, 26 Dec 2021 22:33:09 +0200
Five implementations of singleton mode
Singleton mode
The singleton pattern, as its name implies, ensures that a class has only one instance and provides a global access point.
Five implementation methods:
Hungry Han styleLazy styleDouble checkStatic inner classEnumeration class
The first step in implementing the singleton pattern is to privatize the constructor to ensure that i ...
Added by emediastudios on Sun, 26 Dec 2021 05:21:28 +0200
Design pattern - observer pattern
Related links:
[design mode] column: [design mode] column
Relevant examples can be downloaded: Examples of common Java design patterns
Observer mode
Observer Pattern refers to one to many dependencies among multiple objects. When the state of an object changes, all objects that depend on it are notified and automatically updated. This pat ...
Added by Nuv on Sat, 25 Dec 2021 20:28:47 +0200
Advanced Java | viewing object-oriented as a whole
1, Object oriented
Object oriented is the core idea of Java programming. Its basic characteristics are inheritance, encapsulation and polymorphism.
1. Feature encapsulation
The structure, data and operation are encapsulated in the object entity. When using, you can not pay attention to the internal structure of the object and can only access ...
Added by jswinkelman on Sat, 25 Dec 2021 17:25:02 +0200
State mode - Python implementation
State mode
definition
State pattern: allows an object to change its behavior when its internal state changes, that is, different states correspond to different behaviors. Object appears to have modified its class.
In many cases, the behavior of an object depends on one or more dynamically changing attributes. Such properties are called State ...
Added by astronaut on Sat, 25 Dec 2021 12:25:32 +0200
[one java design pattern per day] - Visitor pattern
In the visitor pattern, we use a visitor class, which changes the execution algorithm of the element class. In this way, the execution algorithm of the element can change as the visitor changes. This type of design pattern belongs to behavioral pattern. According to the schema, the element object has accepted the visitor object so that the visi ...
Added by JoeCrane on Sat, 25 Dec 2021 11:35:37 +0200
java design pattern learning
Design pattern
1. Singleton mode
1.1 scenario
Many times, the whole system only needs to have a global object, which is conducive to coordinating the overall behavior of the system. For example, we often use global cache objects.
The idea of implementing singleton pattern is that a class can return an object, a reference (always the same) a ...
Added by jbille on Fri, 24 Dec 2021 11:12:56 +0200
18 - Quarkus implementation of mediator mode
Abstract: This paper describes the mediator pattern in Gof 23 design pattern with an example scenario, and implements it with Quarkus program code. At the same time, it also gives the UML model of the implementation code. Key words: Gof 23 design pattern mediator pattern Quarkus
1 basic knowledge 1.1 standard definition The standard definition ...
Added by craygo on Fri, 24 Dec 2021 07:36:59 +0200