| Literature DB >> 25566120 |
Abstract
Entities:
Keywords: bugs; code quality; code testing; minimizing errors; programming
Year: 2014 PMID: 25566120 PMCID: PMC4269119 DOI: 10.3389/fpsyg.2014.01435
Source DB: PubMed Journal: Front Psychol ISSN: 1664-1078
Summary of actions that can be taken to improve the code.
| Test your code | Use debugger to test your code | Keep track and validate intermediate results (e.g., save log file, image figures) | Validate the output of custom code using the manually created results | Check your code with simulated (surrogate) data | ||||
| Protective (preventive) programming | Make your code to check the intermediate output results as it runs | |||||||
| Irrelevant data and code quality | Make sure the variables do not contain data from previous operations (e.g., loop cycle) | Extract specialized business logic to separate functions (modular approach) | Do not duplicate code | Use meaningful names for functions and variables | Avoid hard-coded values within the code | Do not leave unsupported variables (e.g., initial parameters) in the code | Add comments to the most critical and non-trivial parts of the code | Adopt peer-review procedure |
| Consult documentation | Do not trust your intuition. Make sure that the functions are called according to documentation | |||||||
| Take responsibility for the code you use | Do not use the code without understanding it | |||||||
| Publish your code, if possible | Make your code available to other researchers | |||||||
| Use source management systems | Source systems permit to manage and document your code easily |