Discussion on the programming style 1

Source: Internet
Author: User
Tags error handling

* * Software company Software Development specification

(Trial Version)

In the case of collaborative development of the company team, one important aspect that should be emphasized in programming is the readability of the program, which makes it easy for other programmers to read your program when the performance indicators such as the speed of the software can meet the needs of the users. A clear set of programming style, so that collaborators, successors and themselves at a glance, in a very short period of time to see the structure of the program, understanding the design of ideas. Greatly improve the readability, reusability, program robustness, portability and maintainability of the code.

The purpose of this programming specification is to improve the software development efficiency of the company and the maintainability of the software developed, and to improve the quality of the software. This specification is composed of program style, naming rules, annotation specification, program robustness, portability, error handling and modular specification of software.

First, the procedure style:

1, the strict use of ladder-level organization program code:

The indentation of each level of the grid using the default style of VC, that is, each level indented to 4 square brackets in the next line. A matching brace is required in the same column, and the following line requires a further indent of 4 cells. For example:

void main()
{
......
long lI; //循环变量
long lSum;//用来记录和
float fAvg;//用来求平均值
......
//对数进行累加。
for( lI=0;lI<10;lI++)
{
lSum=lSum+lI;
...... }
//求平均值。
fAvg=lSum/10.0;
......
}

2, the location of the hint information string

The prompt string to be given in the program, in order to support the development of multiple languages, except for some temporary information for debugging, all other information must be defined in the resource.

3, the definition of the variable, as far as possible at the beginning of the function position.

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.