1

00:00:01,060  -->  00:00:03,640
We are not done with the language basic series.

2

00:00:03,850  -->  00:00:08,440
And with that we have set a solid foundation towards mastering Djala.

3

00:00:09,110  -->  00:00:12,620
We mastered all the essentials in the process.

4

00:00:12,630  -->  00:00:16,240
We also learned about Ben Arcel effective July dance.

5

00:00:16,260  -->  00:00:22,920
Next we will learn more serious object oriented programming and concepts like inheritance polymorphism

6

00:00:23,070  -->  00:00:30,090
abstract classes and interfaces that we will how all the tools to write some awesome object oriented

7

00:00:30,090  -->  00:00:31,650
programs.

8

00:00:31,650  -->  00:00:35,410
Let's not look at some of the topics we covered in this chapter.

9

00:00:35,790  -->  00:00:44,220
We started with startlement the 10 variables we next looked at final variables within a box primitives

10

00:00:44,370  -->  00:00:47,310
an auto boxing.

11

00:00:47,340  -->  00:00:50,720
Finally we did several coding conventions.

12

00:00:51,030  -->  00:00:56,970
So let's go ahead and look at some of the important points we covered in this chapter.

13

00:00:56,990  -->  00:00:58,790
First a static method.

14

00:00:59,070  -->  00:01:02,310
Static methods are simply class methods.

15

00:01:02,590  -->  00:01:06,340
Are basically utility methods that do not depend on state.

16

00:01:06,390  -->  00:01:12,120
That is the instance variables are an instance methods they can access only static syllables and other

17

00:01:12,120  -->  00:01:14,730
static matters.

18

00:01:14,730  -->  00:01:20,960
If your class has only static methods then you can make the class non intangible by marking its concept

19

00:01:20,960  -->  00:01:23,590
class by weight.

20

00:01:23,640  -->  00:01:31,050
Next we'll discuss tactic was ecstatic methodes stopped equatable class variables that is shared across

21

00:01:31,050  -->  00:01:33,390
different objects of ductus.

22

00:01:33,510  -->  00:01:39,360
So there are not an instance variables which are unique to each object and with regards to accessibility

23

00:01:39,500  -->  00:01:45,240
they're accessible from static methods but they're also shared across objects of the class which means

24

00:01:45,240  -->  00:01:52,670
that they're also accessible from instance methods as well as constructors Mexoryl is because finally

25

00:01:52,680  -->  00:01:58,230
variables the term final simply implies that something cannot be changed.

26

00:01:58,230  -->  00:01:59,800
That is it is final.

27

00:02:00,300  -->  00:02:05,940
So if a variables value should be final that is it shouldn't change once initialized then it needs to

28

00:02:05,940  -->  00:02:10,350
be my best final So finally reliable.

29

00:02:10,380  -->  00:02:16,230
Basically in place constant if it is used with a primitive variable then the value can never be changed

30

00:02:16,240  -->  00:02:16,790
.

31

00:02:17,460  -->  00:02:22,350
But recall that if it is used with reference variable then the reference is constant.

32

00:02:22,440  -->  00:02:29,120
That is a reference all response to the object initialized it and cannot be reassigned another object

33

00:02:30,250  -->  00:02:33,150
Hello contents of that object can be changed.

34

00:02:33,210  -->  00:02:35,610
So you should keep that in mind.

35

00:02:35,610  -->  00:02:36,440
Find out what it was.

36

00:02:36,450  -->  00:02:38,200
Do not get a default value.

37

00:02:38,520  -->  00:02:45,030
And the reason for that is a final variable gets a default value and is initialized once again.

38

00:02:45,030  -->  00:02:52,620
Let's say in a constructor then we are violating its coater definition on final keyword can be used

39

00:02:52,620  -->  00:02:54,780
with any of the three kinds of variables.

40

00:02:54,990  -->  00:03:01,070
That is instance local are started as part of final variables.

41

00:03:01,080  -->  00:03:07,260
We also discussed about constant variables which are a kind of final variables whose values are known

42

00:03:07,260  -->  00:03:09,280
at compile time itself.

43

00:03:10,080  -->  00:03:14,820
For this reason they're usually also referred to as compile time constants.

44

00:03:14,830  -->  00:03:19,220
And here is an example which is a variable Pi from the math class.

45

00:03:19,740  -->  00:03:24,180
Compile time constants below compilers to perform some optimization.

46

00:03:24,600  -->  00:03:29,350
For example here we have variable x which is assigned my doc by.

47

00:03:29,940  -->  00:03:37,040
But my point is a compile time constant and the compiler knows the corresponding value 3.1 for citizens

48

00:03:37,110  -->  00:03:43,840
3.1 for directly to the variable x unstarted in the class file as part of the bytecode.

49

00:03:44,520  -->  00:03:50,400
So this element of some overhead at runtime as JVM doesn't have to look into math class to make this

50

00:03:50,400  -->  00:03:51,420
assignment.

51

