文档详情

Lecture11 编程风格的简要说明.pdf

发布:2017-05-21约1.87千字共7页下载文档
文本预览下载声明
编程风格的简要说明 2013/10/21 软件学院软件工程教研室 1 编程风格和文档 • 编程风格决定程序外观 • Appropriate Comments适当的注释 • Naming Conventions命名习惯 • Proper Indentation and Spacing Lines适当的缩进和空白 • Block Styles块的对齐方式 2013/10/21 软件学院软件工程教研室 2 Appropriate Comments • Include a summary at the beginning of the program to explain what the program does, its key features, its supporting data structures, and any unique techniques it uses. • Include your name, class section, instruction, date, and a brief description at the beginning of the program. 2013/10/21 软件学院软件工程教研室 3 Naming Conventions • Choose meaning and descriptive names. •Variables and method names: • Use lowercase. If the name consists of several words, concatenate all in one, use lowercase for the first word, and capitalize the first letter of each subsequent word in the name. For example, the variables radius and area, and the method computeArea. 2013/10/21 软件学院软件工程教研室 4 Naming Conventions, cont. • Class names: • Capitalize the first letter of each word in the name. For example, the class name ComputeArea. • Constants: • Capitalize all letters in constants. For example, the constant PI. 2013/10/21 软件学院软件工程教研室 5 Proper Indentation and Spacing • Indentation • Indent two spaces. • Spacing • Use blank line to separate segments of the code. 2013/10/21 软件学院软件工程教研室 6 Block Styles • next-line 次行风格 • end-of-line行尾风格 2013/10/21 软件学院软件工程教研室 7
显示全部
相似文档