Skip to main content Accessibility help
×
Hostname: page-component-77c89778f8-m8s7h Total loading time: 0 Render date: 2024-07-18T21:33:43.047Z Has data issue: false hasContentIssue false

Appendix - Programming practices

Published online by Cambridge University Press:  05 March 2013

Christopher J. Roy
Affiliation:
Virginia Polytechnic Institute and State University
Get access

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
Publisher: Cambridge University Press
Print publication year: 2010

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Eddins, S. (2006). Taking control of your code: essential software development tools for engineers, International Conference on Image Processing, Atlanta, GA, Oct. 9, (see blogs.mathworks.com/images/steve/92/handout_final_icip2006.pdf).
Hatton, L. (1995). Safer C: Developing Software for High-Integrity and Safety-Critical Systems, McGraw-Hill International Ltd., UK.Google Scholar
Hatton, L. (1997). Software failures: follies and fallacies, IEEE Review, March, 49–52.CrossRefGoogle Scholar
Sommerville, I. (2004). Software Engineering, 7th edn., Harlow, Essex, England, Pearson Education Ltd.Google Scholar

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×