1

00:00:01,020  -->  00:00:06,810
Let's get started with our project implementation we'll begin with creating entities which correspond

2

00:00:06,810  -->  00:00:08,460
to database tables.

3

00:00:09,000  -->  00:00:17,030
Let's create a new project that's named after leo.

4

00:00:19,860  -->  00:00:24,870
So we have two projects now one is for the demo and the other is for the real project which is trillion

5

00:00:24,880  -->  00:00:25,380
.

6

00:00:25,860  -->  00:00:28,200
Now let's just go ahead and create a new package

7

00:00:28,200  -->  00:00:36,900
.

8

00:00:38,220  -->  00:00:43,680
So it's called camarade semantics squared are truly ordered entities and we will have all our entities

9

00:00:43,680  -->  00:00:45,960
within this package.

10

00:00:46,140  -->  00:00:52,500
So let's create the user entity so that the user class.

11

00:00:52,590  -->  00:00:53,720
So just going to new

12

00:01:01,370  -->  00:01:05,580
Unix are some instance variables.

13

00:01:06,200  -->  00:01:08,600
First is the ID field.

14

00:01:08,610  -->  00:01:12,640
I will soon explain why Id feel has this type long instead of.

15

00:01:12,890  -->  00:01:21,290
And let's add all other variables.

16

00:01:26,240  -->  00:01:26,850
Last word

17

00:01:31,100  -->  00:01:36,560
last name.

18

00:01:36,570  -->  00:01:39,700
Last name.

19

00:01:40,710  -->  00:01:43,760
Let's have gender roles in.

20

00:01:46,770  -->  00:01:50,380
It's also include a user type.

21

00:01:51,060  -->  00:01:55,780
So this is like a screen and we will also discuss it and embed.

22

00:01:56,070  -->  00:01:58,710
So we how all these instance variables to begin with.

23

00:01:58,890  -->  00:02:02,440
So let's just go ahead and create getters and setters.

24

00:02:02,490  -->  00:02:07,650
So let's just go here and do source and it's just our bhajan read them.

25

00:02:07,680  -->  00:02:11,310
So that's how you come here and select all.

26

00:02:11,700  -->  00:02:12,730
And let's head.

27

00:02:12,780  -->  00:02:13,860
OK.

28

00:02:14,430  -->  00:02:19,290
Now we how all our getters and setters let's just do a control shift.

29

00:02:19,590  -->  00:02:22,730
Just to make sure that everything is formatted right.

30

00:02:23,310  -->  00:02:30,570
So that's the new class and all getters and setters are not created so let's just discuss a little bit

31

00:02:30,570  -->  00:02:32,680
about our ID field.

32

00:02:32,910  -->  00:02:36,960
So the available time for ID field is long instead of.

33

00:02:37,280  -->  00:02:42,690
And the reason for this is in the database we mean how millions of users.

34

00:02:43,190  -->  00:02:49,590
So this malady that I play and may not be able to represent all these users there is a whole range of

35

00:02:49,650  -->  00:02:53,670
and may not be large enough to represent all users.

36

00:02:54,060  -->  00:03:01,560
So using a larger data type like long is definitely preferred now coming to user pipe freed.

37

00:03:01,740  -->  00:03:09,000
It's basically a McAfee that is it identifies a user as either a regular user or some kind of a staff

38

00:03:09,000  -->  00:03:11,760
member like editor or chief editor.

39

00:03:12,330  -->  00:03:18,640
You may recall one of the effective doll items item 20 which said preferred class hierarchies but not

40

00:03:18,660  -->  00:03:19,790
others.

41

00:03:20,160  -->  00:03:26,010
So in this case we are violating that advice that is we are not maintaining separate classes for staff

42

00:03:26,010  -->  00:03:29,140
members like editor and chief editor.

43

00:03:29,190  -->  00:03:35,520
This also means that if we're looking at database tables we would have one table card user and that's

44

00:03:35,520  -->  00:03:36,240
about it.

45

00:03:36,400  -->  00:03:41,940
And it would have a column called user type although we are violating that advice from effective Java

46

00:03:41,950  -->  00:03:42,210
.

47

00:03:42,450  -->  00:03:46,840
It is fine in this case and there are a couple of reasons for this.

