1 00:00:00,670 --> 00:00:07,450 Let's first take a look at the legacy bank account class so you can see here that we collect the ID 2 00:00:07,450 --> 00:00:11,250 and the name of the person for which we are creating the bank account. 3 00:00:11,620 --> 00:00:19,570 And this this application here is sending this data to a service and a service will create the bank 4 00:00:19,570 --> 00:00:20,370 account for us. 5 00:00:20,710 --> 00:00:27,400 But now the service has changed and it requires a bit more information from apart from the ID and the 6 00:00:27,400 --> 00:00:27,640 name. 7 00:00:28,000 --> 00:00:30,340 So let's take a look at the service class here. 8 00:00:30,580 --> 00:00:34,590 You can see there is a bunch of variables here. 9 00:00:34,600 --> 00:00:37,270 We have ID, name, email and amount's. 10 00:00:37,270 --> 00:00:41,230 So basically we don't have this information. 11 00:00:41,500 --> 00:00:46,630 The legacy bank account application is not getting this information through the service. 12 00:00:46,660 --> 00:00:51,790 So basically, you need an adapter to adapt the new request. 13 00:00:52,550 --> 00:00:56,760 The actually the old request to to the new one, to the new service. 14 00:00:57,160 --> 00:01:01,360 So we will create a bank account adapter. 15 00:01:01,510 --> 00:01:09,010 And by doing the required information, the required extra information will be taken from personal info 16 00:01:09,040 --> 00:01:11,450 database class like we see here. 17 00:01:11,680 --> 00:01:16,570 So basically here we are, apart from the idea, we have all the information we need for the bank account. 18 00:01:17,020 --> 00:01:19,930 So we will take from the adapter. 19 00:01:20,350 --> 00:01:23,140 We will take inside the adapter. 20 00:01:23,140 --> 00:01:28,430 We will take those those info from the personal info DBI class. 21 00:01:28,990 --> 00:01:36,910 So basically, first of all, let's let's see the interface on which this bank account adapter is based 22 00:01:36,910 --> 00:01:37,150 on. 23 00:01:38,110 --> 00:01:45,100 We have a few operations here for getting the required information, for breaking the bank account and 24 00:01:45,220 --> 00:01:48,250 the adapter here implements this this interface. 25 00:01:48,640 --> 00:01:57,790 So as you can see here, we create a new legacy bank account, for instance, and also a deep connected 26 00:01:57,790 --> 00:01:58,330 instance. 27 00:01:58,720 --> 00:02:06,190 Both are needed because the legacy bank account will provide us the ID and the name, the information 28 00:02:06,190 --> 00:02:11,740 that is used to to provide in the past and the personal info database. 29 00:02:11,740 --> 00:02:16,770 It will provide the extra information that the new service for a congregation needs. 30 00:02:17,410 --> 00:02:25,480 And as you can see here, we have some letters and we get the ID and the name from the instance of the 31 00:02:25,480 --> 00:02:31,320 legacy bank account and the DBE Connector will get us the email and the amount. 32 00:02:32,680 --> 00:02:42,610 So you you may say that you can easily change this, but imagine that you have a very, very complex 33 00:02:42,610 --> 00:02:49,570 application of very complex client application, a legacy, one on which many, many systems are based. 34 00:02:49,720 --> 00:02:59,350 So you won't want to change this this application, because you may introduce issues, you may introduce 35 00:02:59,350 --> 00:02:59,770 bugs. 36 00:02:59,980 --> 00:03:03,130 And also, it's not advisable to to change this. 37 00:03:03,130 --> 00:03:10,650 You may want to create an adapter to adapt this old application to the new requirements. 38 00:03:10,960 --> 00:03:13,180 So let's take a look in the atlas here. 39 00:03:13,180 --> 00:03:17,800 So we created a legacy bank account with this idea and this name. 40 00:03:18,280 --> 00:03:25,870 And I have commented this this line here, because as you can see, we actually create a service for 41 00:03:25,870 --> 00:03:33,510 a creation and we try to apply only to get the idea and to get name getters from the legacy bank account. 42 00:03:33,520 --> 00:03:35,530 And this won't work. 43 00:03:35,540 --> 00:03:38,350 This won't compile because there are missing parameters. 44 00:03:38,360 --> 00:03:44,020 So if we take a look again into account creation service, you will see that for the constructor. 45 00:03:44,020 --> 00:03:48,840 We need also the email address and initial amount for that bank account. 46 00:03:49,120 --> 00:03:51,650 So that's why I come into this out. 47 00:03:51,910 --> 00:03:57,070 So basically, we we also create a personal info database here. 48 00:03:57,070 --> 00:04:03,850 We sign the email address for this for the same person and also the initial amount. 49 00:04:04,150 --> 00:04:12,760 And what we are doing here is we create an adapter, for instance, of the adapter we supply to the 50 00:04:13,120 --> 00:04:17,860 adapters constructor, the legacy bank account and also the personal info database. 51 00:04:18,130 --> 00:04:27,610 And the account creation service will be created based on the information supplied by the bank account 52 00:04:27,610 --> 00:04:28,060 adductor. 53 00:04:28,360 --> 00:04:32,530 So as you can see here, account creation service will create the account. 54 00:04:33,520 --> 00:04:37,920 Also, there is no error in the lines above here. 55 00:04:38,230 --> 00:04:45,400 So basically we supply all the information that is required in the contract between the client and the 56 00:04:45,400 --> 00:04:45,840 service. 57 00:04:46,270 --> 00:04:54,360 So let's run this and you will see that we will get accounts has been created a line here. 58 00:04:54,640 --> 00:04:56,440 So this is this is working. 59 00:04:56,440 --> 00:05:00,000 But if we were to use the legacy bank account. 60 00:05:00,610 --> 00:05:07,150 It would have been difficult to get this working because we only supply it with only two parameters 61 00:05:07,150 --> 00:05:07,420 here. 62 00:05:08,690 --> 00:05:10,690 That's it for the adoptive father. 63 00:05:11,000 --> 00:05:14,780 Join me in the next story where we are going to discuss about the breach button. 64 00:05:15,170 --> 00:05:16,900 So see you in the next aureole.