1
00:00:00,660 --> 00:00:07,230
Yambo has a very nice feature called Anker's in the beginning, it does seem a bit weird to use it,

2
00:00:07,620 --> 00:00:13,290
but in this lecture I would try to explain you what anchors are, how you can use them effectively.

3
00:00:13,620 --> 00:00:16,230
And, yeah, hopefully this will work out.

4
00:00:18,050 --> 00:00:25,130
So let's jump in to an example so that you can easily understand what I'm talking about in this very

5
00:00:25,150 --> 00:00:32,270
simple person object that we have here, let's imagine that we have another property called a cell or

6
00:00:32,270 --> 00:00:32,990
something like that.

7
00:00:33,860 --> 00:00:39,590
And let's say all this property always has to be equal with what says on names of for example, the

8
00:00:39,590 --> 00:00:40,250
name is John.

9
00:00:42,240 --> 00:00:46,900
So, for example, the name is John, then this property needs to be John as well.

10
00:00:47,100 --> 00:00:51,830
If I change it here to Jane, it should be Jane as well.

11
00:00:53,480 --> 00:00:59,960
It maybe just doesn't make a lot of sense here, but just hang on for a second in order to avoid this

12
00:00:59,980 --> 00:01:00,680
duplication.

13
00:01:01,790 --> 00:01:10,580
Yamal provides this important feature called Angus, and which means we can sort of like define a value

14
00:01:10,580 --> 00:01:18,980
and a value, and we do it by using the ampersand sign and defining an alias on just called alias name

15
00:01:18,980 --> 00:01:19,350
here.

16
00:01:20,020 --> 00:01:24,030
It's the same as the key here, but it doesn't have to be the same.

17
00:01:25,040 --> 00:01:27,620
And now I have to find this alias here.

18
00:01:28,800 --> 00:01:35,820
I can replace Jane here with asterisks in the name of the alias that I have selected in this case was

19
00:01:35,820 --> 00:01:36,060
named.

20
00:01:38,890 --> 00:01:45,460
So let's copy and paste this and go to our Yamal, to Jason Convertino and take a closer look at what

21
00:01:45,460 --> 00:01:46,440
has happened.

22
00:01:48,660 --> 00:01:57,300
So now I'm going to convert it to Jason and you will see here, that name is Gene and Self is Gene,

23
00:01:57,930 --> 00:02:01,170
and I didn't have to duplicate this fellow.

24
00:02:01,170 --> 00:02:03,180
So if I'm changing here to something else.

25
00:02:06,250 --> 00:02:09,910
It has changed here as well, so this is a very important.

26
00:02:11,060 --> 00:02:19,070
Feature of the language that allows us to do stuff like this, simply anchoring a property isn't really

27
00:02:19,070 --> 00:02:20,040
that helpful.

28
00:02:20,060 --> 00:02:24,080
You could use it, but usually it's not that powerful.

29
00:02:24,590 --> 00:02:29,780
But I just wanted to start in a very, very small example so that you can have and understand exactly

30
00:02:29,780 --> 00:02:30,650
how this works.

31
00:02:32,860 --> 00:02:39,650
Let's go back and say that we maybe have multiple persons, which in this case is not the scenario.

32
00:02:39,920 --> 00:02:46,970
But let's say we have to defined multiple persons and for whatever reason, they share some common properties.

33
00:02:47,240 --> 00:02:49,610
So, for example, if I defined here based person.

34
00:02:52,670 --> 00:02:53,420
We can say that.

35
00:02:55,010 --> 00:02:58,740
Maybe the city and a country where they live is the same.

36
00:02:59,360 --> 00:02:59,780
So.

37
00:03:01,820 --> 00:03:07,760
City is New York City and country is USA, that's great.

38
00:03:09,120 --> 00:03:17,700
Now we can use this object and have its values anchored just as we have with a single value, so we

39
00:03:17,700 --> 00:03:20,670
can anchor an entire object, not only value.

40
00:03:21,330 --> 00:03:24,080
And the way we do it is pretty, pretty similar.

41
00:03:24,510 --> 00:03:32,130
So, for example, if I define my anchor here as base and I'm doing specifically not using the same

42
00:03:32,130 --> 00:03:38,700
as the property name as an object name to show you that you can define any an alias that you want.

43
00:03:40,650 --> 00:03:42,480
And now and go inside the person.

44
00:03:44,730 --> 00:03:48,450
But it will have to do is to put in to less than Signe's.

45
00:03:49,800 --> 00:03:50,250
Colin.

46
00:03:51,520 --> 00:03:53,800
And then again, I only got access to the property.

47
00:03:56,090 --> 00:03:57,150
And that one is space.

48
00:03:58,130 --> 00:04:04,410
So what this will do is it will basically merge these two objects.

49
00:04:04,760 --> 00:04:12,260
It will take the properties, city and country from base person, and it will add those properties to

50
00:04:12,260 --> 00:04:12,770
person.

51
00:04:14,430 --> 00:04:16,769
So, for example, if this was person one.

52
00:04:17,829 --> 00:04:24,550
And I have another person that is called person two, for example, then in that scenario, this will

53
00:04:24,580 --> 00:04:26,440
work and will not have a problem.

54
00:04:26,800 --> 00:04:29,080
We will able to use that multiple times.

55
00:04:29,260 --> 00:04:30,260
Now, I'm not going to use it.

56
00:04:30,280 --> 00:04:33,340
I just wanted to show you how it works for this very simple example.

57
00:04:35,100 --> 00:04:36,570
So back at the convertor.

58
00:04:40,120 --> 00:04:46,420
And you will see here that no person has the same properties that were inherited from base person,

59
00:04:46,420 --> 00:04:47,680
city and country.

60
00:04:47,710 --> 00:04:55,540
And this is a very, very powerful feature that you will be using when building your get PMO pipelines

61
00:04:55,870 --> 00:04:57,730
in order to reduce the amount of code.

62
00:04:59,490 --> 00:05:06,780
What's important to remember about anchors is that it helps you avoid duplicate content across your

63
00:05:06,780 --> 00:05:16,980
configurations and you can use anchors to sort of like inherit properties from other objects without

64
00:05:16,980 --> 00:05:19,130
having to duplicate a lot of stuff.

