1
00:00:01,420 --> 00:00:05,890
We can now show a Google map on the screen, which is great, but before we move on and start showing

2
00:00:05,890 --> 00:00:08,500
the markers, there's one last little thing I want to mention.

3
00:00:08,980 --> 00:00:11,410
I want to focus on the index stats file right now.

4
00:00:11,780 --> 00:00:13,380
I want to point out something inside of here.

5
00:00:13,480 --> 00:00:16,059
This is going to seem like a really strange thing to point out.

6
00:00:16,059 --> 00:00:17,620
Nonetheless, I just want to mention it.

7
00:00:18,290 --> 00:00:20,060
Let's just take a look at a diagram.

8
00:00:20,090 --> 00:00:22,990
I think you'll start to understand what I'm going to be talking about here.

9
00:00:23,510 --> 00:00:24,630
OK, so quick diagram.

10
00:00:25,360 --> 00:00:25,700
All right.

11
00:00:25,720 --> 00:00:27,220
So this is kind of a crazy diagram.

12
00:00:27,220 --> 00:00:33,870
Its purpose is to try to show all the different things that we can effectively do inside the index file.

13
00:00:34,300 --> 00:00:37,480
And I know that's weird to say, but let's just kind of walk to the diagram step by step.

14
00:00:37,870 --> 00:00:40,330
It's going to zoom in a little bit here and go up to the top.

15
00:00:41,400 --> 00:00:46,980
So inside of our index doctor's file, we've got an important statement for our company class now.

16
00:00:46,990 --> 00:00:51,850
We currently have that commented out, but we could very easily uncommented with our company class.

17
00:00:52,080 --> 00:00:55,440
We have two things that we can effectively do with it.

18
00:00:56,010 --> 00:00:58,230
We can use it to create a new instance of a company.

19
00:00:58,860 --> 00:01:02,940
And then with that instance of a company, we can reference its company name, catch phrase, latitude,

20
00:01:02,940 --> 00:01:03,510
longitude.

21
00:01:04,680 --> 00:01:06,840
Likewise, we've got the user class as well.

22
00:01:07,840 --> 00:01:10,780
It's currently commented out, but whatever we can, easily uncommented.

23
00:01:11,930 --> 00:01:16,970
With the user class, we can create a new instance of it or then reference that instances named latitude

24
00:01:16,970 --> 00:01:17,650
and longitude.

25
00:01:18,170 --> 00:01:23,780
So I'm just trying to describe like the total surface area of what we can do in Sibat index dots file

26
00:01:23,780 --> 00:01:24,250
right now.

27
00:01:24,600 --> 00:01:27,390
And so that's basically what we can do with the company and the user.

28
00:01:27,890 --> 00:01:32,090
Now, they're technically are other methods available to us, like, you know, the name properties,

29
00:01:32,090 --> 00:01:34,880
a string that has like a two uppercase method and so on.

30
00:01:35,160 --> 00:01:39,980
I'm just trying to write out or diagram out all the different things that we've added into our application

31
00:01:39,980 --> 00:01:42,080
that's specific to our application.

32
00:01:43,060 --> 00:01:47,660
So in other words, the surface area of the company and the user classes is quite small.

33
00:01:48,460 --> 00:01:50,760
Let's now start to think about that map we just created.

34
00:01:50,770 --> 00:01:52,840
However, I'm going to zoom back out just a little bit.

35
00:01:53,710 --> 00:01:55,960
So in the last video, we created that Google map, right.

36
00:01:56,560 --> 00:02:00,790
So we said right here, we said new Google Maps, Maps, dot map.

37
00:02:01,240 --> 00:02:03,820
This creates an instance of a map right here.

38
00:02:03,820 --> 00:02:07,000
We could technically assign the results of that to a variable.

39
00:02:08,300 --> 00:02:09,080
Like so.

40
00:02:10,130 --> 00:02:14,990
And then down here, we could write out a map and try to call a bunch of different methods attached

41
00:02:14,990 --> 00:02:16,140
to that Google map we created.

42
00:02:16,160 --> 00:02:20,300
So if I put a dot right there, I'll see all the different methods that are attached to a map.

43
00:02:20,770 --> 00:02:25,880
So I see add listener Binta changed fit bounds, get get bounce, all those different things.

44
00:02:25,880 --> 00:02:29,000
Those are all different methods we actually saw inside the type definition file.

45
00:02:29,330 --> 00:02:32,840
So another way of seeing all those different methods would once again be to command.

46
00:02:32,840 --> 00:02:36,710
Click on map right there and you'll see all those same functions listed out right here.

47
00:02:36,740 --> 00:02:40,040
These are all functions that belong to that instance of a map.

48
00:02:40,850 --> 00:02:43,190
And so those are what these boxes all represent.

49
00:02:43,190 --> 00:02:44,250
Size diagram right here.

50
00:02:44,270 --> 00:02:48,480
So we've got methods like Set Zoom, so that center set street view and so on.

51
00:02:49,160 --> 00:02:50,360
So why is this relevant?

52
00:02:51,020 --> 00:02:54,560
Well, this is going to seem like a weird thing, but I just want to point it out.

53
00:02:55,260 --> 00:02:59,950
These are all methods that we have exposed inside of our index file.

