Day5-1 Object-oriented and process-oriented

Difference between object oriented and procedural oriented:

1. Process-oriented is like the assembly line of the factory, and the orderly work is done step by step.

Pros: Simplify complex problems

Disadvantages: poor scalability. If one step is changed, almost all other steps must be changed.

Applicable: Scenarios where functionality rarely needs to be changed once implemented.

2. Object-oriented:

2-1 What is an object?

The object has a collection of some characteristics and methods. For example, Sun Wukong is an object, and his characteristics are the hairy face, Lei Gongzui, golden hoop rod, and golden hoop.

Advantages: Strong scalability

Disadvantage: High programming complexity.

Applicable: Internet applications, enterprise applications, games.

Class: is a combination of similar characteristics and skills of a series of objects

From different perspectives, the categories obtained are different. For example, from the perspective of biological categories, people, flowers and trees are all in one category and belong to the biological category. From the perspective of humans, humans are a separate category, while flowers, plants and trees are plants kind.

So is there an object or an existing class first? 

In the real world: existing objects, then classes.

In the program: first define the class, and then generate the object by calling the class.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324787229&siteId=291194637