48

00:03:46,960  -->  00:03:51,060
The main reason is we are treating this product as a web application.

49

00:03:51,060  -->  00:03:56,310
And as mentioned earlier some of the implementation would be done differently from what was discussed

50

00:03:56,460  -->  00:03:59,360
initially while introducing the concepts.

51

00:03:59,670  -->  00:04:05,380
For example probably a probably new and rigid Proview type of methods will be part of some managers

52

00:04:05,970  -->  00:04:12,360
as opposed to creating a class like editor and including these methods as part of them as we discussed

53

00:04:12,370  -->  00:04:12,440
.

54

00:04:12,440  -->  00:04:19,520
Well my learning inheritance Another reason is except for some additional privileges that staff members

55

00:04:19,520  -->  00:04:25,400
have like approving a review or making a bookmark marking a bookmark as kid friendly.

56

00:04:25,440  -->  00:04:31,170
They don't seem to have any additional unique features compared to a regular user that is there differ

57

00:04:31,200  -->  00:04:38,740
only in user type value and all other fields are common to regular user and a staff member.

58

00:04:38,760  -->  00:04:44,490
Next we will write bookmark classes and did it make sense to maintain separate classes for the different

59

00:04:44,490  -->  00:04:45,740
bookmark types.

60

00:04:45,930  -->  00:04:51,810
That is we would have a class hierarchy and not get back to us individual bookmark types like movie

61

00:04:51,810  -->  00:04:55,660
and book have of that are unique to them.

62

00:04:55,710  -->  00:05:02,790
In fact we used book market book and movie as an example to illustrate why we should use class hierarchies

63

00:05:02,880  -->  00:05:04,260
are not classes.

64

00:05:04,380  -->  00:05:11,490
While discussing that particular effect of Daleiden so it makes sense to have separate classes and even

65

00:05:11,490  -->  00:05:16,300
indeed as we would have separate tables for movie book and bing.

66

00:05:16,700  -->  00:05:17,140
OK.

67

00:05:17,160  -->  00:05:21,360
So let's just go ahead and Corno it bookmarklet across us now.

68

00:05:21,390  -->  00:05:24,880
OK so we are creating bookmark is now.

69

00:05:25,970  -->  00:05:29,880
OK let's just create the bookmark class in the same package

70

00:05:36,500  -->  00:05:38,550
not it's create three variables here

71

00:05:42,210  -->  00:05:46,110
ID for you which is wrong as in the case of user class

72

00:05:46,110  -->  00:05:54,960
.

73

00:05:54,960  -->  00:05:59,490
So by do on the last one is profile you are in.

74

00:05:59,490  -->  00:06:06,090
So once again let's create getters and setters select all

75

00:06:09,090  -->  00:06:11,110
control shift have.

76

00:06:11,610  -->  00:06:14,250
So that's the bookmark class.

77

00:06:14,430  -->  00:06:20,640
So later we'll be making this an abstract class as we discussed in our lessons earlier.

78

00:06:20,760  -->  00:06:26,670
That's because we want to introduce the kid friendly related methods and for that we need to make this

79

00:06:26,670  -->  00:06:28,210
move more process abstract.

80

00:06:28,560  -->  00:06:30,990
So we'll do that later.

81

00:06:31,030  -->  00:06:34,630
Next let's add the movie class movie class.

82

00:06:34,650  -->  00:06:42,510
We're extending the book Class this soon to me just say finish.

83

00:06:42,960  -->  00:06:49,850
Now let's add this extends bookmark.

84

00:06:50,190  -->  00:06:54,160
Save it now that's ired.

85

00:06:54,480  -->  00:06:56,700
Some instance variables

86

00:06:59,320  -->  00:07:02,380
say the first one is really easy either so.

87

00:07:02,400  -->  00:07:05,240
And the more we the ear when the movies are released.

88

00:07:05,280  -->  00:07:08,300
So it's it would be in type.

89

00:07:09,270  -->  00:07:14,440
Next letter I cast so cast you how money to put our names.

90

00:07:14,490  -->  00:07:17,370
So how does a string already

91

00:07:23,000  -->  00:07:25,250
Next let's our directors.

92

00:07:25,260  -->  00:07:27,510
So once again you mean how more than one director.

