The basic operation of two-person cooperation source Code control

Source: Internet
Author: User

In the process of writing a program, the program code is not only for the machine to see, but also to cooperate with the software to complete the peer to see, but if the program code does not conform to code norms, it is difficult for people other than themselves to understand.

The different stages and techniques of two people's cooperation:

1. The embryonic stage

The two have just begun to cooperate, exchange a lot, try to avoid conflict and easy to challenge the point of view, two people have different expectations, but both sides do not understand each other.

2. Running-in stage

Cooperation, but there will be different degrees of friction.

3. Specification phase

The code of the two sides is gradually similar, some unwritten rules are gradually built up.

Basic operation:

After analyzing the requirements and finalizing the final design document, you need to design the specific code.

Before you design your code, you need to determine the code design specification. The two partners must unify the code format, otherwise it will be confusing to read each other's code. Indentation, line width, parentheses, line breaks, branches, naming, etc. all have a uniform specification.

Once you have identified the specification, you can write the source code. In code writing, there are several things to note:

Function: The function only focuses on a function well, preferably with a single exit.

Error handling: In error handling, all parameters are validated for correctness and validation can be asserted.

Classes: Classes are used to encapsulate the concepts and polymorphism of facing objects, to avoid passing type-type entities, to be passed with pointers, for classes that have display constructs and destructors, to not create whole entities, and to use classes only when necessary.

After the source code has been written and a successful compilation is complete, we need unit testing and performance analysis. We can use VSTS for testing. Unit testing has many requirements, such as unit testing should be in the most basic function to verify the correctness of the program, it must be written by people familiar with the code, the unit test after the machine state to remain unchanged, unit testing, and so on. There are two methods of effectiveness analysis, sampling and code injection, generally using the first sampling to find the bottleneck after the characteristics of the module code injection to carry out a detailed analysis of the method.

This is followed by a review of the code. Two people in cooperation, can be self-review, and then review each other or a person to develop a review, see whether the code in the Code framework to solve the problem. In the team review, the entire team reviewed the developer. Review is mainly to see the summary section, the Design Specification section, Code Specification section, specific code parts, efficiency, readability and testability are in compliance with the norms, correct, feasible. The reviewer must provide feedback, and the developer must have a satisfactory explanation or answer to all questions, and the parties must be consistent in the outcome of the review.

The basic operation of two-person cooperation source Code control

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.