ClassName
_ClassName // (private) supporting implementation for a (public) class
methodName(...)
_methodName(...) // (private) supporting implementation for a (public) method
StaticMethod(...)
accept(...) // the accept method of a visitor's context
whenCase(...) // a visitor's visit
method
operator()
or execute(...) // use to invoke a command as part of the command pattern
createSpecifier(...) // A method which factories an object the caller is responsable for deleteing. The specifier may be ommited and is used to quilify the kind of thing being created or the form of creation.
destroy() // Request an object delete itself. Assume the object has been deleted after invocation.
Instance() // a singleton's static accessor method
propertyName
CONSTANT_PROPERTY // prefer const
over #define
staticProperty
instance // the singleton's static varible
module_name // multi-word module names should be avoided
τ // Tau: general type variable
δ // Delta: as tau when typing data, esp. general collection type
ρ // Rho: return type
α // Alpha: argument type
ε // Epsilon: exception type
// nested directories are used to reflect nested modules
// to include an entire module
// to include part of a module
// for system level headers (e.g. garbage collection is gc
)
// classes for doing unit tests go here
Do not use 'A' or 'I' as a prefix to an abstract class or interface
. Proper names can imply when something is abstract. Also, interface does not always have meaning in a language. When using a pattern consider using the pattern name in the class in addition to a meaningful root name. A class' role in a pattern may also make a useful name part.
Header files will always have .h extensions and be in a directory reflecting their nesting in modules. System headers are for things considered so important that you directly use their name. In this case a header is generated without a .h
and it includes the one with the .h
. If multiple system headers would have the same name (i.e. vector) then including the name includes all classes with that name. Since they are in different modules no conflicts occur and using directives should be used to select the desired implementation.
#ifndef headerFileName_h_
#define headerFileName_h_
// include directives
// header file contents
#endif // headerFileName_h_
// BUGBUG JTW message
marks code you believe may have an error or need fixed in the future. Includes author's initials in multi-author environment::
) and member selection (.
or ->
) operators should not have spaces on either side*
and &
should be associated with the variable name. If they are return types the modifiers should be associated with the type)
' is when declaring a const method or to separate it from an inline body{ }
not {}
)class ClassName: public SuperName
{
private:
static ClassName *instance;
public:
ClassName()
ClassName(int x): property(x) { }
virtual void method1(Type ¶m, Type2 param2) = 0;
virtual void method2(Type ¶m, Type2 param2);
};
ClassName::ClassName():
property(8),
foo(7)
{
}
void ClassName::method2(Type ¶m, Type2 param2)
{if()
{
}
}
argumentsto return
private
, protected
, public
private:
should always be used (don't go with the implicit private that starts a class)friend
declarations before any access modifiersfor(;;)
to mean forever rather than while(true)
destroy()
is used to delete)Null()
)Type* Type::instance = 0;
Type& Type::Instance()
{
return *(instance ? instance : instance = new Type());
}
<type variable>specialization
(e.g. τVisitor
).
jwalker@cs.oberlin.edu |