Difference between revisions of "Cpp Coding Standards"
m (→Topics in Alphabetical Order) |
(Separating headlines from ids.) |
||
Line 1: | Line 1: | ||
=== Purpose === | === Purpose === | ||
[[Coding standards]] are a part of [[defect prevention]]. They gather rules, advice and best practices for developing software, especially the code writing part. Here are listed some ideas what such standards could be for developing with C++ and within the [[OpenOffice.org]] project. | [[Coding standards]] are a part of [[defect prevention]]. They gather rules, advice and best practices for developing software, especially the code writing part. Here are listed some ideas what such standards could be for developing with C++ and within the [[OpenOffice.org]] project. | ||
+ | |||
+ | === Standards and Reviews === | ||
+ | Coding standards and reviews are related. Reviews help getting to know standards and bringing them into the real life of the code. Reviews also help to improve standards and disclose needed changes. | ||
+ | |||
+ | The standards are parted into topics. Each topic is intended to cover an area that is small enough to be the focus of a code review session. The summary of rules regarding one topic should not cover more than "one page" of paper or on screen. This way one topic's summary can be printed out and be used as checklist when studying code. | ||
+ | |||
+ | Most times a summary alone is not enough to understand and discuss a rule, also there are exceptions and hints for realization. So, for each rule there will be a separate wiki page to discuss it. | ||
=== Identifying Rules === | === Identifying Rules === | ||
− | + | Ids enable to make notes about rules (e.g. during reviews) and help when talking about them. Because items may be added or sorted out, such ids are not just cardinal numbers, but strings that do not change, when other items are added or removed. Each topic has an id, and each rule within the topic has an id itself. | |
− | Example: [[ | + | Example: [[/FDESIGN#OneTask | FDESIGN:OneTask]] is the rule with the id "OneTask" which belongs to the topic [[/FDESIGN|Function Design]] with the id "FDESIGN". |
---- | ---- | ||
Line 13: | Line 20: | ||
==== Middle- and Lowlevel Design ==== | ==== Middle- and Lowlevel Design ==== | ||
− | * [[/ | + | * [[/Design|Design]] (DESIGN) |
− | * [[/ | + | * [[/Virtual Classes|Virtual Classes]] (VIRTUAL) |
− | * [[/ | + | * [[/Class Design|Class Design]] (CLSDESIGN) |
− | * [[/ | + | * [[/Interfaces|Interfaces]] (IFC) |
− | * [[/ | + | * [[/Function Design|Function Design]] (FDESIGN) |
==== Classes ==== | ==== Classes ==== | ||
− | * [[/ | + | * [[/Class Design|Class Design]] (CLSDESIGN) |
− | * [[/ | + | * [[/Virtual Classes|Virtual Classes]] (VIRTUAL) |
− | * [[/ | + | * [[/Interfaces|Interfaces]] (IFC) |
− | * [[/ | + | * [[/Encapsulation|Encapsulation]] (ENC) |
− | * [[/ | + | * [[/Class Construction, Destruction and Copying|Class Construction, Destruction and Copying]] (CLSINIT) |
− | * [[/ | + | * [[/Function Design|Function Design]] (FDESIGN) |
==== Functions and Implementation Generally ==== | ==== Functions and Implementation Generally ==== | ||
− | * [[/ | + | * [[/General Coding|General Coding]] (GEN) |
− | * [[/ | + | * [[/Function Design|Function Design]] (FDESIGN) |
− | * [[/ | + | * [[/Function Implementation|Function Implementation]] (FIMPL) |
− | * [[/ | + | * [[/Error Handling|Error Handling]] (ERR) |
− | * [[/ | + | * [[/Security|Security]] (SECURITY) |
==== Preferred vs. Discarded Types and Habits ==== | ==== Preferred vs. Discarded Types and Habits ==== | ||
− | * [[ | + | * [[/STL|The C++ Standard Template Library]] (STL) |
− | * [[/ | + | * [[/Type Safety|Type Safety]] (TYPE) |
− | * [[/ | + | * [[/Obsolete Habits|Obsolete Habits]] (OBSOLETE) |
==== Files, Formatting, Documentation ==== | ==== Files, Formatting, Documentation ==== | ||
− | * [[/ | + | * [[/Code Format|Code Format]] (FORMAT) |
− | * [[/ | + | * [[/Header Files|Header Files]] (HEADERS) |
− | * [[/ | + | * [[/Code Documentation|Code Documentation]] (CODEDOCU) |
− | ==== | + | ==== Principles and Process ==== |
− | * [[/ | + | * [[/Principles|Principles]] (PRINC) |
− | * [[/ | + | * [[/Development Process|Development Process]] (PROCESS) |
---- | ---- | ||
=== Topics in Alphabetical Order === | === Topics in Alphabetical Order === | ||
− | * [[/ | + | * [[/Class Design|Class Design]] (CLSDESIGN) |
− | * [[/ | + | * [[/Class Construction, Destruction and Copying|Class Construction, Destruction and Copying]] (CLSINIT) |
− | * [[/ | + | * [[/Code Documentation|Code Documentation]] (CODEDOCU) |
− | * [[/ | + | * [[/Design|Design]] (DESIGN) |
− | * [[/ | + | * [[/Encapsulation|Encapsulation]] (ENC) |
− | * [[/ | + | * [[/Error Handling|Error Handling]] (ERR) |
− | * [[/ | + | * [[/Code Format|Code Format]] (FORMAT) |
− | * [[/ | + | * [[/Function Design|Function Design]] (FDESIGN) |
− | * [[/ | + | * [[/Function Implementation|Function Implementation]] (FIMPL) |
− | * [[/ | + | * [[/General Coding|General Coding]] (GEN) |
− | * [[/ | + | * [[/Header Files|Header Files]] (HEADERS) |
− | * [[/ | + | * [[/Virtual Classes|Virtual Classes]] (VIRTUAL) |
− | * [[/ | + | * [[/Interfaces|Interfaces]] (IFC) |
− | * [[/ | + | * [[/Principles|Principles]] (PRINC) |
− | * [[/ | + | * [[/Obsolete Habits|Obsolete Habits]] (OBSOLETE) |
− | * [[/ | + | * [[/Development Process|Development Process]] (PROCESS) |
− | * [[/ | + | * [[/Security|Security]] (SECURITY) |
− | * [[ | + | * [[/STL|The C++ Standard Template Library]] (STL) |
− | * [[/ | + | * [[/Type Safety|Type Safety]] (TYPE) |
---- | ---- | ||
[[Category:Coding Standards]] | [[Category:Coding Standards]] |
Revision as of 11:05, 28 November 2006
Contents
Purpose
Coding standards are a part of defect prevention. They gather rules, advice and best practices for developing software, especially the code writing part. Here are listed some ideas what such standards could be for developing with C++ and within the OpenOffice.org project.
Standards and Reviews
Coding standards and reviews are related. Reviews help getting to know standards and bringing them into the real life of the code. Reviews also help to improve standards and disclose needed changes.
The standards are parted into topics. Each topic is intended to cover an area that is small enough to be the focus of a code review session. The summary of rules regarding one topic should not cover more than "one page" of paper or on screen. This way one topic's summary can be printed out and be used as checklist when studying code.
Most times a summary alone is not enough to understand and discuss a rule, also there are exceptions and hints for realization. So, for each rule there will be a separate wiki page to discuss it.
Identifying Rules
Ids enable to make notes about rules (e.g. during reviews) and help when talking about them. Because items may be added or sorted out, such ids are not just cardinal numbers, but strings that do not change, when other items are added or removed. Each topic has an id, and each rule within the topic has an id itself.
Example: FDESIGN:OneTask is the rule with the id "OneTask" which belongs to the topic Function Design with the id "FDESIGN".
Topics by Problem Domain
Topics may appear at multiple domains.
Middle- and Lowlevel Design
- Design (DESIGN)
- Virtual Classes (VIRTUAL)
- Class Design (CLSDESIGN)
- Interfaces (IFC)
- Function Design (FDESIGN)
Classes
- Class Design (CLSDESIGN)
- Virtual Classes (VIRTUAL)
- Interfaces (IFC)
- Encapsulation (ENC)
- Class Construction, Destruction and Copying (CLSINIT)
- Function Design (FDESIGN)
Functions and Implementation Generally
- General Coding (GEN)
- Function Design (FDESIGN)
- Function Implementation (FIMPL)
- Error Handling (ERR)
- Security (SECURITY)
Preferred vs. Discarded Types and Habits
- The C++ Standard Template Library (STL)
- Type Safety (TYPE)
- Obsolete Habits (OBSOLETE)
Files, Formatting, Documentation
- Code Format (FORMAT)
- Header Files (HEADERS)
- Code Documentation (CODEDOCU)
Principles and Process
- Principles (PRINC)
- Development Process (PROCESS)
Topics in Alphabetical Order
- Class Design (CLSDESIGN)
- Class Construction, Destruction and Copying (CLSINIT)
- Code Documentation (CODEDOCU)
- Design (DESIGN)
- Encapsulation (ENC)
- Error Handling (ERR)
- Code Format (FORMAT)
- Function Design (FDESIGN)
- Function Implementation (FIMPL)
- General Coding (GEN)
- Header Files (HEADERS)
- Virtual Classes (VIRTUAL)
- Interfaces (IFC)
- Principles (PRINC)
- Obsolete Habits (OBSOLETE)
- Development Process (PROCESS)
- Security (SECURITY)
- The C++ Standard Template Library (STL)
- Type Safety (TYPE)