What is the php design pattern and how to understand it? _ PHP Tutorial

Source: Internet
Author: User
What is the php design pattern and how to understand it. What is the php design pattern? I have heard of the word "design pattern" and how to understand it. for java development, when I hear this word, I should understand what it means. what is the php design pattern? How should I understand it?

I have heard of the word design pattern before developing programs. for java developers, I should understand what it means when I hear it, but for PHP friends, what is the design pattern? As a matter of fact, the author does not understand it either. The following are some interpretations of the design patterns excerpted from the Internet, and I look forward to some understanding.

When you are constantly trying to discover new features from your application, do you find that the solution you proposed is so similar to something you have previously implemented? If you are a programmer (even if you start for a short time), you may answer "yes ". It seems that you have used some previous code to solve the newly discovered problems in the software development process. You may have realized that your solution is a basic principle and a method that is not only applicable to you but also widely used by all professional developers.

In fact, many program problems are constantly encountered, and many basic methods (or design patterns) used to solve these problems have emerged. The design pattern is a template that teaches you how to organize your code using authentic and reliable design.

Design Pattern History

The term "design patterns" was initially designed for the field of architecture. Christopher Alexander described some common architectural design problems in his 1977 book "A Pattern Language: Towns/Building/Construction" and explained how to use these existing, A collection of famous patterns to start a brand new effective design. Alexander's point of view is well transformed into software development, and the old components are used to construct new solutions for a long time.

All design patterns have some common features: a name, a problem statement, and a solution ).

1. the logo of a design pattern is important, because it allows other programmers to understand the purpose of your code immediately without having to study it too deeply (at least the programmer will be familiar with this pattern through this identification ).

2. the problem description is used to describe the application fields of this model.

3. the solution describes the execution of this model. The discussion of a good design model should cover the advantages and disadvantages of using this model.

One mode is an effective way to solve specific problems. A design pattern is not a library (a code library that can be directly included and used in your project) but a template used to organize your code. In fact, there are many differences between a code library and a design model in applications.

For example, the color, style, and size of a shirt you buy from a store is determined by the designer and manufacturer, but it meets your needs. However, if there are no clothes in the store that suit you, you can create your own shirt (design its shape, select the fabric, and then make a tailor together ). But if you are not a tailor, you may find it easy to find a proper pattern and then design your shirt according to the pattern. With a model, you can get a well-designed shirt in less time.

Back to the discussion Software, a data extraction layer or a CMS (content management system) is a library that was previously designed and encoded, if it meets your needs accurately, it is a good choice.

Last thought: like a tailor model, a design itself is useless. After all, you cannot wear a clothing model, which is simply pieced together by thin paper. Similarly, a software design model is just a guide. It must be specifically designed based on the programming language and the characteristics and requirements of your application.

Another introduction about the PHP design patterns site is phpPatterns, URL: http://www.phppatterns.com

Articles you may be interested in
  • Php single entry mode
  • Php calculates the number of weeks in a year or January.
  • Php uses header () to download files. the downloaded files prompt that they are damaged and cannot be opened.
  • PHP records search engine paths and keywords
  • PHP regular expressions (3)
  • PHP regular expressions (2)
  • What does the statistical result mean when the average stay time is 0 s?
  • Phpmyadmin configuration file description

Developers should have heard of the word "design pattern". for java developers, they should hear the word and understand what it means...

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.