We can now show a Google map on the screen, which is great, but before we move on and start showing
the markers, there's one last little thing I want to mention.
I want to focus on the index stats file right now.
I want to point out something inside of here.
This is going to seem like a really strange thing to point out.
Nonetheless, I just want to mention it.
Let's just take a look at a diagram.
I think you'll start to understand what I'm going to be talking about here.
OK, so quick diagram.
All right.
So this is kind of a crazy diagram.
Its purpose is to try to show all the different things that we can effectively do inside the index file.
And I know that's weird to say, but let's just kind of walk to the diagram step by step.
It's going to zoom in a little bit here and go up to the top.
So inside of our index doctor's file, we've got an important statement for our company class now.
We currently have that commented out, but we could very easily uncommented with our company class.
We have two things that we can effectively do with it.
We can use it to create a new instance of a company.
And then with that instance of a company, we can reference its company name, catch phrase, latitude,
longitude.
Likewise, we've got the user class as well.
It's currently commented out, but whatever we can, easily uncommented.
With the user class, we can create a new instance of it or then reference that instances named latitude
and longitude.
So I'm just trying to describe like the total surface area of what we can do in Sibat index dots file
right now.
And so that's basically what we can do with the company and the user.
Now, they're technically are other methods available to us, like, you know, the name properties,
a string that has like a two uppercase method and so on.
I'm just trying to write out or diagram out all the different things that we've added into our application
that's specific to our application.
So in other words, the surface area of the company and the user classes is quite small.
Let's now start to think about that map we just created.
However, I'm going to zoom back out just a little bit.
So in the last video, we created that Google map, right.
So we said right here, we said new Google Maps, Maps, dot map.
This creates an instance of a map right here.
We could technically assign the results of that to a variable.
Like so.
And then down here, we could write out a map and try to call a bunch of different methods attached
to that Google map we created.
So if I put a dot right there, I'll see all the different methods that are attached to a map.
So I see add listener Binta changed fit bounds, get get bounce, all those different things.
Those are all different methods we actually saw inside the type definition file.
So another way of seeing all those different methods would once again be to command.
Click on map right there and you'll see all those same functions listed out right here.
These are all functions that belong to that instance of a map.
And so those are what these boxes all represent.
Size diagram right here.
So we've got methods like Set Zoom, so that center set street view and so on.
So why is this relevant?
Well, this is going to seem like a weird thing, but I just want to point it out.
These are all methods that we have exposed inside of our index file.
So if another engineer started to come into our project, they could look at that map variable and say,
oh, hey, look at these cool methods, attach the map.
You know what I feel like, just starting to call them.
So another engineer might come into our project, start calling the methods associated with that map
and very easily break our application.
I know that sounds strange.
I know that's weird.
Like, that's the job of Google Maps, right?
Google Maps is here to expose all these different methods.
My only point is that you and I, as the sole developers of this application, have not vetted these
methods.
We haven't sat down and said, oh, yeah, if you call these things, our application is going to continue
to work perfectly.
We didn't do that.
So in theory, if someone started to call these methods, it might horribly break our application.
Again, I know this sounds like a stretch, but let me just make a suggestion, maybe if we found out
a way to limit other engineers access to these methods right here, maybe that would just slightly decrease
the chances of our application breaking horribly.
So here's what I'm going to suggest.
Maybe we start to like firm up or limit the number of things we can do inside the index file, maybe
we say the only things you can do inside of this file is create a new company, reference its properties,
create a new user, reference its properties, and then maybe we should create a new class called MAP,
like our own custom map class.
And this custom map class can be used to create a new instance of a Google map, so this right here
will create a new instance of a map, to be precise.
And during that process, we can create a new instance of a Google map.
And also on that map class, we can add a method called add marker, and we'll use that function right
there to achieve our original goal, this application of showing a marker for user and company on the
actual map.
So, again, this class right here, you and I are going to create this is like maybe a better name
for it to be like custom map like so.
So then wrapped up inside this class, we will have some logic to create a Google map.
And the important thing here is that that Google map and all of its associated dangerous functions and
methods right here will not be easily exposed inside of our index file.
And so if another engineer came into our project, they can't just open up that inducts file and start
calling random methods on the Google map.
Instead, we've hidden all those methods.
We've wrapped them all up and taken them away from engineers and hidden them behind this facade of sorts
or this kind of like black box of custom map.
And the only thing you can do with custom map is create a new map and add a marker to it.
Again, I know this sounds like a stretch, but the whole idea here is that if we have a program where
these are like the only things you can do, chances are it's going to be way more challenging for people
to come into our app and start to break things.
All right, so let's take a quick pause right here.
When we come back, the next video, we're going to start to extract this logic to create a Google map
right here into a new class.
And once again, this logic to create a Google map is going to wrap up all that stuff or give me our
new class is going to wrap up the Google map and try to hide its existence from other engineers so they
can't accidentally break our application.
All right, so quick pause right here, take care of that in the next video.