Home  >  Article  >  Backend Development  >  What is the core idea of ​​php

What is the core idea of ​​php

王林
王林Original
2019-09-27 11:57:522915browse

What is the core idea of ​​php

The core idea of ​​OOP in PHP

1. What is OO

OO(Object –Oriented) Object-Oriented Method (Object-Oriented Method, Object-Oriented Method) is a systematic method that applies object-oriented ideas to the software development process to guide development activities, referred to as OO (Object- Oriented) method, Object Oriented is a methodology based on the concept of "object".

An object is an encapsulation composed of data and allowed operations. It has a direct correspondence with the objective entity. An object class defines a group of objects with similar properties. Inheritance is a way to share attributes and operations of classes with hierarchical relationships.

The so-called object-oriented is based on the object concept, with the object as the center, and classes and inheritance as the construction mechanism, to recognize, understand, depict the objective world and design and build the corresponding software system.

2. What is the core idea of ​​OOP?

Object-oriented programming (Object Oriented Programming, OOP, object-oriented programming) is a computer programming architecture. A basic principle of OOP is that a computer program is composed of a single unit or object that functions as a subroutine.

Core ideas: encapsulation, inheritance, polymorphism.

OOP achieves the three main goals of software engineering: reusability, flexibility and scalability. In order to realize the overall operation, each object can receive information, process data and send information to other objects.

OOP mainly has the following concepts and components:

Component - The unit in which data and functions are formed together in a running computer program. Components are the basis of modules and structure in OOP computer programs.

Abstractness - The program has the ability to ignore certain aspects of the information being processed, that is, the ability to focus on the main aspects of the information.

Encapsulation - Also called information encapsulation: ensure that components will not change the internal state of other components in unexpected ways; only in those components that provide internal state changing methods, this can access its internal state. Each type of component provides an interface to communicate with other components and specifies methods for other components to call.

Polymorphism - Component references and class sets involve many other different types of components, and the results generated by the referenced component depend on the actual type of call.

Inheritance - Allows the creation of subclassed components based on existing components, which unifies and enhances polymorphism and encapsulation. Typically, classes are used to group components, and new classes can also be defined as extensions of existing classes, so that classes can be organized into a tree or network structure, which reflects the versatility of actions.

Component-based programming has become particularly popular in scripting languages ​​due to reasons such as abstraction, encapsulation, reusability, and ease of use. Python and Ruby are languages ​​that have only appeared recently and fully adopted OOP ideas when developing. The popular Perl scripting language has slowly added new object-oriented functional components starting from version 5.

The use of components to replace "real" entities has become the reason why JavaScript (ECMAScript) has become popular. There is evidence that the appropriate combination of components can replace the Document Object Model (DOM) of HTML and XML on the Internet. ).

Recommended tutorial: PHP video tutorial

The above is the detailed content of What is the core idea of ​​php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn