apso-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Apso-devel] Exceptions, debugging and code correctness


From: Jeronimo Pellegrini
Subject: [Apso-devel] Exceptions, debugging and code correctness
Date: Sun, 6 May 2007 07:22:27 -0300
User-agent: Mutt/1.5.13 (2006-08-11)

Some ideas related to code correctness, exceptions and debugging.
Comments?

J.

- Every method should have pre-conditions and post-conditions.
  These should be documented in the Doxygen comment blocks.
  All pre/post-conditions should be tested inside the method
  (if we compile with -DDEBUG);

- Exceptions should be thrown and caught according to Sutter's
  tutorial on Dr. Dobbs:
  http://www.ddj.com/dept/cpp/184401836
  All methods should have a note on their Doxygen documentation
  mentioning what guarantees it offers (basic, strong, or nofail);

- Besides pre/post-conditions and exceptions, we should also use 
  invariants (just like Monotone does). Invariants should be spread
  all over the code, and should cause messages more informative than
  plain asserts;

- All methods should report to the logging engine when they start and 
  finish.

- The logging engine will keep track of "log aspects" instead of
  the traditional "log severity". We may not be interested in "all
  warnings" or "all errors" only -- but we may want to log "all
  CryptEngine method calls", or "all warnings and errors in the
  key repository", etc.
  The logging engine will also keep a stack of method calls, and 
  dump this stack if requested. This works because methods will
  notify the logger when they start and finish.

- All objects should be "dumpable" (they should all implement a
  "dump" method).  When compiled with -DDEBUG, any failure/error/etc
  *may* (user's choice) cause all objects to be dumped. That also means
  all objects should be included in the Directory, *and* that Directory
  should have a "dump_all" method (or something like that).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]