1
00:00:09,370 --> 00:00:12,130
So we finally reached module 11, where
we'll

2
00:00:12,130 --> 00:00:15,960
actually start designing and implementing
our own classes.

3
00:00:15,960 --> 00:00:18,683
Here are the learning objectives for
module 11.

4
00:00:22,550 --> 00:00:26,610
In all the weeks up until this point,
we've been focused on using classes

5
00:00:26,610 --> 00:00:32,960
that are provided by C#, or by XNA, or by
me in the course materials.

6
00:00:32,960 --> 00:00:35,570
And so that's an important first step,
with

7
00:00:35,570 --> 00:00:38,510
dealing in Object Oriented systems,
learning how to

8
00:00:38,510 --> 00:00:41,220
use classes and objects that are available
to

9
00:00:41,220 --> 00:00:44,200
you because of work other people have
done.

10
00:00:44,200 --> 00:00:48,300
Now it's time for us to start actually
working on the

11
00:00:48,300 --> 00:00:51,850
design and implementation of our own
classes.

12
00:00:51,850 --> 00:00:55,990
And so, that's what we'll do within this
module, we'll do a class for

13
00:00:55,990 --> 00:01:00,860
a Console Application, and then we'll do a
class for an XNA game, as well.

14
00:01:05,210 --> 00:01:06,900
You should recall from way back in

15
00:01:06,900 --> 00:01:11,590
module 4 that objects have three different
things.

16
00:01:11,590 --> 00:01:15,730
They have state, they have behavior and
they have identity.

17
00:01:15,730 --> 00:01:22,230
And so, the state of an object is all
about the characteristics of that object.

18
00:01:22,230 --> 00:01:26,054
So you should go do an in-lecture quiz

19
00:01:26,054 --> 00:01:30,520
about, demonstrating that you remember how
we actually store

20
00:01:30,520 --> 00:01:31,860
the state of an object.

21
00:01:40,290 --> 00:01:45,040
And now, you should do another in-lecture
quiz that demonstrates that you remember

22
00:01:45,040 --> 00:01:51,850
how we actually provide consumers of the
class that the object is an instance of.

23
00:01:51,850 --> 00:01:55,820
How we provide consumers access to the
state of that object.

24
00:01:57,800 --> 00:01:58,530
Okay.

25
00:01:58,530 --> 00:02:01,190
So the next thing that we worry about, or
need

26
00:02:01,190 --> 00:02:04,510
to be concerned with, is the behavior of
the object.

27
00:02:04,510 --> 00:02:05,530
So what can that

28
00:02:05,530 --> 00:02:11,846
object do, or interestingly enough, what
can we tell the objects to do to itself?

29
00:02:11,846 --> 00:02:16,768
So, another in-lecture quiz to demonstrate
that you

30
00:02:16,768 --> 00:02:20,059
remember how we do that part in C#.

31
00:02:20,059 --> 00:02:25,020
And finally, we have identity.

32
00:02:25,020 --> 00:02:29,030
Well, objects have identity.
We do too, but objects have identity.

33
00:02:29,030 --> 00:02:30,750
So, this lets

34
00:02:30,750 --> 00:02:33,830
us distinguish one object from another.

35
00:02:33,830 --> 00:02:38,933
And so, the third thing we need for
objects is of course identity and we will

36
00:02:38,933 --> 00:02:44,307
actually get identity when we call the
constructor, to create a new object.

37
00:02:44,307 --> 00:02:48,298
[BLANK_AUDIO].

38
00:02:48,298 --> 00:02:54,330
So let's build a Die Class.
A die is a, thing that we roll.

39
00:02:54,330 --> 00:02:57,420
It has a certain number of faces.

40
00:02:57,420 --> 00:03:03,270
And so, we're, we'll come up with a design
for a die that

41
00:03:03,270 --> 00:03:09,710
corresponds to a die in the real world.
And so first, we'll start with state.

42
00:03:13,360 --> 00:03:19,610
What are the kinds of things that we need
to store for state in the die class?

