Design pattern の Service Locator Pattern
Service Locator Pattern
geeksforgeeks , I translated it understandably and added some of my own understanding.
Encapsulate the process of obtaining services with an abstraction layer.
Using a central registry called service locator, the service locator returns the information required to perform specific tasks upon request.
When a ...
Posted by omelin on Sun, 31 Oct 2021 05:25:15 -0700
sheng's learning notes - Design Pattern - Visitor pattern and dual distribution
schematic diagram:
In real life, some collection objects have many different elements, and each element also has many different visitors and processing methods. For example, there are multiple scenic spots and multiple tourists in the park. Different tourists may have different comments on the same scenic spot; The prescription list issue ...
Posted by syamswaroop on Sun, 31 Oct 2021 03:32:48 -0700
Design pattern (1-1) - agent pattern
I haven't blogged for months. I changed my job a few days ago and adjusted things well. I can continue to blog again~
After learning the agent mode, this article will talk about how to write dynamic agent and static agent modes. Subsequent articles will talk about the principle of dynamic agent (JDK dynamic agent) and how to use CGLIB to realiz ...
Posted by Ting on Thu, 28 Oct 2021 05:18:57 -0700
Expression principle of design pattern: how to make the source code a logical clue?
Maintaining code is one of the most important daily tasks for programmers. Have you ever encountered the following problems?
When I took over the maintenance project, I found that the document was missing and the code was not annotated. In addition, the maintainer resigned, so I can only sort out the code logic by guessing. The code s ...
Posted by mrkite on Mon, 25 Oct 2021 18:12:52 -0700
Design mode 4 decorator mode
definition
Decorator Pattern is to dynamically attach responsibilities to objects. To extend functionality, decorators offer a more flexible alternative than inheritance—— HEAD First design pattern
Main role
Abstract decorated Component: the most primitive object that needs to be decorated. Such as the coverage class (super ...
Posted by chawezul on Mon, 25 Oct 2021 07:33:52 -0700
14, Combination mode
0. Ma Xian inspirational
It is not circumstances that make people, but man-made circumstances.
1. General
I'm sure I'll be very familiar with this picture. The above figure can be regarded as a file system. For this structure, we call it a tree structure. In the tree structure, we can traverse the whole tree by calling a method. When w ...
Posted by nike121 on Sun, 24 Oct 2021 11:01:41 -0700
16, Template method pattern
0. Ma Xian inspirational
Loneliness does not give others the opportunity to pity you, but gives you the opportunity to find yourself stronger.
1. General
In the process of object-oriented programming, programmers often encounter this situation: when designing a system, they know the key steps required by the algorithm and determine the e ...
Posted by Call-911 on Sun, 24 Oct 2021 10:49:50 -0700
Singleton design pattern
1, Application scenario of singleton mode
Singleton Pattern refers to ensuring that a class has absolutely only one instance in any case and providing a global access point. The Singleton Pattern is a creation pattern. Singleton mode is also widely used in real life. For example, national president, company CEO, Department Manager, etc. In J2E ...
Posted by picos on Sun, 24 Oct 2021 10:23:28 -0700
Agent model of design pattern
Proxy pattern is one of the most widely used design patterns. For example, aop in spring is the practice of proxy pattern. Generally, the dynamic proxy mode is widely used in java, and the common implementation methods are jdk dynamic proxy and cglib dynamic proxy.
Implementing dynamic proxy with jdk
Using jdk to implement dynamic proxy code ...
Posted by zxiny_chin on Sun, 24 Oct 2021 00:02:25 -0700
How is the mobile terminal adapted?
Common solutions to mobile terminal layout are:
1.flex flexible layout
1) The height is fixed, the width is adaptive, and px is used as the unit of elements.
2) As the screen width changes, the page will also change. The effect is similar to the fluid layout of the PC page. When the width needs to be adjusted, just use the responsive layout ...
Posted by ann on Fri, 22 Oct 2021 01:20:51 -0700