8 relative layout - RelativeLayout
In the previous section, we talked about LinearLayout, which is also the first layout you learned. It supports multiple views in a linear manner (horizontal or vertical) combination. The most practical one is the weight attribute. Using weight well can make your linear layout more flexible and beautiful. However, in the example in the previous ...
Added by yaba on Wed, 22 Dec 2021 06:39:29 +0200
Design pattern - prototype pattern
Prototype mode (Prototype Pattern) is used to create duplicate objects while ensuring performance. This type of design pattern belongs to the creation pattern, which provides the best way to create objects. This pattern implements a prototype interface, which is used to create clones of the current object. This pattern is used when the cost of ...
Added by sidney on Wed, 22 Dec 2021 02:10:49 +0200
Learning design pattern - Decorator Pattern
summary
Decorator Pattern allows adding new functions to an existing object without changing its structure. It is used as a wrapper for an existing class.
To extend the functionality of an object, the decorator pattern provides a more flexible alternative than inheritance. Combination is better than inheritance.
When to use:
You need to ext ...
Added by lordphate on Tue, 21 Dec 2021 20:26:36 +0200
C + + implementation factory mode
1, Simple factory mode
1.1 simple factory mode
Simple Factory Pattern specifically defines a class to be responsible for creating instances of other classes. The created instances usually have a common parent class.
Simple factory mode is a way to instantiate objects. As long as you enter the name of the object to be instantiated, you can cr ...
Added by david212 on Tue, 21 Dec 2021 12:16:01 +0200
Design pattern - mediator pattern
1, Basic introduction
English Name: MediatorConcept: encapsulate a series of object interactions with a mediation object. The mediator makes the objects interact without display, so that their coupling is loose, and the interaction between them can be changed independentlyMode type: structuralDesign principle:Main features: a class is only res ...
Added by aztec on Mon, 20 Dec 2021 23:04:07 +0200
Design pattern - adapter pattern (including class adapter and object adapter)
Related links:
[design mode] column: [design mode] column
Relevant examples can be downloaded: Examples of common Java design patterns
Adapter mode
preface
In real life, there are often instances where two objects cannot work together due to incompatible interfaces. At this time, a third party needs to adapt. For example, a Chinese s ...
Added by magic123 on Mon, 20 Dec 2021 04:37:43 +0200
Design mode - responsibility chain mode
brief introduction
Commons chain is a subproject of apache commons. It is mainly used in the "responsibility chain" scenario. The call process of action in struts is supported by the "chain" framework If your project also has requirements based on this scenario, you can consider using itThe so-called "responsibility ch ...
Added by bender on Sun, 19 Dec 2021 21:53:14 +0200
Quickly understand factory mode
Factory mode:
effect:
It realizes the separation of caller and calleeDetailed classification
Simple factory modeFactory method modelAbstract factory pattern
Meet the seven principles of OOP
Opening and closing principleDependency Inversion PrincipleDimitt's law
Three modes
Simple factory mode:
It is used to produce any product in ...
Added by ReVeR on Sun, 19 Dec 2021 18:19:43 +0200
Common PHP design pattern factory pattern
Recently, I participated in several interviews and felt deeply about the application of several common design patterns. In order to strengthen their own understanding, and also hope to give some junior developers some reference learning, I decided to start writing a few blog posts on common PHP design patterns. The working reasons will be updat ...
Added by xploita on Sun, 19 Dec 2021 16:02:23 +0200
[design pattern] - Abstract Factory pattern
Abstract factory
The object creation mode bypasses new to avoid the tight coupling caused by the object creation (new needs to rely on specific classes), so as to support the stability of object creation. It is the first step after abstracting the interface
motivation
It mainly solves a series of "interdependent objects". The F ...
Added by dannyd on Sun, 19 Dec 2021 15:52:33 +0200