00:03:51,900  -->  00:03:59,230
So compiler is able to perform such an optimization and here are some restrictions for a final really

52

00:03:59,240  -->  00:03:59,360
.

53

00:03:59,370  -->  00:04:06,180
But to be qualified as a constant variable first is obviously it needs to be declared with the modifier

54

00:04:06,180  -->  00:04:07,310
final.

55

00:04:07,770  -->  00:04:12,510
Next a deadlock type of variable should be either a pyramidal or a string.

56

00:04:12,510  -->  00:04:16,700
If you have any other data type then it will not be a constant variable.

57

00:04:17,010  -->  00:04:19,990
So that's a very important point to remember.

58

00:04:20,340  -->  00:04:23,990
Next variable must be initialized in the declaration statement itself.

59

00:04:24,330  -->  00:04:30,510
That is it cannot be initialized somewhere else like in a constructor or in some initializer block.

60

00:04:31,170  -->  00:04:37,320
Finally the initialization expression itself must be a constant expression a constant expression is

61

00:04:37,320  -->  00:04:43,500
something whose value is known at compile time itself and hence it is also referred to as compile time

62

00:04:43,530  -->  00:04:45,720
constant expression.

63

00:04:45,750  -->  00:04:51,480
There are some rules on what expressions qualify as constant expressions but typically you would see

64

00:04:51,510  -->  00:04:56,870
either put them a Dolittle's or string literals as constant expressions like in the case of mad dark

65

00:04:56,890  -->  00:05:05,970
by next that box primitives and then a related topic called auto boxing auto boxing which was introduced

66

00:05:05,970  -->  00:05:12,480
in Jollof I blurred the distinction between put him into Dave's unboxed promotors for example baulks

67

00:05:12,480  -->  00:05:18,000
primitives could be directly assigned primitives on similarly primitives could be directly assigned

68

00:05:18,090  -->  00:05:20,000
baulks primitives.

69

00:05:20,130  -->  00:05:26,590
Also the art of boxing images could be directly added good data structures like orderless and this.

70

00:05:26,600  -->  00:05:31,770
How about introducing what city hall or one of the effect of their lifetimes.

71

00:05:31,990  -->  00:05:34,660
Cautions that there are some issues that we met on indu.

72

00:05:34,890  -->  00:05:42,530
If box primitives are used carelessly we discuss the issues and how also tried them out in gold.

73

00:05:43,500  -->  00:05:49,060
Finally we look at coding conventions which are critical for writing clean and professional good.

74

00:05:49,200  -->  00:05:55,190
The first look that naming conventions onwards goes pretty much all the recommendations that are suggested

75

00:05:55,200  -->  00:06:03,510
by I am 56 mid-strength on sticking to generally accepted naming conventions rediscuss but typographical

76

00:06:03,660  -->  00:06:10,350
ungrammatical naming recommendations on Risher try to follow them as much as we can.

77

00:06:10,350  -->  00:06:14,950
Next we'll have the conventions for how to structure our programs.

78

00:06:14,970  -->  00:06:20,790
We said when designing our classes they should follow the single responsibility principle which simply

79

00:06:20,790  -->  00:06:25,020
means that the class should have only one responsibility.

80

00:06:25,020  -->  00:06:31,200
This would also limit the class size and more importantly would help us create better abstractions.

81

00:06:31,230  -->  00:06:36,530
That is how loosley couple classes next with regards to amateurs.

82

00:06:36,600  -->  00:06:43,400
We should try to keep them very small unfocussed they should do only one thing no more.

83

00:06:43,670  -->  00:06:49,350
We are told that one recommendation from Effective Java whose suggestion was to minimize the scope of

84

00:06:49,350  -->  00:06:51,330
local variables.

85

00:06:51,330  -->  00:06:56,300
The item recommenced or declare a local library but there it is fussiest.

86

00:06:56,310  -->  00:07:02,340
It also recommends to use for loops and sort of bli loaves as frontal lobes are better at minimizing

87

00:07:02,340  -->  00:07:07,120
the scope of variables and help in preventing bucks.

88

00:07:07,140  -->  00:07:13,100
Finally we look at some conventions for writing comments generally common should provide overuse of

89

00:07:13,100  -->  00:07:14,470
code.

90

00:07:14,580  -->  00:07:21,990
It is perfectly fine to describe any non-obvious design decisions but do white writing frequent comments

91

00:07:22,650  -->  00:07:25,250
under-fire being compelled to write frequent comments.

92

00:07:25,350  -->  00:07:31,340
Then it means you may want to consider the factoring some of the stuff usually just good descriptive

93

00:07:31,350  -->  00:07:35,920
method and variable names undoctored so of us documentation.

94

00:07:35,920  -->  00:07:37,390
And that's about it.

95

00:07:37,410  -->  00:07:43,460
We have set all the necessary foundations that we need and we can no more want a more advanced off.

96

00:07:43,710  -->  00:07:46,490
Thanks for listening and I will see you in the next chapter
