Difference between revisions of "Cpp Coding Standards/IFC"
m (Cpp Coding Standards/Interfaces moved to Cpp Coding Standards/IFC: consistency) |
(formatting) |
||
Line 1: | Line 1: | ||
− | + | === Interfaces (IFC) === | |
+ | ''The public functions of a class are an interface, but these items refer also to any other kind of interface. They are especially important for classes or functions that are expected to be used by possibly yet unknown clients.'' | ||
− | + | ===== Consistency <span id="Consi">(Consi)</span> ===== | |
− | + | Give the same thing the same name everywhere in the interface.<br> | |
− | = | + | Let parameters with the same semantic always occur in the same order in different functions.<br> |
− | ==== Consistency <span id="Consi">(Consi)</span> ==== | + | [[/Consi|-> Details]] |
− | Give the same thing the same name everywhere in the interface. | + | |
− | + | ===== Minimality <span id="Min">(Min)</span> ===== | |
− | + | Provide only one way to do anything. Move functions that do not belong to the core functionality of the interface to more appropriate locations.<br> | |
− | + | For classes: Put convenience functions as non-member functions in the same namespace beside the class.<br> | |
− | + | [[/Min|-> Details]] | |
− | ==== Minimality <span id="Min">(Min)</span> ==== | + | |
− | Provide only one way to do anything. Move functions that do not belong to the core functionality of the interface to more appropriate locations. | + | |
− | + | ||
− | For classes: Put convenience functions as non-member functions in the same namespace beside the class. | + | |
− | + | ||
− | [[/Min|Details]] | + | |
==== Unambiguous Overloads <span id="Over">(Over)</span> ==== | ==== Unambiguous Overloads <span id="Over">(Over)</span> ==== | ||
− | Let all overloads of a function be unambiguous. Be aware of default arguments and integral vs. pointer parameters. Provide either only one version of an integral type or (rarely) overloads for all C++ integer-types. | + | Let all overloads of a function be unambiguous. Be aware of default arguments and integral vs. pointer parameters. Provide either only one version of an integral type or (rarely) overloads for all C++ integer-types. [[/Over|-> Details]] |
− | + | ||
− | [[/Over|Details]] | + | |
---- | ---- | ||
=== Related Rules === | === Related Rules === | ||
− | * [[../ | + | * [[../CLSDESIGN#OneResp |CLSDESIGN:OneResp]] - OneResponsibility |
---- | ---- | ||
[[Category:Coding Standards]] | [[Category:Coding Standards]] |
Revision as of 16:46, 22 May 2007
Contents
Interfaces (IFC)
The public functions of a class are an interface, but these items refer also to any other kind of interface. They are especially important for classes or functions that are expected to be used by possibly yet unknown clients.
Consistency (Consi)
Give the same thing the same name everywhere in the interface.
Let parameters with the same semantic always occur in the same order in different functions.
-> Details
Minimality (Min)
Provide only one way to do anything. Move functions that do not belong to the core functionality of the interface to more appropriate locations.
For classes: Put convenience functions as non-member functions in the same namespace beside the class.
-> Details
Unambiguous Overloads (Over)
Let all overloads of a function be unambiguous. Be aware of default arguments and integral vs. pointer parameters. Provide either only one version of an integral type or (rarely) overloads for all C++ integer-types. -> Details
Related Rules
- CLSDESIGN:OneResp - OneResponsibility