Object-oriented programming ideas and thought process-oriented programming differences

JS reflected here are two programming ideas: object-oriented programming and process-oriented programming, both of which are programming ideas, advantages and disadvantages

Process-oriented :

       Various methods have logic in the project development, some interaction, to create some, some seeking a result, the process-oriented programming is to focus on the process of a method of programming implementation, from top to bottom, in descending order of execution , step by step, gradually refined

Advantages: In the small size of the project, the more intuitive method to show the logical and easier to locate errors, the overall implementation of the order at a glance

Disadvantages: With the deepening development of the project, the amount of code will be more and more, the method is performed will be more complicated this time there will be scrambled if necessary, resulting in poor maintainability of the code,

Object-oriented:

       Is an object-centric programming ideas, he made us want to perform the method, split into a number of categories, the use of the properties and methods of the object hit the purposes of implementing the action, when needed go to call

Advantages: Modular and deeper, easier to solve large, complex business logic, can be done at any time to access, edit and maintainability can be higher in some complex scenarios, such as the need to temporarily change the order of execution at the middle of a and action, object-oriented better convergence

Disadvantages: higher object-oriented programming requirements, consider the dimensions of a broader, more complex logic, some newcomers are not very friendly, there is a method to interrupt execution speed caused the phenomenon, perhaps a bit less effective in a number of small projects

Both comparison:

First, different starting point

The former process is mainly performed, and the latter method based object properties

Second, the relationship between different logic levels and dimensions

The latter objective closer to life, to perform an action by the subject

Third, different ductility

The latter may have a better ductility in the longitudinal and lateral

Fourth, the action of different order of execution and realization of the principle of

The former process-driven data, the latter event-driven, object's own properties and data can only have their own functions to perform modifications

 

For example:

First, the elephant put into the refrigerator

Process-oriented:

 Open the refrigerator (the refrigerator) → filling (refrigerator, elephant) → closed (refrigerator)

Object-oriented:

Refrigerator door () → refrigerator loaded (elephant) → refrigerator. Close ()

Second, the customer sent courier (to perform an action involving multiple dimensions) by site

Process-oriented:

Submittals (customer) → Write (site) → payment (customer) → registration (customer sites) → sorting (site) → Mail (site)

Object-oriented:

Customers. Submittals () → site. Write () → Customer Payment () → site. Registration (), Customer Registration () → site. Sort () → site. Mail ()

Published 19 original articles · won praise 6 · views 10000 +

Guess you like

Origin blog.csdn.net/heyNewbie/article/details/105102840