Home  >  Article  >  Backend Development  >  What is the difference between object-oriented and process-oriented in php

What is the difference between object-oriented and process-oriented in php

清浅
清浅Original
2019-05-07 11:26:265862browse

The differences between process-oriented and object-oriented are: process-oriented is more efficient than object-oriented, object-oriented programming is more complex, but object-oriented is easier to maintain than process-oriented in the later stage.

What is the difference between object-oriented and process-oriented in php

Object-oriented

Object-oriented is to encapsulate some commonly used operations in classes for easy calling , just call it wherever you need it. This makes development and maintenance easy! Modifying this encapsulated class can achieve the purpose of modifying the entire site!

The three major features of object-oriented (encapsulation, inheritance, polymorphism) ensure efficiency and accuracy when doing complex things.

Process-oriented

Process-oriented means encapsulating the code into sub-processes or functions, and using separate code to operate in each place. If the development code is repeated, compare It is cumbersome and relatively troublesome to maintain. Wherever you modify it, it will only take effect.

The difference between process-oriented and object-oriented

(1) Process-oriented is more efficient than object-oriented. Process-oriented can directly call functions; object-oriented must first get the subject (object) ), and then call the internal function;

(2) Programming complexity: object-oriented is higher, process-oriented is abbreviated;

(3) Object-oriented is easier to maintain than process-oriented in the later stage.

The above is the detailed content of What is the difference between object-oriented and process-oriented in 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