Who should be responsible for catching and handling exceptions: the computer or the computer program? PDF

Title Who should be responsible for catching and handling exceptions: the computer or the computer program?
Author Anwar Sadat
Course Emotional Intelligence
Institution University of the People
Pages 1
File Size 46.3 KB
File Type PDF
Total Downloads 42
Total Views 128

Summary

Who should be responsible for catching and handling exceptions: the computer or the computer program?...


Description

Who should be responsible for catching and handling exceptions: the computer or the computer program? Catching and handling exceptions is the responsibility of the computer program rather than the computer itself. This is because an exception is an unwanted event that interrupts the normal flow of the program. When an exception occurs program execution gets terminated. There can be several reasons that can cause a program to throw exception. For example: Opening a non-existing file in your program, Network connection problem, bad input data provided by user etc. As stated in the text getting a program to work under ideal circumstances is usually a lot easier than making the program robust. A robust program can survive unusual or “exceptional” circumstances without crashing. One approach to writing robust programs is to anticipate the problems that might arise and to include tests in the program for each possible problem. The following examples shows how deadly and a huge cost lost, programming errors can cause. Mars Polar Lander probably crashed because its software turned off its landing engines too soon. The program was supposed to detect the bump when the spacecraft landed and turn off the engines then. It has been determined that deployment of the landing gear might have jarred the spacecraft enough to activate the program, causing it to turn off the engines when the spacecraft was still high above the ground. A more robust system would have checked the altitude before turning off the engines! Or The Gemini V space capsule missed its scheduled landing target by a hundred miles, because a programmer forgot to take into account the rotation of the Earth. More so, over a ten-year period ending in 1992, almost 1,000 cancer patients received radiation dosages that were 30% less than prescribed because of a programming error.

References: 1. Eck, D. J. (2019). Introduction to programming using Java, version 8.1. Hobart and William Smith Colleges. 2. https://beginnersbook.com/2013/04/java-exception-handling...


Similar Free PDFs