Fandom

Psycle Wiki

Xpsycle/developer/programming guidlines

< Xpsycle | developer

78pages on
this wiki
Add New Page
Talk0 Share
  • a variable is named with an "_"-literal.

example:

private:

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.

example:

public:

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

private:

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" .

example:

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 ..

setWord1Word2Word3

  • 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

example

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 ^^ -> http://www.preisvergleich.org/pimages/Lavazza-Qualitr-Oro-Kaffeebohnen-1-Kilogramm_129__3300015_20.jpg)



Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.