Book contents
Appendix - Programming practices
Published online by Cambridge University Press: 05 March 2013
Summary
Recommended programming practices
The following is a list of recommended programming practices designed to increase the reliability of scientific computing software, along with a brief description of each practice.
Use strongly-typed programming languages
Although there is some ambiguity in the definition, here we refer to a strongly-typed programming language as one which (1) requires that a variable or object maintain the same type (e.g., integer, floating point number, character) during program execution and (2) has strict rules as to which types can be used during operations (i.e., implicit type conversions are not allowed). Common examples of the latter are the use of integer division on floating point numbers and the use real functions (e.g., cos, log) on integers. BASIC and C are considered weakly-typed languages, while C++, Java, Fortran, Pascal, and Python are considered strongly-typed. For type information on other programming languages, see en.wikipedia.org/wiki/Template:Type_system_cross_reference_list. A type-safe program can be written in a weakly-typed language by using explicit type conversions (to convert integers to real numbers, real numbers to integers, etc.). In other words, explicit type conversions should be used, even when not required by the programming language.
- Type
- Chapter
- Information
- Verification and Validation in Scientific Computing , pp. 757 - 761Publisher: Cambridge University PressPrint publication year: 2010