2018-04-29
Existence must be reasonable
Software Development Approach
First, process-oriented
" Process oriented " (Procedure oriented) is a process-centric programming idea. These are programmed with what is happening as the main goal.
Process-oriented is to analyze the steps required to solve the problem, and then use the function to implement these steps step by one, using a one-time call to be able.
For example Gobang, the process-oriented design approach is the first step in analyzing the problem:
1, start the game, 2, Sunspot first go, 3, draw the screen, 4, Judge Win and lose, 5, turn to white son, 6, draw screen, 7, Judge Win and lose, 8, return step 2,9, output the final result.
Implement each of the above steps in a different way.
The least process-oriented program unit is the method.
Advantages: The performance is higher than object-oriented, because the class calls need to instantiate, the cost is relatively large, compared to consumption of resources, such as SCM, embedded development, Linux/unix and other general use of process-oriented development, performance is the most important factor.
Cons: No object-oriented easy to maintain, easy to reuse, easy to expand
Second, object-oriented
Object-oriented is the decomposition of a problem transaction into individual objects, the purpose of which is not to complete a single step, but to describe the behavior of something in the whole process of solving the problem.
For example Gobang, object-oriented design is to solve the problem from another idea.
The whole Gobang can be divided into:
1, black and white both sides, the behavior of the two parties is exactly the same, 2, the Board system, responsible for drawing the screen, 3, the rule system, responsible for determining such as foul, win and lose. The first Class object (Player object) is responsible for accepting user input, and informs the second class object (Checkerboard object) The change of the chess piece layout, the Checkerboard object receives the change of the chess piece to be responsible to display this kind of change on the screen, simultaneously uses the third kind of object (rule system) to determine the chess game.
It is obvious that object-oriented is a function to divide a problem, not a step.
The object-oriented minimal program unit is a class.
Advantages: Easy to maintain, easy to reuse, easy to expand, due to the object-oriented packaging, inheritance, polymorphism characteristics, can design a low-coupling system, making the system more flexible and easier to maintain.
Cons: Performance is less than process-oriented.
Three major features:
- Packaging
- Inherited
- Polymorphic
Ii. Java Object-oriented (2) _ Software development method