54
00:03:00,410 --> 00:03:06,080
So if another engineer started to come into our project, they could look at that map variable and say,

55
00:03:06,290 --> 00:03:09,020
oh, hey, look at these cool methods, attach the map.

56
00:03:09,230 --> 00:03:11,640
You know what I feel like, just starting to call them.

57
00:03:12,140 --> 00:03:17,570
So another engineer might come into our project, start calling the methods associated with that map

58
00:03:17,570 --> 00:03:20,510
and very easily break our application.

59
00:03:21,080 --> 00:03:22,880
I know that sounds strange.

60
00:03:22,880 --> 00:03:23,750
I know that's weird.

61
00:03:23,750 --> 00:03:26,060
Like, that's the job of Google Maps, right?

62
00:03:26,090 --> 00:03:28,890
Google Maps is here to expose all these different methods.

63
00:03:29,540 --> 00:03:35,480
My only point is that you and I, as the sole developers of this application, have not vetted these

64
00:03:35,480 --> 00:03:35,840
methods.

65
00:03:35,840 --> 00:03:40,460
We haven't sat down and said, oh, yeah, if you call these things, our application is going to continue

66
00:03:40,460 --> 00:03:41,620
to work perfectly.

67
00:03:41,990 --> 00:03:42,880
We didn't do that.

68
00:03:43,340 --> 00:03:48,740
So in theory, if someone started to call these methods, it might horribly break our application.

69
00:03:50,200 --> 00:03:56,920
Again, I know this sounds like a stretch, but let me just make a suggestion, maybe if we found out

70
00:03:56,920 --> 00:04:04,030
a way to limit other engineers access to these methods right here, maybe that would just slightly decrease

71
00:04:04,030 --> 00:04:06,860
the chances of our application breaking horribly.

72
00:04:07,570 --> 00:04:08,980
So here's what I'm going to suggest.

73
00:04:09,930 --> 00:04:16,709
Maybe we start to like firm up or limit the number of things we can do inside the index file, maybe

74
00:04:16,709 --> 00:04:22,890
we say the only things you can do inside of this file is create a new company, reference its properties,

75
00:04:23,310 --> 00:04:29,910
create a new user, reference its properties, and then maybe we should create a new class called MAP,

76
00:04:29,940 --> 00:04:31,830
like our own custom map class.

77
00:04:33,140 --> 00:04:38,720
And this custom map class can be used to create a new instance of a Google map, so this right here

78
00:04:39,200 --> 00:04:41,590
will create a new instance of a map, to be precise.

79
00:04:41,600 --> 00:04:44,330
And during that process, we can create a new instance of a Google map.

80
00:04:44,810 --> 00:04:50,600
And also on that map class, we can add a method called add marker, and we'll use that function right

81
00:04:50,600 --> 00:04:55,730
there to achieve our original goal, this application of showing a marker for user and company on the

82
00:04:55,730 --> 00:04:56,480
actual map.

83
00:04:57,420 --> 00:05:01,050
So, again, this class right here, you and I are going to create this is like maybe a better name

84
00:05:01,050 --> 00:05:02,970
for it to be like custom map like so.

85
00:05:03,970 --> 00:05:09,400
So then wrapped up inside this class, we will have some logic to create a Google map.

86
00:05:10,160 --> 00:05:16,220
And the important thing here is that that Google map and all of its associated dangerous functions and

87
00:05:16,220 --> 00:05:21,120
methods right here will not be easily exposed inside of our index file.

88
00:05:21,680 --> 00:05:27,140
And so if another engineer came into our project, they can't just open up that inducts file and start

89
00:05:27,140 --> 00:05:29,810
calling random methods on the Google map.

90
00:05:30,330 --> 00:05:32,270
Instead, we've hidden all those methods.

91
00:05:32,510 --> 00:05:38,660
We've wrapped them all up and taken them away from engineers and hidden them behind this facade of sorts

92
00:05:38,900 --> 00:05:41,950
or this kind of like black box of custom map.

93
00:05:42,350 --> 00:05:46,340
And the only thing you can do with custom map is create a new map and add a marker to it.

94
00:05:47,490 --> 00:05:52,320
Again, I know this sounds like a stretch, but the whole idea here is that if we have a program where

95
00:05:52,320 --> 00:05:58,110
these are like the only things you can do, chances are it's going to be way more challenging for people

96
00:05:58,110 --> 00:06:00,480
to come into our app and start to break things.

97
00:06:01,440 --> 00:06:03,030
All right, so let's take a quick pause right here.

98
00:06:03,210 --> 00:06:09,120
When we come back, the next video, we're going to start to extract this logic to create a Google map

99
00:06:09,120 --> 00:06:11,610
right here into a new class.

100
00:06:11,970 --> 00:06:17,130
And once again, this logic to create a Google map is going to wrap up all that stuff or give me our

101
00:06:17,130 --> 00:06:22,380
new class is going to wrap up the Google map and try to hide its existence from other engineers so they

102
00:06:22,380 --> 00:06:24,510
can't accidentally break our application.

103
00:06:25,370 --> 00:06:28,100
All right, so quick pause right here, take care of that in the next video.

