Ii. Java Object-oriented (2) _ Software development method

Source: Internet
Author: User

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:

    1. Packaging
    2. Inherited
    3. Polymorphic

Ii. Java Object-oriented (2) _ Software development method

Related Article

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.