Experience: differences between object-oriented and process-oriented

Source: Internet
Author: User

Experience: differences between object-oriented and process-oriented

Object-oriented: linear thinking. And process orientation. In the software development process, we use object-oriented methods to grasp the complex relationship between things and analyze the system. At the micro level, process orientation is still used.

"Process-oriented" is an event-centric programming idea. Is to analyze the steps required to solve the problem, and then use the function to write the steps and call them in order.

"Object-Oriented" is an object-oriented programming idea.

 

A simple example is automobile launch and arrival. Auto Start is an event, while bus arrival is another event. In the process of process-oriented programming, we are concerned with events rather than the car itself. For the above two events, two functions are formed and then called in sequence.

For object-oriented objects, we are concerned with objects such as automobiles. The two events are only the actions of such objects. The order of these two behaviors is not mandatory.

Process-oriented thinking is integrated analysis, and object-oriented thinking is construction.

 

Scalability:

Simply put: a program written with a process-oriented method is an egg fried rice, while a program written with object-oriented method is a rice bowl. For example, you can add a dish to your rice. I think this metaphor is more appropriate.
I am not very clear about the details of fried rice with eggs, because I have never been a cook or cook, but the last step is to mix rice and eggs and stir fry them together. The rice and the vegetable are prepared separately. If you want a braised pork bowl, you will be given a braised pork bowl. If you want a green pepper and potato rice bowl, just pour a copy of green peppers and potatoes.

The benefit of fried rice with eggs is that it tastes even and tastes delicious. If it happens that you don't like eggs, but you only love vegetables, the only way is to drop them all and cook a new fried rice with vegetables. You don't have to worry about it. You just need to drop the top course and change it. The disadvantage of the rice bowl is that the taste is uneven and may not be as sweet as the fried rice.
Is it good for fried eggs or rice? In fact, this type of question is difficult to answer. If you have to compare the upper and lower levels, you must set a scenario. Otherwise, you can only say that you have your own strengths. From the perspective of a restaurant, it is obvious that cooking rice with rice covered is more advantageous than cooking rice with eggs. It can combine as many combinations as possible without waste.

The advantage of "food" and "rice" separation improves the flexibility of Rice Bowl preparation. If you are not satisfied with the food, you can change the food. The term "maintainability" is better, and the coupling between "meal" and "Dish" is relatively low. Fried rice with eggs brings together "eggs" and "rice". It is very difficult to change any of the "eggs" and "rice". The coupling degree is so high that the "maintainability" is poor. One of the goals of software engineering is maintainability. maintainability is mainly manifested in three aspects: comprehensibility, testability, and modifyability. One of the benefits of object-oriented is that it significantly improves the maintainability of the software system.

Does process-oriented (OP) and object-oriented (OO) refer to two encoding methods? No! You get a user requirement. For example, if someone asks you to compile a software program, do you need to analyze the requirements, perform the overall/detailed design, and finally code the software to write it out, deliver to users. This process is in line with the basic ways of human behavior: first, what to do, then how to do, and finally to do things. Some people said, "I did not follow the steps you mentioned. I coded them directly ". In fact, you must have gone through these three stages, but you do not know clearly in your subconscious. For those who get the code they need, they may write the code and have to go back and rethink the process,

Taking OO as an example, corresponding to the software development process, OO derives three concepts: OOA, OOD, and OOP. OOA is called the method of object-oriented analysis, the method of designing with object-oriented is called OOD, and the method of coding with object-oriented is called OOP. The essential difference between process-oriented (OP) and object-oriented (OO) lies in the different analysis methods, which leads to different encoding methods.

 

In general:

Object-oriented means to make things highly abstract.

 

Process-oriented is a kind of top-down programming.

 

You must first create an abstract model for Object-Oriented objects and then directly use the model.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.