What PHP design patterns are and how to understand _php tutorials

Source: Internet
Author: User
Tags what php

What is the PHP design pattern and how do you understand


Do the program development of friends should have heard the word design pattern, for Java development, should hear this word to understand what the meaning, but for the friend to do PHP, tend to see the more confused, then what is the design mode? In fact, the author does not understand, the following is a excerpt from the internet about the design patterns of some explanations, look forward to some understanding.

When you're constantly trying to discover new features from your application, do you find that the solution you're proposing is similar to something you've already implemented in the past? If you are a programmer (even if you start a short time), you may be able to answer "yes". It seems that you have used some of the previous code to solve the new problems that are discovered in the software development process. You may have realized that your solution is the basic principle, a method that is more than just you and is a widely repeated application for all professional developers.

In fact, many of the procedural problems are constantly recurring, and many of the basic methods used to solve these problems (or design patterns) have surfaced. Design patterns are a template that teaches you how to organize your code with real and reliable design.

Design Pattern History

The term "design pattern" was originally designed for the field of architecture. Christopher Alexander in his 1977 book, "A Pattern language:towns/building/construction", which describes some common architectural design problems and explains how to use them, A well-known collection of patterns to start a new and effective design. Alexander's view has been well translated into software development and has long been used to construct new solutions with existing components.

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

1, a design pattern of the logo is important, because it will let other programmers without too deep learning to understand the purpose of your code immediately (at least through this logo programmer will be familiar with this mode).

2. The problem description is a field used to illustrate the application of this pattern.

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

A pattern is an effective way to solve a particular problem. A design pattern is not a library (a code base that can be included and used directly in your project), but rather a template for organizing your code. In fact, a code base and a design pattern have many different applications.

For example, a shirt you buy from a store is a code base whose color, style, and size are determined by the designer and manufacturer, but it meets your needs. However, if there is nothing in the shop that suits you, you can create your own shirt (design its shape, choose the fabric, and then tailor it together). But if you are not a tailor, you may find it easy to find a suitable pattern and then follow this pattern to design your own shirt. With a model, you can get a skilled design shirt in less time.

Back to the discussion software, a data extraction layer or a CMS (Content management System) is a library that has been previously designed and encoded, and it is a good choice if it can accurately meet your needs.

The last idea: like a tailor's model, a design itself is useless. After all, you can't wear a costume model, it's just a piece of thin paper together. Similarly, a software design model is just a guide. It must be designed according to the programming language and the characteristics and requirements of your application.

Also introduce a PHP design mode of the site is phppatterns, website: http://www.phppatterns.com

Articles you may be interested in

    • PHP Single entry mode detailed explanation
    • PHP calculates a function that is currently the first week of the year or January
    • PHP with header () to achieve file download, download the file hint is broken can not open the solution
    • PHP Records search engine Routing and search input keywords
    • PHP Regular Expressions using detailed (3)
    • PHP Regular Expressions using detailed (2)
    • What does the average dwell time of 0 seconds mean in the statistical results?
    • Detailed explanation of phpMyAdmin configuration file

http://www.bkjia.com/PHPjc/976849.html www.bkjia.com true http://www.bkjia.com/PHPjc/976849.html techarticle PHP design mode is what, how to understand that the development of a friend should have heard of the design pattern of the word, for Java development, should hear the word to 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.