93

00:07:27,510  -->  00:07:35,070
So let's go with string theory.

94

00:07:35,220  -->  00:07:37,380
Next let's go to John Johnny.

95

00:07:37,670  -->  00:07:43,500
You can Howard as a string.

96

00:07:43,500  -->  00:07:46,630
Finally let's I'd reading.

97

00:07:48,540  -->  00:07:56,430
Let's call it as I am rating just in gets If you don't know what I'm D-B is I'm D-B has website related

98

00:07:56,430  -->  00:08:00,760
to movies and you can find ratings of movies over there.

99

00:08:00,780  -->  00:08:09,960
So let's just have that reading as type as an honorable and once again or two generic gendered getters

100

00:08:09,960  -->  00:08:13,250
and setters all.

101

00:08:15,300  -->  00:08:17,030
So that's the movie and goodie.

102

00:08:17,430  -->  00:08:20,030
Let's go had an our book and now

103

00:08:28,920  -->  00:08:30,780
book also extends book mark.

104

00:08:31,050  -->  00:08:36,610
You know that now let's ired publication either which can be and

105

00:08:42,770  -->  00:08:45,030
I the publishers string

106

00:08:45,020  -->  00:08:51,880
.

107

00:08:52,170  -->  00:08:59,100
Now let's add authors since can have more than one author Bill Hobert does a string.

108

00:09:02,680  -->  00:09:03,340
Next.

109

00:09:03,450  -->  00:09:09,210
John Ray.

110

00:09:10,170  -->  00:09:13,470
Now let's also have a rating for book.

111

00:09:13,550  -->  00:09:20,020
Just like for a movie let's call it as Amazon rating so we will get the rating from Amazon.

112

00:09:20,070  -->  00:09:23,900
Let's just assume that we have the rating from Amazon.

113

00:09:24,090  -->  00:09:32,880
So once again it would be double counted as Amazon reading because there might be a separate wording

114

00:09:32,880  -->  00:09:34,860
just within Trejos system also.

115

00:09:35,100  -->  00:09:41,740
So in its name and let's keep it as clear as possible.

116

00:09:44,960  -->  00:09:46,010
OK so that's a book.

117

00:09:46,020  -->  00:09:46,890
Now let's create

118

00:09:50,190  -->  00:09:51,840
a weblink

119

00:09:55,560  -->  00:09:57,390
which also extends bookmark

120

00:10:01,550  -->  00:10:07,800
and Webling to just how only two variables you Orlan host both of them strings

121

00:10:15,050  -->  00:10:23,610
.

122

00:10:24,810  -->  00:10:28,050
So that over blank glass now.

123

00:10:28,080  -->  00:10:29,800
Good friendly status.

124

00:10:29,860  -->  00:10:30,930
There's a fee for that.

125

00:10:30,960  -->  00:10:33,850
And that way will later.

126

00:10:33,990  -->  00:10:40,830
Finally let's create a user bookmark entity which would maintain the relationship between user and bookmark

127

00:10:40,830  -->  00:10:41,300
.

128

00:10:41,430  -->  00:10:47,790
That is if a user bookmarks a particular bookmark then that information is stored in this class.

129

00:10:47,790  -->  00:10:53,340
So if we have a database then there will be a separate table made in just for this entity.

130

00:10:53,650  -->  00:10:57,400
OK so there will be a table for user bookmark entity.

131

00:10:57,420  -->  00:10:59,960
So let's just go ahead and create the user bookmark class

132

00:10:59,950  -->  00:11:09,630
.

133

00:11:10,440  -->  00:11:14,000
So it's just an independent class not extending any other class.

134

00:11:14,520  -->  00:11:22,860
So it could have only two variables private user user.

135

00:11:23,100  -->  00:11:25,140
And we also need a bookmark

136

00:11:37,930  -->  00:11:45,160
is it after the user was the last one holes after bookmark

137

00:11:51,210  -->  00:11:53,140
so that the user bookmark last.

138

00:11:53,160  -->  00:11:56,960
I need food maintain the relationship between user and a bookmark.

139

00:11:57,450  -->  00:12:00,320
So those are the entity classes that we have.

140

00:12:00,590  -->  00:12:03,990
And next most likely we will implement the managed process
