Talking about the difference between the python object-oriented programming and process-oriented programming


Process-oriented: to analyze the steps required to solve the problem, then use the function to implement these steps, step by step, and then use the time to call one by one in turn.
Advantages: High performance
Cons: Compared to the object-oriented terms, difficult to maintain and difficult to reuse can not be extended
for small projects
object-oriented programming: the transaction decomposed into one object, and then by the division of labor and cooperation between objects.
Advantages: easy to maintain and reuse, easy to expand, low coupling, more flexible system
has three characteristics: encapsulation, inheritance, polymorphism
drawback: the process for low-performance ratio
for large-scale collaborative projects more than


write out a process-oriented approach to program is like a fried rice, scrambled eggs, mix some onion, carrots, peas, stir fry for a moment, then added the rice pot, add spices, what soy sauce MSG, egg and rice blend together and mixed well with a variety of spices, the smell has permeated the rice inside. Eat up to pass up. However, I do not like people who eat eggs is not so friendly.


Written with object-oriented programming is like a rice bowl, can be cooked to different people's preferences, some like tomato scrambled eggs rice bowl, some like green pepper pork rice bowl, can be directly Cook the rice to pile on it, meals are independent of each other, because the juice is covered on top of the rice, stir stir when eating needs, let the flavor of juice slowly integrated into the rice, no eggs fried rice came so simply.

Fried rice with the rice bowl so no one can instead of who they are prepared for different food goods.

 

Guess you like

Origin www.cnblogs.com/wangyi0419/p/11329295.html