Let's first take a look at the legacy bank account class so you can see here that we collect the ID
and the name of the person for which we are creating the bank account.
And this this application here is sending this data to a service and a service will create the bank
account for us.
But now the service has changed and it requires a bit more information from apart from the ID and the
name.
So let's take a look at the service class here.
You can see there is a bunch of variables here.
We have ID, name, email and amount's.
So basically we don't have this information.
The legacy bank account application is not getting this information through the service.
So basically, you need an adapter to adapt the new request.
The actually the old request to to the new one, to the new service.
So we will create a bank account adapter.
And by doing the required information, the required extra information will be taken from personal info
database class like we see here.
So basically here we are, apart from the idea, we have all the information we need for the bank account.
So we will take from the adapter.
We will take inside the adapter.
We will take those those info from the personal info DBI class.
So basically, first of all, let's let's see the interface on which this bank account adapter is based
on.
We have a few operations here for getting the required information, for breaking the bank account and
the adapter here implements this this interface.
So as you can see here, we create a new legacy bank account, for instance, and also a deep connected
instance.
Both are needed because the legacy bank account will provide us the ID and the name, the information
that is used to to provide in the past and the personal info database.
It will provide the extra information that the new service for a congregation needs.
And as you can see here, we have some letters and we get the ID and the name from the instance of the
legacy bank account and the DBE Connector will get us the email and the amount.
So you you may say that you can easily change this, but imagine that you have a very, very complex
application of very complex client application, a legacy, one on which many, many systems are based.
So you won't want to change this this application, because you may introduce issues, you may introduce
bugs.
And also, it's not advisable to to change this.
You may want to create an adapter to adapt this old application to the new requirements.
So let's take a look in the atlas here.
So we created a legacy bank account with this idea and this name.
And I have commented this this line here, because as you can see, we actually create a service for
a creation and we try to apply only to get the idea and to get name getters from the legacy bank account.
And this won't work.
This won't compile because there are missing parameters.
So if we take a look again into account creation service, you will see that for the constructor.
We need also the email address and initial amount for that bank account.
So that's why I come into this out.
So basically, we we also create a personal info database here.
We sign the email address for this for the same person and also the initial amount.
And what we are doing here is we create an adapter, for instance, of the adapter we supply to the
adapters constructor, the legacy bank account and also the personal info database.
And the account creation service will be created based on the information supplied by the bank account
adductor.
So as you can see here, account creation service will create the account.
Also, there is no error in the lines above here.
So basically we supply all the information that is required in the contract between the client and the
service.
So let's run this and you will see that we will get accounts has been created a line here.
So this is this is working.
But if we were to use the legacy bank account.
It would have been difficult to get this working because we only supply it with only two parameters
here.
That's it for the adoptive father.
Join me in the next story where we are going to discuss about the breach button.
So see you in the next aureole.