Decorator mode
Structure and implementation of decorator mode
Usually, the function of extending a class is implemented by inheritance. However, inheritance has static characteristics, high coupling, and subclasses will expand with the increase of extended functions. The goal of decorator pattern is to create a wrapper object (i.e. decoration object) to wrap ...
Posted by sheckel on Tue, 11 Jan 2022 02:07:26 +0100
Java Design Patterns - adapter pattern, bridge pattern, decorator pattern
Chapter 9 adapter mode
9.1 basic information
Basic introduction (1) Adapter pattern converts the interface of a class into another interface expected by the client. The main purpose is compatibility, so that two classes that cannot work together due to interface mismatch can work together. Its alias is wrapper (2) The adapter mode is a st ...
Posted by mephistoo on Mon, 10 Jan 2022 17:51:43 +0100
Strategy mode 2 of Glide design pattern [DownsampleStrategy]
Strategy mode II
DownsampleStrategy
Package path: com bumptech. glide. load. resource. bitmap. DownsampleStrategy
Indicates the algorithm used when down sampling the image. DownsampleStrategy does not provide any guarantee about the output size. The behavior will vary, depending on the strategy used by the ResourceDecoder and the Android ver ...
Posted by kemper on Mon, 10 Jan 2022 07:10:39 +0100
Design mode [10] - by the way, take a look at the sharing mode
Design pattern series: http://aphysia.cn/categories/designpattern
The beginning is still like that. Please look down
What is the meta model?
FlyWeight mode is a kind of structural mode, which is mainly used to reduce the number of created objects, reduce memory consumption and improve performance. Speaking of this, I wonder if you think of poo ...
Posted by Steveo31 on Sun, 09 Jan 2022 10:52:52 +0100
Design pattern learning day2
Factory mode
extraction
Scene introduction
Look at a pizza project: it should be convenient for the expansion of pizza types and maintenance
1. There are many kinds of pizza (such as greenpizza, CheesePizz, etc.)
2. Pizza making includes prepare, bake, cut and box
3. Complete the pizza shop ordering function.
(1) Pizza's parent abstract class
/ ...
Posted by airric on Sat, 08 Jan 2022 15:04:57 +0100
Case demonstration of strategic model of behavior model
1. Introduction to strategy mode
Strategy pattern is a behavior pattern and a sharp tool to replace a large number of ifelse. The scenarios it can solve are generally those with similar replaceable behavioral logic algorithms. For example, different types of transactions (credit cards, Alipay, WeChat), the unique ID strategy (UUID, DB self i ...
Posted by madwormer2 on Sat, 08 Jan 2022 13:07:17 +0100
Design mode responsibility chain mode
catalogue
preface:
Definition and characteristics:
Structure and Implementation:
give an example:
preface:
In the real world, many objects do not exist independently, and the behavior change of one object may lead to the behavior change of one or more other objects. For example, when the price of a commodity rises, some businesses will ...
Posted by thunderdogg on Thu, 06 Jan 2022 13:03:24 +0100
How to do the opening and closing principle with C + +?
C + + language is famous for its powerful function and super complexity. Many people are still confused after learning for many years. The reason is that C + + language mainly has four programming paradigms: process oriented programming, object-oriented programming, generic programming and functional programming. Each paradigm is already very ...
Posted by bulgaria_mitko on Wed, 05 Jan 2022 01:37:06 +0100
The interviewer asks you JVM, do you know where the bonus item is?
introduction
In the process of interviewing others, the JVM memory model almost needs to be asked, although some people say that these are the interview to build an aircraft carrier and screw up the work. If you want to be a CRUD coder, you can choose not to know this.
In the question and answer of JVM memory model, some people can say that o ...
Posted by msk_1980 on Tue, 04 Jan 2022 20:49:13 +0100
make and makefile file format of Linux
Another solution is to escape with a backslash before the newline character.
var-kept:
export foo<span class="token operator" style="margin: 0px; padding: 0px; list-style-type: none; border: none; color: rgb(166, 127, 89);">=</span>bar<span class="token punctuation" style="margin: 0px; padding: 0px; list-style-ty ...
Posted by jaxxstorm on Tue, 04 Jan 2022 15:31:49 +0100