In this video, we're going to continue by implementing our ad company, Markhor method, so I'm still
inside my customer class.
I'm down here at the bottom.
I'm going to expand the method definition.
We're going to create another marker inside of here.
Now, as you might guess, the marker code is going to look awfully similar to what we just did.
The only difference is that we're now pulling the latitude and longitude off of a instance of a company
as opposed to a user.
So I'm going to add in new Google Maps, Merkur, new capital in Merker.
We're going to give this thing and options object, it's going to have a map property that is a reference
to the map that we want to add the marker to, which will be this dot Google map.
And we'll see how that position property that's going to have a lattitude coming from our company,
that would be company, that location, Laerte, and a longitude company coming from company, that
location, that LNG like so.
All right, so I'm going to save this, and right away, you're going to notice that these two methods
right here look awfully darn similar, don't they, huh?
That's kind of funny.
Well, before we start to obsess over that too much, let's make sure we can actually show a marker
for a company that's going to go back over to index inducts.
I'm going to uncommented are important for company right underneath my user.
I'll create a company.
And we can use that company and add it as a marker to customer support ad company marker and I'll pass
in my company like so.
So let's save this flip back over to the browser again and just make sure we can see our merker.
Yep, sure can.
All right, so we got both our markers to display, but like I said, well, our custom map file or
our class doesn't have the best format right now.
So this right here, this ends the bad code we've written.
So from here on out, we're going to discuss how to fix the bad code we have inside of here.
First off, let's make sure it's really clear what is bad about this.
So the very bad thing here is that we've got two different methods that very clearly have, you know,
a ton of duplication between them.
The only difference is that in this case, we are accepting a user and in this case we are accepting
a company.
Now, it sure would be great if we could just take in like one method and say, hey, as long as you
are passing in something that has like a latitude and longitude, everything is going to work out just
fine.
And that's exactly what we want to do.
We're going to take these two methods and figure out how to condense them down to just one.
So let's take a quick pause right here.
We're going to come back to the next video and take a look at a couple of diagrams to understand how
we're going to do this by using interfaces and what the implication of it is.
So quick break and we'll see you in just a minute.