-
Notifications
You must be signed in to change notification settings - Fork 18
Guidelines
nical edited this page Dec 12, 2010
·
4 revisions
each point will be adressed in the following form:
- Guideline instruction
//Examples
Motivations of the instruction
- Code, comments, commit messages ... everything in English please.
- These rules are meants to maintain cohesion and facilitate readability and integration in the project. They can be brocken if there is a good reason for it. In doubt you can contact Nicolas Silva (nical.silva@gmail.com).
- Always privilegiate object-oriented design and implementation.
- Try to limitate dependencies by not relying on other external libraries than boost and the c++ standard library.
- Kiwi is meant to be cross-platfrorm. Do not rely on non cross-platform dependencies.
- Kiwi is free. Beware of the License when adding content to the library.
- Namespaces names should be all lower case
namespace kiwi
{
namespace core
{
...
}//namespace
}//namespace
Common practice.
- All classes should be in a namespace nested inside kiwi's namespace. Each subproject should have it's own namespace.
kiwi::core::Node
kiwi::generic::MultiArrayContainer
kiwi::text::TextContainer
Avoid eventual name collisions and separate each sub-project.
- Class names must be mixed case starting with upper case letter.
class Node ...
class AbstractArrayContainer ...
Common practice.
- Member functions names must be mixed case starting with lowercase letter.
kiwi::uint32_t getChar();
bool connect(...);
Common practice.
- Function/method parameters must be mixed case starting with lower case letter.
void add( kiwi::core::Node* toAdd);
Common practice.
- Protected or private member varaible names must be mixed case starting with an underscore '_' followed by a lower case letter.
Container* _linkedContainer;
kiwi::Point<float, 2> _position;
Common practice, makes it easy to differentiate member varibles from parameters.
- Constants and enumerated values must be upper case with underscores to separate words.
// within class declaration
enum{NODE, FILTER, CONTAINER};
Common practice. Constants should not be declared outside classes, so that they remain within the classes' namespace.