Two people trooped practice source code operation

Source: Internet
Author: User

I. Personal skills and processes

Most of the software is done by many people. Everyone's work is dependent on each other. The most typical example is that the function of a module that someone is responsible for is called by another person. Many of the errors in the software come from the programmer's misunderstanding of the function of the module, negligence or the failure to understand the module changes. How can I be responsible for the module function definition as clear as possible, the internal changes of the module will not affect the other modules, and the quality of the module can be stable, quantitative guarantee? Unit testing is a very effective solution.

The main steps for creating a unit test function are:

    1. set data

    2. Use the function of the type being tested

    3. Compare actual results with expected results

The standard for good unit testing:

  1. Unit tests should verify the correctness of the program on the most basic functions / Parameters

  2. Unit tests must have the person most familiar with the code (the program's author) to write

  3. Machine status remains the same after unit tests

  4. Unit tests are fast.

  5. Unit tests should produce repeatable, consistent results.

  6. Unit tests should overwrite all code paths

  7. Unit tests should be integrated into the framework of automated tests

  8. Unit tests must be saved and maintained with the product code

Ii. cooperation of two persons

Code Style Specification:

    1. Indent in

    2. Line width

    3. Brackets

    4. Line break with blank {}

    5. Branch

    6. Named

    7. Underline

    8. Uppercase and lowercase

    9. Comments

Code review. Including self-review, peer review, team review. The two more familiar members are usually reviewed by one another.

Two people need to work together constantly, need to think more, try to view the problem from the other side.

III. issues relating to cooperation between two persons

To lock files when checking out, each module requires write unit tests, check-in conflict handling-merge and recompile, test resubmit, code review required when checking in.

Two people may be in cooperation due to different personal habits, resulting in different styles of code, then two people need to negotiate. In addition, because the foundation is poor, the idea of code may be very different, then need to communicate with each other, choose a better one. Plus the comment is more important, convenient to view.

Two people trooped practice source code operation

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.