PHP Tutorial: Introduction to PHP Design Patterns Introduction _php Tutorial

Source: Internet
Author: User
Introduction to the introduction of PHP design Patterns

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 is well translated into software development, and long-term desirability of using the original components to construct new solutions. Web Teaching Network

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

The identity of a design pattern is important because it allows other programmers to immediately understand the purpose of your code without having to learn it too deeply (at least through this identity the programmer will be familiar with the pattern).
The problem description is the area used to illustrate the application of this pattern.
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-it's been designed and coded, and it's a good choice if it fits exactly what you need. But if you are reading this book, you may find that the inventory (original) solution does not always work for you. So far you know what you want, and you can achieve it, you just need a model to guide you.

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. 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.

The goal of this book


The purpose of this book is not to comprehensively introduce the various types of software design patterns, nor to develop a new design pattern or terminology, but to highlight some of the well-known design patterns that are already in place. This book is unique in that it introduces some of the design patterns that I think are helpful for developing dynamic Web applications, and how these design patterns are implemented in the PHP language.


Oop in the face of object programming

One advantage of this book is that all viewpoints are based on the natural design pattern of OOP and are implemented using OOP.

If you are unfamiliar with OOP, there are a lot of related resources (books, websites, magazines, classes, etc.) to help you better understand it. Most OOP materials compliment its benefits-code reuse, code robustness, code encapsulation, polymorphism and extensibility-all of which are also important and useful. However, I think the main advantage of OOP is how it motivates you to break the problem down into manageable modules. Clear design and implementation, broken down into small modules so that your code can be more thoroughly tested and easier to understand and maintain.

Reader Skills Requirements

This book assumes that you are already able to use PHP fluently. In particular, this book assumes that you already understand the workings of PHP and PHP syntax and understand the fundamentals of using OOP to execute PHP code. This book is not an introductory book for PHP programming, nor is it intended to introduce the OOP programming of PHP.

Since not all OOP developers use the same terminology, I will define it in the body or in the toolbar when new terms are introduced.
    • Total 3 Pages:
    • Previous page
    • 1
    • 2
    • 3
    • Next page

http://www.bkjia.com/PHPjc/363972.html www.bkjia.com true http://www.bkjia.com/PHPjc/363972.html techarticle Introduction to PHP Design patterns When you are constantly trying to discover new features from your application, do you find the solutions you have proposed and some of the East ...

  • Related Article

    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.