| |
|
 |
Coding Standards - Part 3 - What remains
|
Functions
All functions must be placed inside classes. Exceptions are main() and functions used as an interface between classes and a C API. Functions should be short and do one task. The length of the function depends on how complex it is. The more complex the function is, the shorter it should be. Too long functions should be split into several functions each doing a minor task. A function should not be longer than 30-40 lines.
Use variables sparingly, split the function when you have too many. If the function is clearly divided into different parts you may use more variables, but no more than 7 per block of code. Exceptions to this rule are certain mathematical calculations where speed is essential.
If a function has many parameters it might be wise to split the parameter line into several lines, place the parameters with a close relation to each other on the same line. Many parameters is often a sign that your function is too big, try splitting it.
Try to make functions const as often as possible. Avoid inline code, but when you do use it, try to post phone it until the class is considered done. This is to avoid massive recompiling due to dependencies. Be careful with default values for function parameters, try to specify everything as explicitly as possible.
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.
|
|
 |
|
|