1
00:00:00,880 --> 00:00:05,830
In this video, we're going to continue by implementing our ad company, Markhor method, so I'm still

2
00:00:05,830 --> 00:00:07,240
inside my customer class.

3
00:00:07,250 --> 00:00:08,280
I'm down here at the bottom.

4
00:00:08,560 --> 00:00:10,590
I'm going to expand the method definition.

5
00:00:10,870 --> 00:00:12,850
We're going to create another marker inside of here.

6
00:00:13,330 --> 00:00:17,920
Now, as you might guess, the marker code is going to look awfully similar to what we just did.

7
00:00:18,520 --> 00:00:23,590
The only difference is that we're now pulling the latitude and longitude off of a instance of a company

8
00:00:23,590 --> 00:00:24,640
as opposed to a user.

9
00:00:26,150 --> 00:00:31,880
So I'm going to add in new Google Maps, Merkur, new capital in Merker.

10
00:00:34,370 --> 00:00:38,900
We're going to give this thing and options object, it's going to have a map property that is a reference

11
00:00:38,900 --> 00:00:42,110
to the map that we want to add the marker to, which will be this dot Google map.

12
00:00:43,060 --> 00:00:47,230
And we'll see how that position property that's going to have a lattitude coming from our company,

13
00:00:47,690 --> 00:00:54,040
that would be company, that location, Laerte, and a longitude company coming from company, that

14
00:00:54,040 --> 00:00:56,350
location, that LNG like so.

15
00:00:57,650 --> 00:01:02,570
All right, so I'm going to save this, and right away, you're going to notice that these two methods

16
00:01:02,570 --> 00:01:05,740
right here look awfully darn similar, don't they, huh?

17
00:01:05,790 --> 00:01:06,590
That's kind of funny.

18
00:01:07,250 --> 00:01:11,330
Well, before we start to obsess over that too much, let's make sure we can actually show a marker

19
00:01:11,330 --> 00:01:14,270
for a company that's going to go back over to index inducts.

20
00:01:14,780 --> 00:01:19,460
I'm going to uncommented are important for company right underneath my user.

21
00:01:19,490 --> 00:01:20,420
I'll create a company.

22
00:01:23,690 --> 00:01:32,330
And we can use that company and add it as a marker to customer support ad company marker and I'll pass

23
00:01:32,330 --> 00:01:33,770
in my company like so.

24
00:01:35,720 --> 00:01:40,040
So let's save this flip back over to the browser again and just make sure we can see our merker.

25
00:01:40,050 --> 00:01:41,120
Yep, sure can.

26
00:01:42,690 --> 00:01:48,730
All right, so we got both our markers to display, but like I said, well, our custom map file or

27
00:01:48,730 --> 00:01:51,540
our class doesn't have the best format right now.

28
00:01:52,260 --> 00:01:55,080
So this right here, this ends the bad code we've written.

29
00:01:55,290 --> 00:01:58,770
So from here on out, we're going to discuss how to fix the bad code we have inside of here.

30
00:01:59,430 --> 00:02:02,670
First off, let's make sure it's really clear what is bad about this.

31
00:02:03,340 --> 00:02:09,570
So the very bad thing here is that we've got two different methods that very clearly have, you know,

32
00:02:09,570 --> 00:02:11,300
a ton of duplication between them.

33
00:02:11,490 --> 00:02:15,420
The only difference is that in this case, we are accepting a user and in this case we are accepting

34
00:02:15,420 --> 00:02:16,090
a company.

35
00:02:16,680 --> 00:02:21,870
Now, it sure would be great if we could just take in like one method and say, hey, as long as you

36
00:02:21,870 --> 00:02:26,430
are passing in something that has like a latitude and longitude, everything is going to work out just

37
00:02:26,430 --> 00:02:26,850
fine.

38
00:02:27,300 --> 00:02:28,740
And that's exactly what we want to do.

39
00:02:28,770 --> 00:02:32,550
We're going to take these two methods and figure out how to condense them down to just one.

40
00:02:33,390 --> 00:02:34,630
So let's take a quick pause right here.

41
00:02:34,650 --> 00:02:38,040
We're going to come back to the next video and take a look at a couple of diagrams to understand how

42
00:02:38,040 --> 00:02:42,330
we're going to do this by using interfaces and what the implication of it is.

43
00:02:42,520 --> 00:02:44,450
So quick break and we'll see you in just a minute.

