The design pattern elements are: 1. Pattern name, used to describe the design pattern, solution and effect; 2. Problem, mainly describing when to use the design pattern; 3. Solution, describing the composition of the design Components, their interrelationships and their respective responsibilities and collaboration methods; 4. Effects, describing the effects of pattern application and the trade-offs of using patterns.
The basic elements of a design pattern are: pattern name, problem, solution and effect.
1. Pattern name: a mnemonic name used to describe design patterns, solutions and effects.
2. Question: Mainly describes when to use design patterns.
3. Solution: Describes the components of the design, their interrelationships, their respective responsibilities and collaboration methods
4. Effect: Describes the effect and usage mode of the pattern application A matter of trade-offs.
Design pattern (Design pattern) is a set of classified and cataloged summary of code design experience that is used repeatedly, known to most people. The purpose of using design patterns is to reuse code, make the code easier to understand by others, and ensure code reliability.
There is no doubt that design patterns are win-win for ourselves, others, and the system; design patterns make coding truly engineering; design patterns are the cornerstone of software engineering, just like the structure of a building.
For more related knowledge, please visit PHP Chinese website! !
The above is the detailed content of What are the elements of design patterns?. For more information, please follow other related articles on the PHP Chinese website!