43
00:03:19,610 --> 00:03:22,830
Well, we need to remember how many sides a
die has.

44
00:03:22,830 --> 00:03:26,380
So a standard die has six sides, but if
you happen to be

45
00:03:26,380 --> 00:03:31,180
a dungeons and dragons player maybe you
think a standard die has 20 sides.

46
00:03:31,180 --> 00:03:34,760
And so, we need to store within the die
how

47
00:03:34,760 --> 00:03:38,400
many sides it has, and will tell it how
many sides

48
00:03:38,400 --> 00:03:41,000
it has when we actually construct the die

49
00:03:41,000 --> 00:03:46,560
object just as the die factory determines
how many

50
00:03:46,560 --> 00:03:48,450
faces are on the die when they actually

51
00:03:48,450 --> 00:03:52,190
build the die and you know, a physical
die.

52
00:03:52,190 --> 00:03:55,920
So, we'll have to keep track of that for
state how many sides there are.

53
00:03:55,920 --> 00:03:59,030
And we'll also need to keep track of which
side is

54
00:03:59,030 --> 00:04:04,000
on top, because typically, people will use
one or more dice for

55
00:04:04,000 --> 00:04:07,010
a game, and so you'll roll the dice and
you'll look

56
00:04:07,010 --> 00:04:09,390
at the number that's on top and you do
something with it.

57
00:04:09,390 --> 00:04:12,590
Whether you pay money or move forward on
the board,

58
00:04:12,590 --> 00:04:16,890
or you know, the Orc has slashed you
fatally, or whatever.

59
00:04:16,890 --> 00:04:21,670
But we use the number on the top of the
die for some particular reason.

60
00:04:21,670 --> 00:04:24,000
So we're going to need to store that as
well.

61
00:04:24,000 --> 00:04:26,450
And so, as you know from the earlier in

62
00:04:26,450 --> 00:04:29,880
lecture quizzes, and your work with C# so
far.

63
00:04:29,880 --> 00:04:33,970
We're going to store the state of the
object in fields.

64
00:04:33,970 --> 00:04:36,060
And then we're going to provide consumers
access

65
00:04:36,060 --> 00:04:38,040
to the state of the object through
properties.

66
00:04:39,170 --> 00:04:44,610
Next thing is behavior, and we're only
going to do one thing for behavior.

67
00:04:44,610 --> 00:04:48,120
We are going to tell the die to roll
itself.

68
00:04:48,120 --> 00:04:49,780
So that's how we'll use dice.

69
00:04:49,780 --> 00:04:52,660
We'll tell a die to roll itself, and then
we'll look at

70
00:04:52,660 --> 00:04:55,160
the top side and say, oh okay, now I know
it's facing

71
00:04:55,160 --> 00:04:58,970
up and take the appropriate action based
on the game we're playing.

72
00:04:58,970 --> 00:05:05,330
And finally, we of course gives dies, each
die object, identity, and that

73
00:05:05,330 --> 00:05:09,350
will happen when we call the constructor
to actually build the die object.

74
00:05:12,560 --> 00:05:16,900
So sort of pictorially, this is what we've
come up with.

75
00:05:16,900 --> 00:05:19,410
So remember the information hiding thing.

76
00:05:19,410 --> 00:05:22,650
We're going to hide the fields NumSides
and

77
00:05:22,650 --> 00:05:25,860
TopSide in the internals of the object.

78
00:05:25,860 --> 00:05:30,200
So a consumer of the object can't see
those things, and that way if we decide we

79
00:05:30,200 --> 00:05:32,540
want to change how we represent those
things later

80
00:05:32,540 --> 00:05:36,110
we can, without affecting any consumers of
the object.

81
00:05:36,110 --> 00:05:39,040
So that's the information hiding part.

82
00:05:39,040 --> 00:05:41,310
Encapsulation remember?

83
00:05:41,310 --> 00:05:45,050
Is putting the data, that stuff in the
inner

84
00:05:45,050 --> 00:05:47,200
hold of the donut, I must be hungry right
now.

