12_ada_prgrobust

12_ada_prgrobust - Introduction to Computers and...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 12 April 14 2004 2 The goal of an engineer is to retire without having caused any major catastrophe -D
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3 Today 4 Internet computers running versions of Berkeley UNIX, and used their resources to attack still more computers. across the U.S., infecting thousands of computers and making many of them unusable due to the burden of its activity. Cause : undetected buffer overflow in C routine gets() • Program robustness • Exception handling November 2, 1988 Internet Worm A self-replicating program was released upon the This program (a worm) invaded VAX and Sun Within the space of hours this program had spread
Background image of page 2
5 several patients Cause : poor testing of the software st Cause communicating with NASA Cause : Approach orbit angle was incorrect because of inconsistency between units of measurement 7 Errors Exceptions 1986: Therac 25 radiation machine kills June 4, 1996: 1 flight of Ariane 5 aborted: Ariane 5 destroyed : Code from Ariane 4 guidance system was reused in Ariane 5 but not tested. September 23 1999: Mars Orbiter stops • No programmer is perfect – The good ones handle errors gracefully • Errors –Comp i le t ime –L
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 User Errors outside legal bounds gracefully 9 Exceptions recovery may be possible system handlers conditional checks • User provides invalid input – types in name of file that does not exist – provides program argument with value • Detect using “if” checks in program – Program should print message and recover – Possibly ask user for new input • Rare errors “exceptional” from which – User hits interrupt key –Ar ithmet ic overf low
Background image of page 4
10 Robustness without either 11 Finding Errors • Your program should never terminate – Completing successfully – Sending a meaningful error message • Approaches to achieve Robustness –Debug – Defensive programming • Conditional checks • Assertions – Exception handling • Try to “break” the program –What can go wrong? – What happens if it does? – Sometimes nothing needs to be done. – If that is a problem, how can we detect it? – What can we do about it? • Tell the user • Die gracefully • Recover reasonably
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Ada’s Classification of Errors 1.1.5 required to be detected prior to run time by every Ada implementation required to be detected at run time by the execution of an Ada program 13 exception represents a kind of exceptional situation time) is called: raise an exception is to abandon normal program execution the arising of an exception is called handling the exception 1. Errors that are 2. Errors that are 3. Bounded errors 4. Erroneous execution Exceptions – Ada Perspective •An – An occurrence of such a situation (at run exception occurrence •To • Performing some actions in response to
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

12_ada_prgrobust - Introduction to Computers and...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online