Monday 1 January 2001

Do's and Don'ts

Please...
  • initialize ALL variables even if they are set few lines later
  • write log lines as single line
  • write unit tests for methods and messages
  • write unit tests for everything, even if it is complicated and takes 1 hour
  • use stack variables if possible, avoid pointers
  • remember that anything is a UTF-8 string
  • if a message handler fails and returns apStatus != Ok, then also fill sComment
  • if you write a new module, try to make it run without your new module
  • prefer tests in module rather than in the test module
Never ever...
  • use non-ASCII characters in code, e.g. "รค". The compiler might see 2 bytes instead of one character
  • do anything that can fail in a contructor
  • do bullshit
Platform notes:
  • do not initialize SAutoPtr pMyClass = new MyClass(). This does not work with gcc. Write: SAutoPtr pMyClass(new MyClass()) or SAutoPtr pMyClass; pMyClass = new MyClass();

No comments: