How we change what others think, feel, believe and do

| Menu | Quick | Books | Share | Search | Settings |

C Style: Standards and Guidelines (contents)

CHAPTER 10 : Programming 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.6  Integrity and Recovery

One of the most annoying things to happen to a user of a program is for data to be corrupted or lost, possibly where a large amount of effort has been invested. In strong data-oriented and safety-critical applications it is essential to be able to guarantee data and system integrity. It is also good style to be aware of, and handle appropriately, the integrity in less critical applications.

The basic principle of integrity is that the information within a system must always be correct. You should never end up with a situation where the system has become corrupt, even in a minor way, and where the program is unaware of this.

To ensure integrity, the program will typically check the state of the data at regular intervals  and also at key points during processing. Particular care needs to be taken with intermediate data states and when changing the data.

Integrity may be checked either by ensuring data is within valid bounds, or by using redundant information which may allow a recovery routine to attempt to repair the damage. For example, walking a doubly-linked chain from either end will allow a single broken link to be found and fixed.

The ultimate in recovery is power-fail restoration, where the program can be turned off at any time, and then carry on where it left off on power-up. If there is no hardware assistance for this, then the program must regularly save its entire context (being aware of possible power failure during this too!).

Where full recovery is not possible, partial recovery is better than none, and appropriate diagnostics should be used.


<--Prev page | Next page -->


Site Menu

| Home | Top | Settings |

Quality: | Quality Toolbook | Tools of the Trade | Improvement Encyclopedia | Quality Articles | Being Creative | Being Persuasive |

And: | C Style (Book) | Stories | Articles | Bookstore | My Photos | About | Contact |

Settings: | Computer layout | Mobile layout | Small font | Medium font | Large font | Translate |


You can buy books here

More Kindle books:

And the big
paperback book

Look inside


Please help and share:


| Home | Top | Menu |

© Changing Works 2002-
Massive Content -- Maximum Speed