85
00:05:47,200 --> 00:05:53,390
The inner hole of the donut, encapsuling
the data along with the behavior.

86
00:05:53,390 --> 00:05:59,150
And the behavior in our case is rolling
the die as a method.

87
00:05:59,150 --> 00:06:04,320
In that capsule, the membrane of the
capsule, also makes

88
00:06:04,320 --> 00:06:10,888
it so that consumers access the data
through those two properties.

89
00:06:10,888 --> 00:06:17,416
So they get of the behavior through the
method, and that they gather the data

90
00:06:17,416 --> 00:06:17,926
[SOUND]

91
00:06:17,926 --> 00:06:20,265
through the properties.

92
00:06:20,265 --> 00:06:24,570
That previous picture was not in any
standard pictorial form.

93
00:06:24,570 --> 00:06:29,370
This is in fact, the UML diagram for the
class that we're going to build.

94
00:06:29,370 --> 00:06:31,280
So as you can see, we have the

95
00:06:31,280 --> 00:06:35,500
fields, that will use to store the state
internally.

96
00:06:35,500 --> 00:06:39,830
And then we have the properties, that a
consumer

97
00:06:39,830 --> 00:06:42,160
of the class will use to access that
state.

98
00:06:42,160 --> 00:06:43,170
And then

99
00:06:43,170 --> 00:06:48,760
finally we have the method, so they can
also get at the behaviors.

100
00:06:48,760 --> 00:06:52,180
We typically do not include the
constructor,

101
00:06:52,180 --> 00:06:54,780
one or more constructors in the UML
diagram.

102
00:06:54,780 --> 00:06:57,830
So I haven't done that here, but
understand that of course we'll have at

103
00:06:57,830 --> 00:07:03,270
least one constructor so that we can in
fact create new instances of the class.

104
00:07:06,570 --> 00:07:11,850
So now let's actually start doing this.
So I'm going to start up Visual Studio.

105
00:07:15,000 --> 00:07:17,080
Now, we're going to start a new project.

106
00:07:17,080 --> 00:07:19,640
This one is going to be a Console
Application.

107
00:07:19,640 --> 00:07:26,098
So, I'll say it's a New Project, a Console
Application, and I'll call it

108
00:07:26,098 --> 00:07:26,598
[SOUND].

109
00:07:28,290 --> 00:07:30,496
I'll call it die.
Okay?

110
00:07:30,496 --> 00:07:31,662
[INAUDIBLE],

111
00:07:31,662 --> 00:07:35,016
I guess I can't.
I'll, I'll call it the die example

112
00:07:35,016 --> 00:07:35,600
[SOUND].

113
00:07:35,600 --> 00:07:41,790
I can't bring myself to just call it die.
So I'm going to create this new project.

114
00:07:41,790 --> 00:07:44,785
I'm going to zoom in, immediately, and I'm
going to save.

115
00:07:44,785 --> 00:07:47,224
[SOUND].

116
00:07:48,940 --> 00:07:52,380
So, I will go Save and then we'll jump
back into the video.

117
00:07:53,390 --> 00:08:00,180
Okay, so I have saved it and I also snuck
in and added comments.

118
00:08:00,180 --> 00:08:02,285
Almost all the comments that I should have
added

119
00:08:02,285 --> 00:08:05,860
[SOUND].

120
00:08:05,860 --> 00:08:07,210
There we go.

121
00:08:07,210 --> 00:08:13,570
So, we want to actually create a new
class, which means we need a new file.

122
00:08:13,570 --> 00:08:16,620
And so, over here, where it says, die

123
00:08:16,620 --> 00:08:20,800
example, the, the boldfaced, this is the
project.

124
00:08:20,800 --> 00:08:27,220
I right click that, and I say, Add a new
item at the top or pick

125
00:08:27,220 --> 00:08:30,860
of the class at the bottom and so common
for us to add classes that we get our very

126
00:08:30,860 --> 00:08:33,066
own option in the drop-down for that.

127
00:08:33,066 --> 00:08:37,655
I am going to add a class and I'm going to
rename it, Die with a capital D

