Design Patterns - In-depth Explanation of Builder Patterns

3.4 Builder Mode Definition: The Builder Pattern is also called the Builder Pattern. In actual development, when the objects we need are very complicated to construct, and there are many steps to be processed, the Builder Pattern is very suitable. For example, in the creation of the SqlSessionFactory object in MyBatis, we not only need to ...

Posted by magmazing on Tue, 04 Oct 2022 10:32:38 +0300

[Design Pattern]Mediator Pattern

[Design Pattern]Intermediary Pattern 1 Overview background Generally speaking, the relationship between colleague classes is relatively complex. When multiple colleague classes are related to each other, the relationship between them will appear as a complex network structure, which is an over-coupled architecture, that is, no It is cond ...

Posted by videxx on Tue, 20 Sep 2022 21:16:55 +0300

Let you quickly understand the factory pattern

Tip: After the article is written, the table of contents can be automatically generated. For how to generate it, please refer to the help document on the right foreword ` The factory pattern is divided into simple factory (not included in the 23 design patterns), factory method, and abstract method; here I will summarize and explain t ...

Posted by brad.techguy on Mon, 05 Sep 2022 04:46:57 +0300

Design mode for java learning - Builder mode

Builder pattern Summary Separating the construction of a complex object from its representation allows the same construction process to create different representations. Separate the components for construction (Builder responsible) and assembly (Director responsible). Thus complex objects can be constructed. This pattern applies when the c ...

Posted by konn on Fri, 19 Aug 2022 23:29:58 +0300

Use of ViewModel and Livedata of jettpack architecture components

Author: stars one Reprint address: https://juejin.cn/post/7128993794283798536 The Jetpack architecture recommends the use of MVVM structure. For this reason, several MVVM component libraries have been launched for our developers to quickly access. The first thing to talk about is ViewModel Personal understanding: Activity is View, VM is ...

Posted by hassanz25 on Wed, 17 Aug 2022 10:50:46 +0300

Design Patterns Singleton Pattern and Factory Pattern

1. Singleton mode Eight ways of singleton mode: hungry (static constant), hungry (static code block), lazy (thread unsafe), lazy (thread safe, synchronized method), lazy (thread unsafe, synchronized code blocks), double checking, static inner classes, enums 1): Hungry Chinese style (static constant) ​ The constructor is privatized, the object i ...

Posted by Baseball on Thu, 26 May 2022 00:14:01 +0300

JDBC operation data and DAO design pattern in actual combat

Using JDBC to manipulate data 1. Using JDBC to write large text data to the database Purpose: to java and other text files are written to the corresponding fields of the corresponding table by connecting the database with JDBC. 1. Table structure 2. Documents 3. Implementation code for inserting text package LoadFileTest; import driver.JDB ...

Posted by schoi on Wed, 25 May 2022 18:54:45 +0300

Dahua design mode reading notes (builder mode)

People: small dish, big bird Event: the small dish and the big bird went to have a snack. The small dish ate a bowl of delicious fried noodles, and then the big bird wanted to eat and ordered a bowl, but found that this bowl did not put salt. Why did the same cook cook cook fried noodles twice, the first bowl was delicious, but the second bowl ...

Posted by scm24 on Wed, 25 May 2022 18:14:28 +0300

Java Facade

1, Lead to the question of building a home theater: There are DVD player, projector, automatic screen, surround sound and popcorn machine in the home theater. It is required to complete the function of using the home theater. The process is as follows: • direct remote control: coordinate the switch of each equipment • popcorn opener & ...

Posted by intenseone345 on Wed, 25 May 2022 09:09:47 +0300

Behavioral mode: command mode

1, Definition and characteristics of patterns Command mode: encapsulate a request into an object, separating the responsibility of issuing the request from the responsibility of executing the request. In this way, the two communicate through the command object, which is convenient to store, transfer, call, add and manage the command object. adv ...

Posted by huppsi on Tue, 24 May 2022 18:44:00 +0300