"PHP Objects,patterns, and practice" reading notes
Model Basics: What is design mode?
Patterns are a solution to similar problems in a given environment.
--Four-person group (Gang of four) design mode: The basis of reusable object-oriented software
Similar problems are always recurring, and as time goes by and experience accumulates, we can solve these problems gracefully or with difficulty, and summarize some informal solutions that can be reused in the project, and these solutions are design patterns.
Pattern structure: A key element of each design pattern.
The core of a design pattern is composed of four parts: naming, problems, solutions, and effects.
Naming: both concise and descriptive;
Problem: The environment in which problems and problems occur is the basis of a pattern, and finding a problem is more difficult than using a solution in a pattern catalog. This is one of the reasons that formal solutions to certain patterns are misused or overused;
Solution: The pattern describes a solution to a problem, but there may be hundreds of subtle differences in implementation, and "solutions" can be called "semi-finished products in design mode";
Effect.
"PHP design mode" written in front