128
00:08:37,655 --> 00:08:41,120
[SOUND].

129
00:08:41,120 --> 00:08:41,983
And I'm going to zoom in

130
00:08:41,983 --> 00:08:44,245
[SOUND].

131
00:08:44,245 --> 00:08:45,506
And so

132
00:08:45,506 --> 00:08:47,768
[SOUND]

133
00:08:47,768 --> 00:08:50,290
this is a die.

134
00:08:50,290 --> 00:08:54,840
Now, I will F6 just to demonstrate that
everything still works.

135
00:08:55,950 --> 00:08:57,970
Now, I'm going to the first thing that I'm

136
00:08:57,970 --> 00:09:01,420
going to do, is add the fields for the
class.

137
00:09:01,420 --> 00:09:02,425
So I'm going to add a region

138
00:09:02,425 --> 00:09:08,950
[SOUND].

139
00:09:08,950 --> 00:09:14,550
And remember that region using regions is
just for within the IDE.

140
00:09:14,550 --> 00:09:16,480
It has nothing to do with what gets

141
00:09:16,480 --> 00:09:19,690
executed when we actually compile and run
our code.

142
00:09:19,690 --> 00:09:24,240
And so, I knew that I needed two things
for fields.

143
00:09:24,240 --> 00:09:29,800
I needed the number of sides for the die,
and I need which side is on top.

144
00:09:29,800 --> 00:09:33,370
So both of those really ought to be
integers.

145
00:09:33,370 --> 00:09:34,110
We, we really

146
00:09:34,110 --> 00:09:37,270
can't have dice with six and a half sides.

147
00:09:37,270 --> 00:09:39,070
Soon as you cut it there's an extra side,
that's

148
00:09:39,070 --> 00:09:41,970
why diamond cutters are so rich or
something, I don't know.

149
00:09:41,970 --> 00:09:44,960
Okay, so let's, they're both ints.

150
00:09:44,960 --> 00:09:50,090
So I'll call the number of sides numSides,
just as we saw in the UML.

151
00:09:50,090 --> 00:09:55,470
And I'll also call the top side that we're
saving,

152
00:09:55,470 --> 00:09:59,860
topSide, just as you'd expect in the, from
the UML.

153
00:09:59,860 --> 00:10:02,590
So, at this point, I can compile again.

154
00:10:02,590 --> 00:10:05,530
But, I have added both the numSides field,
and

155
00:10:05,530 --> 00:10:09,260
the topSide field to this new class that I
created.

156
00:10:12,390 --> 00:10:17,390
You should now go do an in-lecture quiz,
that asks about controlling

157
00:10:17,390 --> 00:10:20,690
access to these fields, and then come back
and we'll talk about it.

158
00:10:22,980 --> 00:10:26,070
So, a new thing that we haven't talked
about

159
00:10:26,070 --> 00:10:29,070
yet because we haven't been developing our
own classes,

160
00:10:29,070 --> 00:10:32,560
is that there's another word that can go
here

161
00:10:32,560 --> 00:10:36,790
before we put the data type, and the
variable name.

162
00:10:36,790 --> 00:10:37,910
Up to this point, right?

163
00:10:37,910 --> 00:10:42,700
This is just exactly declaring a variable,
because it is a variable within the class.

164
00:10:42,700 --> 00:10:48,250
But we can also set what's called an
Access Modifier.

165
00:10:48,250 --> 00:10:55,218
So we can, if we choose to do so, we can
do something like this.

166
00:10:55,218 --> 00:10:56,144
[SOUND].

167
00:10:56,144 --> 00:10:57,880
Say, public.

168
00:10:57,880 --> 00:11:03,630
We could make our numSides field public,
which means that any consumer

169
00:11:03,630 --> 00:11:09,670
of this class can directly manipulate our
numSides field.

170
00:11:09,670 --> 00:11:14,810
And that is generally considered very bad
programming practice.

171
00:11:14,810 --> 00:11:19,020
We don't care about it for constants, it's
okay to make constants public.

