Sunday, December 13, 2009

Neptuner Coding Guidelines

==========================
NEPTUNER Coding Guidelines
- sonofdelphi
2009-12-13
2008-12-16
==========================

* To enable faster coding with an IDE
* To enable better debugging, no guessing what a variable is!

Variable naming
================

Variables are named as:


Scope Modifier
* Member variables start with m_
* Global variables start with g_
* Function Parameters start with "in_"
* Local variables don't have a scope modifier

Indirection Modifier
* Pointer variables start with p
* Reference variables start with r
* Other variables don't have an indirection modifier

Aggregation Modifier
* a - aggregates (arrays, vectors, lists etc)
* Plain variables don't have an aggregation modifier

Usage Modifier
* n - used for counting
* s - used as string
* c - character
* b - used as boolean
* f - used as a function. Deprecated though.
* e - enumeration types
* x - other structs, x = Complex = non-simple
* Other types (what are they?:-) don't have a usage modifier.

Indentation
=============
* Use a single indent for every {} block.

* { and } should be on new lines, at the same indentation level as the conditional.
Eg:
if(someCondition)
{
statement1;
statement2;
}

* Single line conditionals need not have {} marking.
But make sure you indent the single statement.

Type naming
=============
* Follow TitleCasing for user-defined types - classes, structs, enums.
Eg:
class Student
{
string m_sName;
int m_nMarks;
};

Function naming
================
* Functions should follow camelCase.
* The first word of a function should be a verb.
Eg: doSomeThing()

Pseudoclass functions
======================
* For C-style module functions, name as ModuleName_
Eg: Neptuner_addStuff

Change log

r386 by sonofdelphi on Jan 26, 2010 Diff
dos2unix lineendings
Go to:
Double click a line to add a comment

Older revisions

r378 by sonofdelphi on Dec 20, 2009 Diff
r181 by sonofdelphi on Oct 10, 2009 Diff
r161 by sonofdelphi on Oct 09, 2009 Diff
All revisions of this file

File info

Size: 1790 bytes, 77 lines

No comments: