The of Java design pattern -- template method
As one of the design patterns of Java, Template Method summarizes its advantages and features in one word: Abstract steps
Next, record the understanding in the form of a question and answer
Question 1: now you want to make a cake, you will do many things. We will make the cake into the code as follows. Now you have a whim and come up with a ...
Posted by definewebsites on Mon, 07 Feb 2022 12:47:38 +0100
Twenty three design patterns in JAVA -- Observer Pattern
concept
When there is a one to many relationship between objects, the Observer Pattern is used. For example, when an object is modified, it will automatically notify the objects that depend on it. Observer mode belongs to behavioral mode.
introduce
Intent: defines a one to many dependency between objects. When the state of an object chan ...
Posted by j007w on Sun, 06 Feb 2022 05:14:37 +0100
Twenty three design patterns of JAVA -- Flyweight Pattern
concept
Flyweight Pattern is mainly used to reduce the number of objects created to reduce memory consumption and improve performance. This type of design pattern belongs to structural pattern, which provides a way to reduce the number of objects and improve the object structure required by the application.
The meta pattern attempts to re ...
Posted by twmcmahan on Sun, 06 Feb 2022 05:11:29 +0100
JAVA 23 design modes Daquan factory mode
Factory mode
concept
Factory Pattern is one of the most commonly used design patterns in Java. This type of design pattern is a 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 objects by using a common in ...
Posted by elflacodepr on Sat, 05 Feb 2022 03:45:10 +0100
Did you give out the year-end bonus?
The year-end bonus is not only the happiness of many people, but also the pain of many people.
Of course, whether happiness is destined for you depends on whether happiness is destined for you. This is a metaphysics.
In some companies, if one person has a year-end bonus, others will have it. In some companies, it is based on your performance ...
Posted by joey3002 on Fri, 04 Feb 2022 09:22:53 +0100
Java reflection: Class class, dynamically loading Class, obtaining method and member variable construction information, basic operation of method reflection, essence of collection generics
System.out.println(c2.getSimpleName());//The name of the class that does not contain the package name
System.out.println(c5.getName());
}
}
ClassDemo3.java
public class ClassDemo3 {
public static void main(String[] args) {
String s = ...
Posted by ThEMakeR on Fri, 04 Feb 2022 08:19:24 +0100
Detailed explanation of decorator mode (relationship with IO)
https://www.cnblogs.com/zuoxiaolong/p/pattern11.html
This chapter discusses a design pattern, decorator pattern, which has a puzzled relationship with IO in JAVA.
Definition: Decoration mode is to dynamically extend the function of an object without changing the original class file and using inheritance. It wraps the real object by creating a ...
Posted by HhAaZzEeYy on Fri, 04 Feb 2022 04:36:55 +0100
Open source practice 1: learn flexible application design patterns by analyzing Java JDK source code
76 | open source practice I (Part I): learn flexible application design patterns by analyzing Java JDK source code
Application of factory pattern in Calendar ClassApplication of builder pattern in Calendar ClassApplication of decorator pattern in Collections classApplication of adapter pattern in Collections classKey review
76 | open sourc ...
Posted by phpwiz on Thu, 03 Feb 2022 14:48:00 +0100
Visitor mode
Visitor mode
Basic introduction to visitor mode
Visitor Pattern encapsulates some operations that act on each element of a data structure. It can define new operations that act on these elements without changing the data structure.It mainly separates data structure and data operation, and solves the problem of data structure and operation cou ...
Posted by ondemand on Thu, 03 Feb 2022 13:15:05 +0100
Design mode - singleton mode
2. Singleton mode
Singleton design pattern is one of the most commonly used design patterns in software development. That is, a class can only have one instance object in the whole system, which can be obtained and used. For example, the Runtime class representing the JVM Runtime environment.
1) Attention
How to ensure that there is only on ...
Posted by DoctorWho on Wed, 02 Feb 2022 23:42:45 +0100