172
00:11:19,020 --> 00:11:20,440
We don't have any right here.

173
00:11:20,440 --> 00:11:21,190
But it's okay to make

174
00:11:21,190 --> 00:11:26,380
constants public, because nobody can mess
them up, essentially.

175
00:11:26,380 --> 00:11:31,990
But making a field public, really bad
idea.

176
00:11:31,990 --> 00:11:37,860
If we do that we have basically taken odd
picture

177
00:11:37,860 --> 00:11:42,650
of the class.
And we've done this.

178
00:11:42,650 --> 00:11:45,460
We've said, okay.
You can directly manipulate NumSides.

179
00:11:45,460 --> 00:11:46,340
So I'm going to

180
00:11:46,340 --> 00:11:47,200
dig a hole.

181
00:11:49,890 --> 00:11:54,260
I'll break that information hiding thing,
so that you can tunnel your

182
00:11:54,260 --> 00:11:59,010
way into the core of my class, and mess
around with the internals.

183
00:11:59,010 --> 00:12:01,630
That is such a horrible idea.

184
00:12:01,630 --> 00:12:06,830
It is allowed by the language, but it's a
terrible idea.

185
00:12:06,830 --> 00:12:08,009
You should never do it.
Let me

186
00:12:08,009 --> 00:12:08,710
[UNKNOWN]

187
00:12:08,710 --> 00:12:12,500
out lest you think that, that's the best
thing ever.

188
00:12:12,500 --> 00:12:19,180
So really what we want, is we want all of
our fields to be private.

189
00:12:19,180 --> 00:12:25,520
We don't want anyone external to the class
to be able to see those fields in any way.

190
00:12:25,520 --> 00:12:27,940
And because we want them all to be private
in

191
00:12:27,940 --> 00:12:33,710
general and because it is such good
programming practice, they're actually

192
00:12:33,710 --> 00:12:35,780
private by default.

193
00:12:35,780 --> 00:12:40,460
So really, for changing the Access
Modifier for a field, the only way for

194
00:12:40,460 --> 00:12:45,620
you to mess up is if you deliberately
decide to be a bad programmer.

195
00:12:45,620 --> 00:12:47,600
Morally bad, not just, you know, bad code

196
00:12:47,600 --> 00:12:50,920
quality, just a bad person, I'll make this
public.

197
00:12:50,920 --> 00:12:52,330
So don't do it.

198
00:12:52,330 --> 00:12:52,730
Right.

199
00:12:52,730 --> 00:12:57,610
It's, it just, it breaks our information
hiding and there's no need to do it.

200
00:12:57,610 --> 00:12:58,560
Because,

201
00:12:58,560 --> 00:13:01,600
if consumers of the class need access to
the

202
00:13:01,600 --> 00:13:04,430
state, which is what are fields are for,
then

203
00:13:04,430 --> 00:13:07,050
we provide them access to that state
through our

204
00:13:07,050 --> 00:13:12,890
properties, which means we should actually
implement some properties.

205
00:13:14,450 --> 00:13:16,210
So I'm going to create another region

206
00:13:16,210 --> 00:13:16,710
[NOISE].

207
00:13:22,250 --> 00:13:26,480
And here's where I'm going to implement
our properties.

208
00:13:26,480 --> 00:13:29,330
So let's implement the numSides property
first.

209
00:13:30,770 --> 00:13:36,400
We need to put an Access Modifier for the
property, and because

210
00:13:36,400 --> 00:13:40,390
this is for consumers of the class, we
want to make properties public.

211
00:13:40,390 --> 00:13:42,800
In general, we want to make the properties
public,

212
00:13:42,800 --> 00:13:46,320
because the consumer of the class needs
access to it.

213
00:13:46,320 --> 00:13:47,520
The numSides

214
00:13:47,520 --> 00:13:50,330
field is an integer, so we're probably
going

215
00:13:50,330 --> 00:13:52,525
to want to return an integer here, as well

216
00:13:52,525 --> 00:13:53,680
[SOUND],

