Home > Backend Development > PHP Tutorial > PHP Design Patterns – Overview

PHP Design Patterns – Overview

WBOY
Release: 2016-08-08 09:26:38
Original
831 people have browsed it

Disclaimer: The reference material for this series of blogs is "Dahua Design Pattern", written by Cheng Jie. There are about 23 common object -oriented design patterns in 向 面, but since contacting PHP, it has gradually discovered that the common design mode seems to be much less, there are relatively few information on the Internet, and the PHP around you is. Some colleagues have not even heard of design patterns. This may also be caused by the development of PHP, because PHP supports object-oriented objects relatively late, and many PHP programmers still write code according to process-oriented ideas. So, I decided to rewrite the object-oriented design pattern originally written in C# into PHP.


What are design patterns?


Design pattern (

Design

Pattern

) is a set of classified and cataloged

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. DesignPatterns are win-win for you, others, and the system; design patterns make code compilation truly engineering; design patterns are the cornerstone of software engineering, just like the structure of a building. The reasonable use of the design model in the project can perfectly solve many problems. Each mode has corresponding principles to correspond to it. Each mode describes a repeated occurrence of a repeated occurrence around us. The problem , and the core solution to the problem, which is why it is widely used. Advantages of design patterns:

1).Reusable solutions: Design patterns themselves are universal solutions to a certain type of problem and are a higher level Reuse has gone beyond code reuse.

                                                                                                                                                                                                              Communication and collaboration in development require a common vocabulary and a consensus on the problem

. When you have

want to express but cannot express clearly design ideas, even if When expressions can be misunderstood by colleagues, design patterns show their communication advantages.

3).code is easier to modify and maintain. Because design patterns are time-tested solutions, their structures are formed after long-term development, and they are good at coping with changes. The design patterns themselves also encapsulate the change points. 4). mode helps to improve the level of thinking. After learning the pattern, you will be able to adopt better strategies to solve problems even if you don’t use the methods in the pattern.

In the following pages, we will introduce the PHP object-oriented design pattern in detail. This series of blogs takes the principles of design patterns as the core and lists the simplest examples, so that those who have a little bit of object-oriented foundation can Readers can understand it. Sharing a PPT I trained within the company, 23 object-oriented design patterns, the example language is C#, the source code will be provided after the end of this series of tutorials:

23 commonly used object-oriented design patterns Design Patterns

The above introduces the PHP design pattern - an overview, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template