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

Design patterns and UML

Design mode Objectives: The analysis and design of object-oriented system actually pursues two points: high cohesion and low coupling. Core idea: Isolation change Classification: Creative mode (new decoupling): hide the way of creating logic while creating objects, instead of directly instantiating objects with the new operator. (5 modes) Struc ...

Posted by Divine Winds on Tue, 24 May 2022 04:38:34 +0300

Comprehensive implementation of Android OkHttp + Glide + RecyclerView + ButterKnife popular framework

requirement Use one OkHttp to obtain muke.com movie data (20 pieces), use Glide to load pictures and display them in each movie Item, and search and display them by movie name and type. Operation effect Task description 1, Contents displayed on the home page: Movie sea ...

Posted by plutoplanet on Tue, 24 May 2022 04:06:34 +0300

Android development practice - project learning notes

Display weather information [supplement] in the light of Android development practice - project learning notes (2) , the last part is to improve the code Add new data 1. Design layout 2. Prepare layout documents 3. Import to parent file 4. Change Java code ① Find control ② Update control content Step 1: activity_weather.xml <?xml version=" ...

Posted by blackthunder on Mon, 23 May 2022 21:28:03 +0300

Detailed explanation of design pattern and Python implementation

Design pattern and Python implementation What is the design pattern? Christopher Alexander: "each pattern describes a recurring problem around us and the core of the solution to the problem * so that you can use the solution again and again without having to do repetitive work." Design patterns are summarized and optimized to provide ...

Posted by axo on Mon, 23 May 2022 10:49:13 +0300

Imitating the source code of Tiktok short video system to take photos and videos based on CameraX

Background: Recently, I was working on an APP video upload project. Due to the use of my own server, there are certain memory restrictions. At present, most mobile phones have a large resolution, and the video captured is several megabytes in a few seconds. How to compress the recorded video is the same as wechat. Therefore, I consulted some ma ...

Posted by Loldongs on Mon, 23 May 2022 01:13:51 +0300