217
00:13:53,680 --> 00:13:58,640
and properties are capitalized.
So, just as methods are

218
00:13:58,640 --> 00:14:04,325
capitalized, just as class names are
capitalized, properties are capitalized

219
00:14:04,325 --> 00:14:05,580
[NOISE].

220
00:14:05,580 --> 00:14:09,160
We put an open and closed curly bracket.

221
00:14:09,160 --> 00:14:12,820
And I'm going to talk about the syntax for
both things that we can do

222
00:14:12,820 --> 00:14:17,040
within a property, and then we'll get rid
of the one that's just crazy.

223
00:14:17,040 --> 00:14:19,230
Okay, so the two things we can get for

224
00:14:19,230 --> 00:14:22,754
property, the two things we can do for
properties

225
00:14:22,754 --> 00:14:23,610
[NOISE]

226
00:14:23,610 --> 00:14:28,910
is read them, we say we can read the
property we implement the read capability

227
00:14:28,910 --> 00:14:36,930
for a property by providing a get
accessor, and we can set the property.

228
00:14:36,930 --> 00:14:42,630
So basically we can get the value of this
state information,

229
00:14:42,630 --> 00:14:49,010
sorry about that, this state information
numSides, and we can set the information.

230
00:14:49,010 --> 00:14:49,220
So

231
00:14:49,220 --> 00:14:53,270
I will implement both and now I get rid of
the one that's dead wrong.

232
00:14:53,270 --> 00:15:00,020
Okay so to get numSides, what we're really
saying is, go through that picture, I am

233
00:15:00,020 --> 00:15:02,310
accessing the property and you should tell
me

234
00:15:02,310 --> 00:15:05,660
the information that you have hidden in
your core.

235
00:15:05,660 --> 00:15:09,420
And so that is definitely numSides.

236
00:15:09,420 --> 00:15:14,320
So we need to somehow get the value of the
numSides variable and we

237
00:15:14,320 --> 00:15:16,690
get the value of variables by just putting
the variable name.

238
00:15:17,800 --> 00:15:21,410
But now we need a way to actually return
this to the

239
00:15:21,410 --> 00:15:26,220
person, the consumer of the class who's
trying to access this property.

240
00:15:26,220 --> 00:15:28,580
And the good news is, programmers are

241
00:15:28,580 --> 00:15:32,980
crazy, but sometimes, we use appropriate
words.

242
00:15:32,980 --> 00:15:38,230
So if we want to return something, we use
the word, return.

243
00:15:38,230 --> 00:15:39,520
And so, by putting

244
00:15:39,520 --> 00:15:43,770
return numSides when someone tries to
access this property,

245
00:15:43,770 --> 00:15:47,960
we can just give them what is in that
property.

246
00:15:49,590 --> 00:15:53,230
So that's get, that's actually get the
that's the read.

247
00:15:53,230 --> 00:15:54,280
Find out.

248
00:15:54,280 --> 00:16:00,940
There is a right, possible in properties,
and it's done within the set accessor.

249
00:16:00,940 --> 00:16:05,030
And so the way we do it is we say numSides
equal.

250
00:16:06,500 --> 00:16:09,652
So we're trying to set the value of this,
field.

251
00:16:09,652 --> 00:16:12,800
So numSides is equal to something, and

252
00:16:12,800 --> 00:16:18,150
that something is a special keyword called
value.

253
00:16:18,150 --> 00:16:21,440
When it's time, oh, you've actually
already seen this.

254
00:16:21,440 --> 00:16:27,580
Right?
When you did, bear.active equals false.

255
00:16:27,580 --> 00:16:31,500
That false part, when you are accessing a
property, you are

256
00:16:31,500 --> 00:16:36,880
accessing the set accessor for the active
property, in the

257
00:16:36,880 --> 00:16:40,190
inside the property which we didn't look
at, but inside the

258
00:16:40,190 --> 00:16:43,860
property that false that you were, that
you had on the

259
00:16:43,860 --> 00:16:49,770
right hand side of the equal was, actually
called value inside.

