PHP design patterns-overview

Source: Internet
Author: User
: This article mainly introduces the PHP design mode-Overview. if you are interested in the PHP Tutorial, refer to it. Disclaimer: Cheng Jie, author of this series of blog references "big talk Design Mode.


There are about 23 common object-oriented design patterns, but since I got started with PHP, I gradually found that there are fewer common design patterns and less information on the network, some of my colleagues in PHP have not even heard of the design pattern, which may be due to the development of PHP, because PHP has a late support for object-oriented programming, many PHP programmers write code according to the process-oriented idea. So I decided to rewrite the object-oriented design pattern originally written in C # with PHP.


What is the design model?

Design Pattern is a set of summary of code Design experiences that are repeatedly used, known to most people, classified and catalogued. The design pattern is used to make code reusable, make it easier for others to understand, and ensure code reliability. The design pattern is win-win for others and the system; the design pattern enables code compilation to be truly engineered; the design pattern is the cornerstone of the software engineering, just like the structure of the building.

The rational use of the design pattern in the project can perfectly solve many problems. each pattern has a corresponding principle in the present, each pattern describes a recurring problem around us and its core solution, which is also the reason for its wide application.

Advantages of the design model:

1). reuse solution: the design pattern itself is a general solution for a certain type of problem. it is a more advanced reuse that exceeds code reuse.

2 ). determine general terms: communication and collaboration in development require a common vocabulary and consensus on issues. when you want to express but unclear design ideas, even if they are expressed by colleagues, the design model shows the advantages of communication.

3) the code is easier to modify and maintain. Because the design patterns are proven solutions, their structures are developed over a long period of time and are good at coping with changes. The Design patterns themselves are also the encapsulation of change points.

4). patterns help increase the level of thinking. After learning the model, even if the method in the model is not used, a better strategy will be taken to solve the problem.



In the following sections, we will introduce the PHP object-oriented design mode in detail. this series of blogs focus on the principles of the design mode and list the simplest examples, this helps readers who have a little object-oriented knowledge to understand.

I will share a PPT for my internal training in our company. There are 23 object-oriented design models, and the instance language is C #. the source code will be provided after this series of tutorials:

23 common object-oriented design modes

The above introduces the PHP design mode-overview, including the content, hope to be helpful to friends who are interested in the PHP Tutorial.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.