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