260
00:16:49,770 --> 00:16:52,850
So that's how, we'll see this again, don't
worry,

261
00:16:52,850 --> 00:16:56,390
when we implement the x and a stuff
because boy,

262
00:16:56,390 --> 00:17:01,700
it makes sense to actually find out the
number of sides on a die.

263
00:17:01,700 --> 00:17:05,170
But it doesn't make any sense at all to
let a consumer of

264
00:17:05,170 --> 00:17:09,660
the class change the number of sides on
the die, once it's been created.

265
00:17:09,660 --> 00:17:12,160
What are you going to take a file and, you
know, make new

266
00:17:12,160 --> 00:17:15,620
faces on the die and color them in with
magic marker or something?

267
00:17:15,620 --> 00:17:17,330
No, definitely not.

268
00:17:17,330 --> 00:17:21,730
So this particular property, it only makes
sense for it to have

269
00:17:21,730 --> 00:17:23,560
a get accessor.

270
00:17:23,560 --> 00:17:26,975
And we'll add a comment, get the number of
sides.

271
00:17:26,975 --> 00:17:27,635
[SOUND]

272
00:17:27,635 --> 00:17:34,850
Now the only property we said we needed
was, the topSide.

273
00:17:34,850 --> 00:17:36,015
So lets do that as well

274
00:17:36,015 --> 00:17:38,544
[SOUND].

275
00:17:41,360 --> 00:17:47,750
And just as for numSides, it only makes
sense to have a get accessor for topSide.

276
00:17:47,750 --> 00:17:50,990
If you could roll a die and then reach
over and turn it so you

277
00:17:50,990 --> 00:17:56,620
got a better roll, dice games would not be
nearly as interesting as you might expect.

278
00:17:56,620 --> 00:17:59,010
And if you want to you know, travel to Las
Vegas and try

279
00:17:59,010 --> 00:18:03,990
that at the craps table, you'll probably
get in trouble from the Casino.

280
00:18:03,990 --> 00:18:06,920
Okay, so just get.
We can look at the top side

281
00:18:06,920 --> 00:18:11,154
but we can't change it.
Okay, so same exact thing

282
00:18:11,154 --> 00:18:11,370
[NOISE]

283
00:18:11,370 --> 00:18:14,770
as above except this time we'll return top
side

284
00:18:14,770 --> 00:18:17,652
instead, and of course, we will add a
comment

285
00:18:17,652 --> 00:18:18,152
[NOISE].

286
00:18:23,680 --> 00:18:25,880
So that either somebody reading the source
code or

287
00:18:25,880 --> 00:18:29,430
the documentation we generate, clearly
indicates what gets done.

288
00:18:30,720 --> 00:18:31,340
Okay.

289
00:18:31,340 --> 00:18:33,982
I'm going to F6, so I can build, and I can
F5, or

290
00:18:33,982 --> 00:18:37,600
Ctrl+F5, because this is the Console App
and it's not exciting at all.

291
00:18:38,780 --> 00:18:44,330
So you might think that we should
definitely test this properties right now.

292
00:18:44,330 --> 00:18:46,400
And while I would agree with that, the
problem

293
00:18:46,400 --> 00:18:48,930
is we don't have any constructors yet, so
we haven't

294
00:18:48,930 --> 00:18:51,780
created any die object yet, so we can't

295
00:18:51,780 --> 00:18:57,210
access the properties of a non existent
object.

296
00:18:57,210 --> 00:19:01,850
So, we will actually start testing these
properties in the next lecture

297
00:19:01,850 --> 00:19:05,010
and speaking of the next lecture this is
the end of this one.

298
00:19:05,010 --> 00:19:09,720
So we've done our design for the die class
and we have implemented the

299
00:19:09,720 --> 00:19:14,070
fields and properties, so we've handled
the state part of what we need from state

300
00:19:14,070 --> 00:19:15,810
behavior and identity.

301
00:19:15,810 --> 00:19:20,620
And next time we'll actually build a
couple of constructors for the die class.