Current location - Recipe Complete Network - Healthy recipes - What is the best analogy for object-oriented programming?
What is the best analogy for object-oriented programming?
The program written in a process-oriented way is a fried rice, while the program written in an object-oriented way is a rice dish. The so-called rice, Beijing called rice, the Northeast called braised rice, Guangdong called dish head rice, is a bowl of white rice topped with a dish, what you like, you pour what dish. I think the analogy is still apt.

I'm not sure about the details of how egg fried rice is made, because I've never been a chef and I don't know how to cook, but the final process is definitely to mix the rice and eggs and scramble them together. The rice, on the other hand, is the rice and cover vegetables are done separately, you if you want a braised pork cover rice it, you pour a braised pork; if you want a green pepper potatoes cover rice, you pour a green pepper shredded potato.

The good thing about egg fried rice is that it is evenly flavored and tastes good. If you don't like eggs and only like vegetables, the only way to get rid of it all is to make a new fried rice with vegetables. Covered rice is not so much of a hassle, all you need to do is toggle off the top and replace it with a covered dish. The downside of covered rice is that it's unevenly flavored and may not be as flavorful as egg fried rice.

Is egg fried rice or covered rice better? It's hard to answer any of these questions, and if you have to compare them, you have to set the scene, otherwise you can only say that each has its own strengths. If you are not a gourmet, not so much to talk about, then from the restaurant point of view, to make rice is obviously more advantageous than egg fried rice, he can be combined out of any number of combinations, and will not be wasted.

The good thing about rice is that the "dish" and "rice" are separated, thus increasing the flexibility of making rice. If you are not satisfied with the rice, you can change the rice, and if you are not satisfied with the dish, you can change the dish. In software engineering terminology, "maintainability" is better, and the coupling of "rice" and "food" is lower. Egg fried rice will be "egg" "rice" stirred together, want to change the "egg" "rice" in any one of them is very difficult, the coupling is very high, so that the "maintainability" is poor. One of the goals pursued by software engineering is maintainability, which is mainly manifested in three aspects: comprehensibility, testability and modifiability. One of the benefits of object orientation is that it significantly improves the maintainability of software systems.