fr:devel:coding-style
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
fr:devel:coding-style [2013/02/10 14:54] – initialisation niconil | fr:devel:coding-style [2021/02/13 11:23] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 9: | Ligne 9: | ||
<note tip> | <note tip> | ||
- | ===== General rules ===== | + | ===== Règles générales |
- | - Remember to add // | + | - Ne pas oublier |
- | - Commit often, | + | - Commiter souvent. |
- | - Syntax when fixing a Redmine declared bug : [explanation] fixes bug #[bug number here] | + | - Coder en C++, pas en C. |
- | - Code in C++, not in C. | + | - Ne jamais dupliquer du code, c'est le signe d'un code peu efficient |
- | - Never copy & paste code, if you want to do it that means that something is wrong : re-think the code structure. | + | - Adaptez vous au projet auquel vous contribuez. |
- | - Adapt yourself to the project for which you are developing. | + | |
- | ===== Comments | + | ===== Commentaires |
+ | |||
+ | //[A traduire]// | ||
Only comment when needed, usually naming the variables, classes and methods correctly | Only comment when needed, usually naming the variables, classes and methods correctly | ||
Ligne 30: | Ligne 31: | ||
</ | </ | ||
- | ===== Class attributes | + | ===== Attributs de classe |
+ | //[A traduire]// | ||
- Class attributes are always private, use getters and setters to access them. | - Class attributes are always private, use getters and setters to access them. | ||
- Class attributes start with a lower m.< | - Class attributes start with a lower m.< | ||
Ligne 42: | Ligne 43: | ||
</ | </ | ||
- | ===== Setters and getters | + | ===== Méthodes d' |
+ | [NdT] les mots //getter// et //setter// ont été conservés | ||
+ | |||
+ | //[A traduire]// | ||
- Setters start with “set”. | - Setters start with “set”. | ||
- Getters don't start with “get”. | - Getters don't start with “get”. | ||
Ligne 59: | Ligne 63: | ||
===== Indentation ===== | ===== Indentation ===== | ||
+ | //[A traduire]// | ||
- Indentation is made with tabulations, | - Indentation is made with tabulations, | ||
- The tabulation and the indentation size should be set to <wrap hi> | - The tabulation and the indentation size should be set to <wrap hi> | ||
- | ===== Declaring | + | ===== Declaration de variables ===== |
- | - Classes doesn' | + | //[A traduire]// |
- Variables are declared when used, not at the start of a block like in C.< | - Variables are declared when used, not at the start of a block like in C.< | ||
// Wrong | // Wrong | ||
Ligne 82: | Ligne 87: | ||
} | } | ||
</ | </ | ||
+ | - Classes doesn' | ||
- | ===== Braces | + | ===== Accolades |
+ | //[A traduire]// | ||
- The correct way to write an if statement :< | - The correct way to write an if statement :< | ||
//Correct | //Correct | ||
Ligne 120: | Ligne 127: | ||
</ | </ | ||
- | ===== Switch statements | + | ===== Blocs liés à une instructtion switch |
+ | //[A traduire]// | ||
- Every case **does not** have to have a break (or return) statement at the end or a comment to indicate that there’s intentionally no break | - Every case **does not** have to have a break (or return) statement at the end or a comment to indicate that there’s intentionally no break | ||
- | ===== Line breaks | + | ===== Retour à la ligne ===== |
+ | //[A traduire]// | ||
- No numerical limit to the length of a line, just keep it not “too long”. | - No numerical limit to the length of a line, just keep it not “too long”. | ||
fr/devel/coding-style.1360508077.txt.gz · Dernière modification : 2021/02/13 11:23 (modification externe)