1

00:00:00,750  -->  00:00:07,200
We are not done with the chapter and we have learned how to write robust and correct programs.

2

00:00:07,200  -->  00:00:10,800
In other words how to write reliable programs.

3

00:00:10,800  -->  00:00:17,130
So let's go ahead and look at some of the important points we covered in this chapter the motivation

4

00:00:17,130  -->  00:00:23,870
for learning exceptions is that no matter how carefully you write or programs a runtime we Mistal and

5

00:00:23,870  -->  00:00:32,140
encounter exceptional situations like a partner solver Guangdong end programming such exceptional situations

6

00:00:32,380  -->  00:00:40,180
are represented in the form of exceptions such exceptions happen when you do recover from them this

7

00:00:40,180  -->  00:00:42,830
would be done using exception handling code.

8

00:00:44,060  -->  00:00:48,950
So exceptions under exception handling code is what makes the software robust.

9

00:00:50,470  -->  00:00:58,370
Otherwise the software would be considered for fraudulent injera an exception is simply an object of

10

00:00:58,370  -->  00:00:58,790
the class.

11

00:00:58,800  -->  00:01:06,940
Drawable are one off its subprocess it program can generate two types of exceptions checked on unchecked

12

00:01:07,320  -->  00:01:13,980
on this table describes these two types of exceptions to the exception should be thrown in only exceptional

13

00:01:13,980  -->  00:01:20,200
situations that are not in our control and these exceptions are checked by the compiler.

14

00:01:20,430  -->  00:01:26,840
That is a compiler checks that they are either handled by the invoking court order invoking code propagates

15

00:01:26,850  -->  00:01:33,210
them to its own calling code by indicating them in the method declaration a checked exception can be

16

00:01:33,210  -->  00:01:39,570
an instance of drawable are one off a subprocess but with the exception of a runtime exception class

17

00:01:39,730  -->  00:01:46,480
or the adder class coming to unshipped exceptions they're generally genitor either programming false

18

00:01:46,780  -->  00:01:54,130
or some abnormal conditions like internal system errors that are usually GBM related compiler does not

19

00:01:54,130  -->  00:01:56,320
check unchecked exceptions.

20

00:01:56,320  -->  00:02:01,420
That is a compiler does not check whether they are part of the method declaration or whether they are

21

00:02:01,480  -->  00:02:08,930
even handled by the invoking or unchecked exceptions are also generally not are these exceptions are

22

00:02:08,950  -->  00:02:18,240
instances of either an exception class or a class or one off a process unhittable steps for generating

23

00:02:18,240  -->  00:02:26,280
exceptions they can be undeterred by methods or even constructor's First up is to create an exception

24

00:02:26,280  -->  00:02:27,220
object.

25

00:02:27,510  -->  00:02:32,280
And second step is to grow that exception object via trusted.

26

00:02:32,670  -->  00:02:38,970
And the final step is to indicate that in the truest clause of the modern declaration on this final

27

00:02:38,970  -->  00:02:39,990
step is mandatory.

28

00:02:40,030  -->  00:02:49,120
What tipped exceptions exception handling involves using Cricut block or the method can simply propagate

29

00:02:49,120  -->  00:02:56,770
an exception via its own throws across and we can also have a finally block if we want to run some code

30

00:02:56,920  -->  00:03:02,630
regardless of whether or not an exception is generated typically It includes the clean code.

31

00:03:02,940  -->  00:03:05,630
And the finally block is an optional block.

32

00:03:06,150  -->  00:03:11,600
Not that the block must be accompanied by at least one catch block or finally block.

33

00:03:13,980  -->  00:03:20,270
Finally believe that assertions which help in writing correct programs so well exceptions help with

34

00:03:20,270  -->  00:03:26,320
robustness assertions help with correctness of the programs and in terms of benefits.

35

00:03:26,450  -->  00:03:33,470
Assertions are very effective in quickly detecting bugs during development time moreover they also saw

36

00:03:33,480  -->  00:03:41,730
as documentation one particular item recommended doing unshipped exceptions for public matters when

37

00:03:41,730  -->  00:03:48,570
there are any precondition violations for nonpublic matters it recommended using sessions which should

38

00:03:48,570  -->  00:03:51,990
help in detecting any bugs or documenting that.

39

00:03:51,990  -->  00:03:59,380
In other words detecting any wrong is options we also know that several effective dollar items.

40

00:03:59,820  -->  00:04:06,210
I think except for one become are all the exception related items from the book we also implemented

41

00:04:06,270  -->  00:04:08,030
all of the ones that we see here.

42

00:04:09,020  -->  00:04:15,050
Restaurants is use checked exceptions for regrettable conditions on unchecked exceptions.

43

00:04:15,100  -->  00:04:22,570
What programming inners Second chances don't ignore exceptions by using empty catch blocks.

44

00:04:22,810  -->  00:04:25,860
Remember that an exception is like a fire alarm.

45

00:04:26,130  -->  00:04:28,360
So you should try to handle that.

46

00:04:28,440  -->  00:04:31,650
Third one is about capturing as much information as possible.

47

00:04:31,680  -->  00:04:39,030
When an exception is generated information such as all the relevant barometer values and even food values

48

00:04:39,030  -->  00:04:40,790
can be included.

49

00:04:40,830  -->  00:04:47,890
It's a very useful method to fix bugs unfought one was about exception translation an exception.

50

00:04:47,910  -->  00:04:54,420
Chaining on here are a few more items that we covered which are more like tips.

51

00:04:54,580  -->  00:05:02,500
First one here recommends not to use exceptions for Punggol second one suggest not to carelessly use

52

00:05:02,570  -->  00:05:10,450
techniques or options as the bliss extra burden on the API client as they're forced to handle them 31

53

00:05:10,510  -->  00:05:16,060
recommends using standard exceptions as that would make your API easier to understand.

54

00:05:16,930  -->  00:05:24,910

55
12:56 recommends good document on exceptions that are to those and that includes Boucek as well as object

56

00:05:26,010  -->  00:05:32,230
not add the item also suggests not to declare and Tippex opinions in the cross-class.

57

00:05:32,230  -->  00:05:35,550
So you would only document them but not declare them.

58

00:05:36,010  -->  00:05:42,640
It hurts the reader of your code to easily distinguished checked exceptions from unchecked we only do

59

00:05:42,670  -->  00:05:49,110
it because the final one also noted the supplementary notes was included with some of the lessons that

60

00:05:49,120  -->  00:05:56,370
covered effective dollar items and does not include some of the deep points covering those items so

61

00:05:56,370  -->  00:06:02,820
you can use that material as a reference and that's about it we have learned about the tools we need

62

00:06:02,820  -->  00:06:05,220
for writing reliable software.

63

00:06:05,280  -->  00:06:07,630
Thanks for listening and good bye for now.
