• a variable is named with an "_"-literal.



std::string _name; std::string street_;

  • declare variable`s only privat, use , when public or protected acces is needed, special set/and get methods.
  • use the variable name with'_'
  • naming of setter and getter

use the private variable name without '-' as getter, use the name of the variable with setVarName as getter name.



std::string name() const; void setName( const std::string & name );


std::string name_;

  • class naming
  • * we use java formatting in xpsycle code. That means, class names start with upper case, and class names doesn't start with "C" .


class MainWindow class SequencerGUI

  • Method naming
  • * we use java formatting in xpsycle code. That means, we start with a lower case literal, and concat words simply by adding them upper case.

example: void play(); void setName( ); void setAdress( ); void setSamplerRate( int rate );

etc, etc ..


  • use const

for getmethods we always use const at the end example: std::string name() const; int bpm() int;

for setMethods with a parameter we try to use as often const as possible example if we dont use : setName( std::string name); but setName( const std::string & name );

avoid c macro stuff like define , use instead const int etc ..

  • in general avoid macros

we use a compiler not a preprocessor :)

  • if really nessesary, use macros for crossform code:

#example ifdef __unix__ #endif #else

  • avoid direct calls to xlib / windows.h etc

example: NK_Left and not XK_Left or VK_LEFT

  • use stl, and never an c array:

example: use std::vector<int> and not int a[max_size];

  • dont use namespace includes in .h files


test.h using namespace std; class DontDothis { public: string giveMeAStd_; here use instead std::string iHaveAStlNamespace. Note: in a .cpp file you can of course use a namespace.

  • if you use pointers in classes, don't forget to write an copy ctor
  • if you write an copy ctor always write an = operator, too
  • use a virtual dtor, if you plan that you have a base class. ( mostly you see that, if you have some methods virtual ).
  • dont forget to eat ( e.g pizza ) and sleep some minutes, if you programming xpsycle :)

(<alk> I find this helps on a sleepy afternoon aswell, the best coffee I've found, what a kick ^^ ->