March 4th, 2013, 01:17 PM
Code tracking and debugging
We have a project in c++, each of us is in charge of some module. The code grows very fast as well as errors. So the question of tracking errors, modules info, debug info and other valuable runtime information arose. We certainly don't want to reinvent the wheel.
This question is about error debugging by code itself, not by external tools or code (I hope You will understand, correct me if it is ambiguous or unclear), for example, it is not about unit testing approaches.
So there are the following questions about best practice (flexible approaches of third party libraries, sharp corners of the techniques, ...) :
1. Exceptions: How to arrange an exception system for the project in the most flexible manner? That every module and submodule could define its own exception and the main application could catch and handle them. Maybe it will be appropriate to classify exceptions so some type of them could be disabled or somehow configured (again what is the best practice)?
2. Logging: For example, I used log4cplus framework. Are there any problems with it? Again, how to arrange it for a whole project?
3. Error description: In both exceptions and logging, we need to describe the error with a string. Sometimes this string can be quite long so it takes a lot of space in code, making it less readable. What approach could be taken to not write errors in code directly? Is this a good idea and widely used or are there some other techniques?
4. Other: Any other useful methods to make code debugging more painless, but leave code readable (free of long checkouts and error handlers)?
All these things are together in one question because there is relation between them where to use logging, where exception, where something else. It is another question how to writing the code and simultaneously without doubts (in most cases) make an error or info handling in someway?
Click Here to Expand Forum to Full Width