Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SIT232 ObjectOriented Development Trimester 2I 2021 Practical Task 4.1 [Pass Task] Submission deadline: 1:DDam Monday. August 23 Discussion deadline: l:pm Friday. September 10 General Instructions

image text in transcribed
image text in transcribed
SIT232 ObjectOriented Development Trimester 2I 2021 Practical Task 4.1 [Pass Task] Submission deadline: 1:DDam Monday. August 23 Discussion deadline: l:pm Friday. September 10 General Instructions This practical task introduces you to error handling and covers a number of most common .NEI' Framework exception types that you will likely encounter as soon as you start developing larger applications. Exceptions that you will meet in practice can be thrown either by the rarrtime or the application's code. The latter case represents a class of exceptions that are defined by the application's developer. Some exceptions can be caused by a faulty program code; while other exceptions can resultfrom an incorrect input that has not been accounted for in the application's code. when any of these errors occur, the system catches the error and raises an exception. The process of generating and signalling an error is referred to as throwing an exception. This is done using the 'throw' keyword followed by a new instance of a class derived [in he rited} from System. Exception. There are standard exception types provided by the .NET fra mewo rk that you can use rather than creating acusiam exception. Remember that execution failure occurs whenever a program [or its part} cannot do what it was designed to do. For example; if the DpenFile method cannot return a file handler to the caller; it would be considered an execution failure. Exceptions are the primary means of reporting errors in applications. Therefore, you must adhere to a number of rules when you throw or handle exceptions. Here are several basic rules that you should follow and always think about them when you work on your application. Report execution failures by throwing exceptions. Do not use exceptions for the normal ow ofcorrtroi. if possible. Consider tenninatjng the program by calling System. Environment. FailFast method instead of throwing an exception if your code encounters a situation where it is unsafe for further execution. Consider the performance implications of throwing exceptions. Throw rates above 100 per second are likely to noticeably impact the performance of most: applications. Do not have public members that can either throw or not based on some option. Do not have public members that retJJm exceptions as the return value. Do not throw exceptions from exception filter blocks [i.e. the 'catch' block of the 'trycatch' statement}. Avoid explicitly throwing exceptions from 'naliy' blocks. This list is by no means exhaustive and there are more nJles and strategies. Remember that exception handling is an art which once you master grants you immense powers. 1. Start this practical task with watching lecture 3. In this task, you will need to conduct a small research about every exception presented in the following list: a] NullReferenceException f} ArgumentNullException b} lndexDuthRangeException g} ArgumentuthRangeException c} StacvaerowException h} FormatException d} DuthMemoryException i}| SystemException e} DivideByZeroException In Section 9 of SIT232 Workbook. you will find a general information on how to catch and irandie exceptions along with some details on the above exceptions. These exceptions are also briey described and exemplified in the lecture notes for week 3 [you though are not allowed to copy the examples from the lecture into your solution]. However, you will still need to do search in the Internet to gather more 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic Management Theory And Practice

Authors: John A. Parnell

4th Edition

1452234981, 9781452234984

More Books

Students also viewed these General Management questions