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();

Coding Conventions

Please...
  • UpperCamelCase Classes: class Class {};
  • lowerCamelCase methods: myMethod() {}
  • prefix pointers with "p": Pointer pPointer = new Pointer();
  • prefix int (unsigned, long, short) with "n": int nCount = 1;
  • prefix SString with "s": SString sString;
  • prefix char* (const char*) with "sz": const char* szString = "String"; SString sString = szString;
  • prefix float (and double) with "f": double fValue = 0.0;
  • lowerCamelCase objects and C++ references of stack/instance variables: MyClass myClass; and MyClass& myClass;

Saturday, 11 November 2000

TBD

- db module
- Save config data (via db module?)
- xmpp module and SSL
- vp module
- user data module
- Settings dialog framework
- Skin framework
- WebView API
- file module (convert SFile to Msg_File_*)
- typedef ApHandle -> Class ApHandle?
- Cached HTTP client