Defining Programming Standards   
for Professional Programmers 
  

         

Home

Contents

1: Standards

2: Psychological Factors

3: General Principles

4: Commenting

5: Naming

6: Code Layout

7: File Layout

8: Language Usage

9: Data Usage

10: Programming Usage

11: Implementing Standards

A: Example Standard

B: References

C: Glossary

Syque

About

Share this page:

Google
C Style
syque.com
Web

 

 

Books and
more at:

USA:

In association with amazon.com

UK:

In Association with Amazon.co.uk

Canada:

In Association with amazon.ca

 

 

CHAPTER 10 : Programming Usage

PART 4 : USAGE

CHAPTER 10 : Programming Usage
10.1 Elegant programming
10.2 Performance programming
10.3 Defensive programming
10.4 Error handling
10.5 Diagnostics
10.6 Integrity and Recovery
10.7 Testability
10.8 Portability
10.9 Localization
10.10 Usability
10.11 Summary

<--Prev page | Next page -->

 

10.7  Testability

Testing code is a very difficult and often laborious task. Making the code testable from the beginning will almost always save much time during the test period, and will make maintenance much easier.

There are several characteristics of testable code which can be aimed for during design and coding:

10.7.1  Minimize function inputs/outputs

To test a function fully, all combinations of inputs should be used and all ranges of output generated. If there are many inputs or possible outputs (parameters or other data), it will be impossible to fully test the function.

10.7.2  Minimize nesting

Each level of nesting implies a branch of some kind, which will follow or not follow the nesting. To fully test a function, all combinations of paths through the code should be exercised. Many branches means many possible paths and a geometric increase in required tests.

 

<--Prev page | Next page -->

 

 

  © Syque 1995-2013

Massive Content -- Maximum Speed