Summary of design pattern usage

Source: Internet
Author: User
Tags php websocket socket error
Single Responsibility principle definition: Do not have more than one cause of class changes. In layman's terms, a class is responsible for only one responsibility. Richter replacement Principle Definition 1: If for each object of type T1, there is an object O2 of type T2, so that all program P defined by T1 is replaced with O1 for all objects O2, the behavior of program p does not change, then type T2 is a subtype of type T1. Definition 2: All references to base classes must be able to transparently use objects of their subclasses. In other words, a subclass can appear where any base class can appear. The principle of the Richter substitution is popular: Subclasses can extend the functionality of the parent class, but cannot change the original functionality of the parent class. It contains the following 4 levels of meaning: 1). Subclasses can implement the abstract methods of the parent class, but cannot override the non-abstract methods of the parent class. 2). Subclasses can add their own unique methods. 3). When a method of a subclass overloads a method of the parent class, the method's preconditions (that is, the parameter of the method) are more lenient than the input parameters of the parent class method. 4). When a method of a subclass implements an abstract method of the parent class, the post condition of the method (that is, the return value of the method) is more than

1. Design Pattern 6 Principles Summary

Summary: Single Responsibility Principle definition: Do not have more than one cause of class changes. In layman's terms, a class is responsible for only one responsibility. Richter replacement Principle Definition 1: If for each object of type T1, there is an object O2 of type T2, so that all program P defined by T1 is replaced with O1 for all objects O2, the behavior of program p does not change, then type T2 is a subtype of type T1. Definition 2: All references to base classes must be able to transparently use objects of their subclasses. In other words, any base class can appear ...

2.10 article Recommendations on MVC Design Patterns

Introduction: First, code organization (directory structure) Two, MVC overview MVC design pattern is the MVC framework. The full name of MVC is the model View Controller, which is the abbreviation for models-View-Controllers (Controller), a software design paradigm that organizes code with a method of explicit separation of business logic and data. By aggregating business logic into a single component, the interface and user interaction around the data can be improved and customized without the need to rewrite the business logic. MVC is uniquely developed to reflect ...

3.5 article recommendations on open closure

Introduction: This article mainly introduces the Java design mode of the open closure principle, small series feel very good, and now share to everyone, but also for everyone to do a reference. Come and see it together. Written in front recently, took over a new business, the architecture of the system is commendable. But some places are daunting, and some code bloat is hard to maintain, and it's not flattering. Then, combining the open closure principle of Java, some of the code is reconstructed and optimized. First look at the old code of the previous system SHARECHANNELMANAGER.JAVAPUBLIC&NB ...

4. Recommended for 10 articles on design

Summary: What is a custom function library? A function library is not a PHP syntax for defining functions, but rather a design pattern when programming. function is the module of structured programming, which is the core of implementing code reuse. To better organize your code, a custom function can be used in multiple files of the same project, typically organizing multiple custom functions into the same file or multiple files. The files defined by these collection functions are the creation of PHP function libraries. If you want to use the functions defined in these files in a PHP script, you need to use include (), include_once (...).

5. A detailed introduction to the Custom function library

Summary: What is a custom function library? A function library is not a PHP syntax for defining functions, but rather a design pattern when programming. function is the module of structured programming, which is the core of implementing code reuse. To better organize your code, a custom function can be used in multiple files of the same project, typically organizing multiple custom functions into the same file or multiple files. The files defined by these collection functions are the creation of PHP function libraries. If you want to use the functions defined in these files in a PHP script, you need to use include (), include_once (...).

6. Recommended examples of introductory tutorials

Summary: jquery is a fast, concise JavaScript framework that encapsulates the functionality code commonly used by JavaScript, providing a simple JavaScript design pattern that can help us optimize HTML document operations, event handling, and bothered in our everyday hair. and animation design and Ajax interaction, only need a small amount of code, you can integrate them into the site, and can help visitors to share the content on the site, greatly improve our development efficiency, then we present to you a few jquery introductory tutorial, including Jquer ...

7. jquery Introductory Tutorial: 5 jquery Classic Introductory tutorials recommended

Summary: jquery is a fast, concise JavaScript framework that encapsulates the functionality code commonly used by JavaScript, providing a simple JavaScript design pattern that can help us optimize HTML document operations, event handling, and bothered in our everyday hair. and animation design and Ajax interaction, only need a small amount of code to integrate them into the site, and can help visitors to share the content on the site, greatly improve our development efficiency, then we present to you today a few jquery introductory tutorials, including the jquery introductory video tutorial, Tutorials on online manuals and jquery code.

8. Summary of common socket error errors

Summary: The socket is an intermediate software abstraction layer for the application layer to communicate with the TCP/IP protocol family, which is a set of interfaces. In design mode, the socket is actually a façade mode, it is the complex TCP/IP protocol family hidden behind the socket interface, for the user, a set of simple interface is all, let the socket to organize data to meet the specified protocol.

9. How to create a simple chat room using PHP websocket

Introduction: Socket is the application layer and TCP/IP protocol Family Communication intermediate software abstraction layer, it is a set of interfaces. In design mode, the socket is actually a façade mode, it is the complex TCP/IP protocol family hidden behind the socket interface, for the user, a set of simple interface is all, let the socket to organize data to meet the specified protocol.

PHP Object-oriented Advanced design pattern: Observer Pattern Usage Example

Introduction: What is Observer mode? The observer design pattern makes it easier to create objects that view the state of the target object, and provides the specified functionality that is not coupled to the core object. The pattern is very simple: an object is made observable by adding a method that allows another object, the observer to register itself. When an observable object changes, it sends the message to the registered observer. These observers use this information to perform operations that are independent of observable objects. The result is that objects can talk to each other without knowing why.

"Related question and answer recommendation":

On the MVC design pattern of Swift under the great God Popular Science

Does Python have design patterns?

Javascript-script.onload runtime, miniconsole refers to the JS file in the object, why is not the HTML Miniconsole object?

PHP-which frame of the source is suitable for reading learning?

Javascript-react how to combine with some design patterns of JS

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.