and talk here all without percent with you in today's Here I'm going to talk about Diogo which is actually a pattern of projects even though most people who use this pattern do not know how to draw a pattern so let's go there What up So what if you're new around here a lot Nice to meet you, my name is Carlos pizani by here I help professionals age has a Architects Become Expert Architects which is one of the more technical professions relevant to be better remunerated at market currently And today we will talk about one more
pattern to get rich further your range of knowledge about patterns and this time we are talking about Tite or and what means the title the title means lay transfer Object That is a standard that serves for you to transfer right process data between layers between Tears only if you don't know about uncles and laws I keep pace with you watch the video after this content that we did explaining about 13 Lakers and who is well complete is well nice you will like this video but then that's fine after that to finish you click here on
the link that goes be here from the registrations and watch back then to our theme main the golden one and it works for you synthesize for example signatures of method method returns if you return there to king right with finally is trump some over there right Charlie value is whatever something else along these lines you are processed richer object is the return or even even in the signature of your methods you pass the language class and this class it has the properties that represent right the parameterization of your method then speaking in a very synthesized
way consists of creating anemia classes to make that transfer paper of data between layers and what is one anemic class Pisani a class A same which is a class that has no methods functions events look at this is a tension properties right These properties literally serve to represent the data structure is like there the drawing a table right the properties there are the columns of the tables so it is one of for pretty much of the dice that comes there in your data layer then the anemic class that's it she is just very age the
property in general public and which are the big ones advantages of this pattern the first one is that they improve a lot the code maintainability since you will have a unique signature there it's not based on a class so it stays much easier on you even deal with what comes in your signature that sells optional mandatory You can treat all this within your own ti class or another big one advantage is establishing right contracts for your methods both inbound account outbound it practically gives you exactly there direct what is expected of you receive there as
an answer from one method and also enables you to sends exactly there the type of entity to a function by a method without counting that you can have subtypes that can be even richer right subtypes a property for example it can be from a specific type for example she can be of the telephone type the address and food having an entire address is a way for you to process your object, right in a synthesized way it is a parameter only but inside I have all objects structured another positive point of the default is that it
prevents you from having a mind objects there from your data layer for example that has methods that have interfaces things to be unnecessary for classes going see in this data that will be processed there between the layers then to another one Class A class at the top right there front-end for example only interests the data does not interest the others properties this helps on encapsulation wantone more advantage he improves and improves too much one evolution and maintenance of the code helps a lot in this evolutionary process of continuous improvement of your code because once you
have an anemic class which for example will be used for data delimitation between layers right This class is unique and it will be used by many other objects in other classes in this way, right to change her all others will be impacted Then it will be much easier on you identify right the 10 nowadays they get you they already give you a relationship map at from everywhere those amount used and thus you there is a very simplified form of find one too many and be needed adjust not to mention that many times you don't even
need to change a rule of business for example inside a layer a business layer a bed of Top filter you don't need to mess with nothing Maybe it's just there really na data layer right for effectively persist that bank information right to do the one in the park Maybe it's just nude or and in data layer many times, right? I've seen this happen from be necessary to change font right a data layer and uncle or that's it with that we already had the new field being né is considered in the front end and persisted in
the database and then how disadvantages a and festively but objects more classes within our codes and this will make us we have so much bigger work to develop right A little bit more say it At the beginning there create a class instantiate it is probably not you will put it and a separate strip, right So you will have to reference this one shot So there's a little work bigger at the beginning for you to implement but Deco maintainability gains are very big and once you have it there one more layer for you to implement is
one more layer also to be tested and in the process for example work kick You'll probably have to is there somehow the source his or relate his source to be able to properly debug your code I don't know if the last one disadvantage I would like to point out that that simplicity we have of many times they only put me to more in the dit-on right And there in the layer of data Sometimes we forget one layer in the middle and she can give an o unexpected is not can have the Unexpected behavior some sort
of unforeseen error is mainly if don't adopt unit testing your code you don't have tests unitary in working with tdd by example has high chances of a point another there that had a dependency on you forget right and end up giving some kind of problem then this facility that it brings and sometimes also generates problems and when we don't have them unit tests can happen there on production that can give a lot of pain from head Well now I'm going to demonstrate for you this pattern a little bit more one detail in a diagram and
it before the people put a diagram I wanted to make you one order if you're enjoying this one content pause it now AND share with that bosom friend of yours who likes it architecture because certainly scout do go help him too ok then break this one for us invite your friend that's it will make them channel I got even stronger have more people and with that we will bring even more content for you cool so let's go to the diagram here then this is the diagram and I served CDM 100% structural and behavioral CDM okay
people call this one public ter there is a mixture of the two and if you want know a little more about CDM at we have a lot of content on you channel you will find several videos talking about that's ok, check it out later so we have here at nbone Example right We have here the user one little front-end layer, don't you realize that this here is a little late, right then freshly made from Frontin of ours is one take it right Talking about CDM and then us here we have a back-end layer that it's
also a shot and we have one data layer that is also a shot In this context the data layer only has the database for was very said to our backend layer it has a sub layer inside that is our body and our color is composed of three sub layers which is our faceid our lie down and our Business is an architecture of three layers widely used in past, until today, there are still many simpler applications there that make use of of this architecture the context, right for us to process at front-end for beck and data
right and do backend to data layer it is actually very common that if use the RM and that the RM will do it it goes through reflection many times what is a procedure there that you dynamically creates classes and memory right it will get data here from the bank, right transform this bank information is in a structured way into objects dynamically right And it will bring here to data layer nodes in this context many times we have dice rules here both filtering from relationship between objects between many other things that we do here in the
data layer only the object that it is generated by the RM for example he is an object there in a certain way rich he has a lot of information he doesn't it's an anime class he's a class it has several implementations of interface and things coming from RM himself to get it built and not even memory and everything else good then this way if we finish this one object here from data layer to Business my Bis will need also meet in my RM to think know the interfaces and a good many others things also from
my RM right to be able to use this return from here in the data layer and the same goes happen by faceid and look at that thing the same happen there for the front end So imagine my back and everything goes needing to know my MRI takes having one coupling with it and my frontend there will also be coupling with my o RM look at the problem we have right E then how do we solve it by creating one another layer we have another strip that I side and realize she's a Cross ter right one
is a strip that covers there the front-end and the back-end and the layer of data inside it here it is again using the CDM, the little ball climate, right indicating here a string 1 the identity right and here I'm saying he's mine custom of né i.e. it represents the my client is in here I put the properties it has which is code name right birthday and Sex an interesting thing is that the we can put some code inside from uncle or since he doesn't have it coupling with no other layer so for example if it
is a rule maximum amount type formatting of characters is the birthday cannot be higher than the current day, right i can't have a user who was born in the future, right, sex has to be male female for example right So these things you can put inside the It's yours or no problem at all but like this again without coupling with business rule layer or dice can't ok I gotta be one code there purely for consistency in the information from the getters and setters valid properties there alright case contrary If you start to put functions in
here is no longer one anemic class and maybe I don't do it anymore meaning you use it as you or so you realized we can use that from our front end this cancer double left here right get richHere it is with the properties that came from ours suddenly from ours limit right, I did the submit falling one server-side of the server-side I enrich the my uncle or what he came with from my I submitted, right, crazy that I had in mine implants and based on that, I submit there for my corr on my face and
me I have a faceid layer, right? For her I I already spend the night uncle as a parameter by example to save my client os my client's data this guy will be submitted for both months and to finish in shape here in mine Business layer I'll have the whole business rule handling and on time that I submit here to end myself from data right in my layer data There you go I transform this data right into the uncle of RN and database supplement So I got this hated decoupling it helps a lot with that and
those I have do made sense to you if so here don't forget that like that like Maroto to help our team channel because it helps the help too much content reaching more and more people and we understand that this type of content makes sense to you nifty here big hug see you next time