| |
|
 |
Coding Standards - Part 3 - What remains
|
Comments
For every function, write a comment that explain what it does, and any hard-to-understand parameters. These comments should be written in Doxygen syntax. Also write a comment on a class' area of responsibility. Use a newline between comments and functions.
Don't over comment your code, use comments when needed. If you have to put lots of comments in your code to make it readable, it's a sign that it is badly written and should be redone.
Exceptions
Use exceptions to control things that don't work as they were expected to, like parameters having values they should never have. Use them often. Don't use exceptions as a way of leaving loops or nested function calls, or signalling an expected outcome. Be aware of memory leaks that may happen when using exceptions. (The book "The C++ Programming Language" by Bjarne Stroustrup has comments on this.)
Functions that use exceptions should explicitly state so in the documentation. When using a function with exceptions, always use a try/catch statement to handle it. Use a try/catch statement in main() to tell the user/developer of any fatal errors that happens.
That's all, folks!
Now you've seen the C++ code standard for eZ systems as. If you like it, use it, if you don't, write your own or consider using on of the existing ones on the web. If you only write your own code and never share it with others you might not need too explicitly write a standard, in most other cases it would greatly benefit the consistency and readability of your project.
Comment List
| Topic: |
Author: |
Time: |
|
Hacking URLS
|
TF Paschall
|
15.12.2001 17:38
|
|
I notice that hacking off "article/" and "articleview/" from the zez.org URLs renders an empty page body.
eZ Publish should provide a default.
|
|
 |
|
|