Java is an object-oriented language, which is not very clear about object-oriented and process-oriented. Please take a look at the following content and may be helpful to you:
Process-oriented is to analyze the steps required to solve the problem, and then use functions to implement these steps Step by step. You can call these steps one by one. Object-oriented refers to dividing a problem transaction into various objects. The object is created not to complete a step, but to describe the behavior of a thing in the whole process of solving the problem.
For example, wuziqi, the process-oriented design is the first step to analyze the problem:
1. Start the game,
2. sunspots first,
3. Draw pictures,
4. Determine whether to win or lose,
5. It's white's turn,
6. Draw pictures,
7. Determine whether to win or lose,
8. Return to step 2,
9. output the final result.
The above steps are implemented using separate functions, and the problem is solved.
The object-oriented design solves the problem from another idea. The entire Wuzi game can be divided:
1. Both sides of the black and white sides share the same behavior,
2. The checkerboard system is responsible for drawing pictures,
3. The rule system is responsible for determining such as foul and win/lose.
The first type of object (Player Object) is responsible for accepting user input, and notifying the second type of object (board object) of the changes in the layout of the pawns, when the checker object receives the changes of the pawns, it is responsible for displaying the changes on the screen. At the same time, it uses the third type of objects (rule system) to determine the game board.
It can be seen that object-oriented is to divide the problem by functions rather than steps. The same is drawing board games. Such behavior is distributed across multiple steps in the process-oriented design, and different drawing versions may appear, because the designers usually take into account the actual situation for a variety of simplification. In the object-oriented design, plotting can only appear in the chessboard object, thus ensuring the unity of drawing.
The unified functions Ensure the scalability of the object-oriented design. For example, I want to add the regret function. If I want to change the process-oriented design, I need to change the input, judgment, and display steps, even steps must be adjusted on a large scale in sequence. If it is object-oriented, you only need to modify the chessboard object. The checkerboard system saves the chess spectrum of both sides of the black and white, and simply backtrack the Board object. The display and rule judgment do not need to be taken into account, at the same time, the calling sequence of the object function is not changed, but the changes are only partial.
Here we can clearly see the difference between object-oriented and process-oriented.