Six Most Used Design Patterns in Project

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Applause] first thing you know like thank you very much especially mine fire you know to organize this event and because when you say that you have to organize such kind of a event you have to fund the flight tickets you have to fund the hotels you have to fund your tea everything right so it involves definitely finance so let's do a big clap to mind fire first thank you very much and definitely to chin miser who has taken all the effort to you know put this so so quickly you know so that is my slide here so my name is shim and I am famous for bad reasons actually so so how many of you guys just quickly you know just to take a quick you know Paul so how many of you guys are Java here let's just you know like okay so must be 20% you know how many of you guys are she sharp tell him about you guys and how much you guys are JavaScript JavaScript I think it is cross-cutting right so she Shabbos guys will use JavaScript and Java guys will also use javascript and how many are others PHP by each other like okay how many a PHP she shop I say just okay oh that means oh there are something okay so okay so so that's good so quickly you know like as they have already given my introduction I will not go into that too much now you know so how many you guys have used design patterns in your project just I know that you've used everybody has used it right okay so can anyone tell me from this side one design pattern which you have used singleton singleton they in any interview book a singleton patterns other than that yeah factory patterns good job for our label IR okay and what else don't see singleton pattern and which other pattern in okay so MVC is a architectural pattern just quickly you know MBC is architecture pattern there is something called as a design pattern solo Thoris way for our topic say there is something called as a design pattern there is something called as architecture patterns and there is something called as a architectural style there are three things you know so design pattern solo we also have some you know prizes here so anyone here who can tell me the differences between all of these three design pattern like factories are design patterns singleton is a design pattern MVC is architecture pattern MVP is architecture pattern the rest is architectural style joko esperança member say they cannot answer this question okay then how the rest is architectural styles service-oriented is architectural style tell me like design patterns design something that is based on the core what we write I mean the approach we take to solve I solve this I mean problem and then the architectural patterns are driven by blocks and architecture styles are basically so I'll just write actually he's perfectly right so see what happens is like you know in design pattern you actually know some source code like if you are creating a singleton pattern you have to write a static keyword if you say you want to make a factory pattern you have to do this you can sit down and oh thank you very much for that while in an architectural pattern you just know the block diagrams so you have a model you have a view you have a controller now the asp.net guy creates a controller in a different way must be the Java guys they create a controller in a different place so nobody knows how that controller how that model is created right in architectural style you know we just have one line of saying that okay rest is a architectural style you know where you follow HTTP must be okay or you say service or entities are just a one-liner a principally that must be right word to use it's just one principle and then that principle how it is implemented is depends on technology right so remember all of this in India what happens the sub quiz design by today so like if you say factory is a design pattern and factories architecture pattern B and Indians understand us you know so so so quickly so I can see like there so I know that singleton pattern and while I'm here one more factory okay or consign repository okay repository and factory okay and what else now you I can tell you like you have used some of the design patterns you don't know today that's what I am going to iterate through right so a lot of people they think that they're using singleton they are only using factory or you know they are you only using some repository pattern and all that right so I will not go into design pattern I'm sure that you guys know design pattern what it is as a definition it is a time-tested solution for example if you see personally also yourself let's say you start as a fresher in one company and somebody teaches you a three layer architecture so what you do you get convinced that project is successful let us say you know then you get convinced then when you go like to our next company you use the same three layer architecture because it is time tested or Bhavna the cell given three layer gel thing whatever it is so means once you get confidence on that tested solution right you keep using it for example that they liked with me it happens like you say okay you create a login use a table roll table he a table whole table done it's there in the mind right because it is time tested you know so that's what is the design pattern but it is in terms of architecture not in terms of anything else right so here it is you know so half so a lot of people ask that how to learn design pattern half of the guys like half of the things you know you're already doing it today I will put a name around it so when you see my source code he will say no look I have done it so today I will just put the name saying that this is this pattern and this is this pattern right so you will come to know that you have done more than factory pattern you have done more than singleton pattern okay this the other thing which is very important before I start design patterns the six things here that you know design pattern should be natural it should not be like how do you see it should not be artificial for example I am fat I know I'm fat right yeah I said the room got to keep that I'm guru right so it should be natural like it should not be like you know because there is somebody a gora sitting to Somnath or a factory pattern here pattern of oh pattern Vogel is you know that that should not happen if that happens you know this one small cartoon you know given by my friend Oh cancer though that you call it as earn while you learn what love can we our factory pattern signal okay let us do it you know so remember if the design pattern is implemented naturally in your project you will enjoy it if how do you know that that design pattern is proper it is how it is implemented properly once you start coding that you feel it nay this is right and then sometimes you feel carrier is one layer you do a layer by layer by Cody right then it is something is wrong something is horribly gone wrong you are just trying to artificially do things and it is not right so the the one of the most important thing about design pattern it it should be natural okay if it is not naturally implemented there is something horribly wrong okay that's a sign that's one thing which I've learnt right so I leave this part okay so I'll go here to my source code now so let me start with the first pattern here so what I've done I have visual studio here I know that there are Java guys but like you know the same class the same interface you won't find any difference you know because I have to take one platform so I have taken C sharp right so you would understand almost all of the code right you guys you are able to see the codes right okay so let me start with the first pattern you know that is aggregate root anyone here who has done aggregate root impermeable field bullying ie I could get root it okay so if you look at what I have done is in the same code you know I have just pasted the what you call the definitions as well so you can see here that is the definition of the aggregate root pattern it says that everything has to go via a single root for example I don't know if you have done like line and line items order order and order line items so you create order class and then you create a line items inside it right and then any modification of the line items goes wire that route I'm sure you have done it right for example here it is here's a simple example once I show you the example you will understand it so this is simple solution Explorer here now here is the aggregate route so think about it you have a customer class and a customer class has lot of addresses objects inside so one customer has multiple addresses the source code clear I'm not sure okay here so now let us say you know and also in this I have created an address type and what I want to do is that okay this customer cannot have different type of addresses for example in this type I will say okay h4 home address and then I have Oh for office address now I cannot add a multiple office address to this okay if you look at this structure now I've made it public now if you see here I start using this you can see I have created a customer class and let us say I start typing here so this is a customer class I start adding addresses to it okay address dot add and I say I want to add a new address okay so people who are in Java people who are in PHP just try to grasp it I'm sure that you know it's all about classes and architecture here so here you know I add address of type o let's say this is office address okay now again like I go and I add an address of office of type oh this should not be allowed you cannot add multiple addresses of type oh so what will you do yes did we get the problem now if you see here if you if you look at this this thing here that addresses collection is naked means it is directly exposed out right as a list so anybody can go and add anything out there I'll be following everyone this has to be actually private and there it has to go through that route of customer so this is that's aggregate route so what you do out here is I am sure you have done it right you make this as private so you say this is a private and then you create an encapsulated method around it so you say okay here it is I will give you a method you are called as ad so in this I'll go and I will add an address ad D and before I add this I will do a loop here so I will say that address a in underscore addresses so if I find I get a of type is equal to a DD of type right I will throw exception now people who are in Java people who are in PHP not allowed right and if it is all okay I will just say underscore addresses dot add for each yeah for each ticket now you can see here if you see what is what is really happening is that that parent class is the single route through which all the modification of the address object is happening okay how many of you guys have done this in your project now come how to per right oh ok tks getting it so basically here now that addresses this is not naked you know it is like getting added and then you do all the validation but here is what is the what kind of problem do you see here if let us say I implement this this architecture right what is the other drawback of it anyone that is required because that's a logic right I need to check I need to check if it is existing ok I can go and write some better logic out there I can sort it right but the problem here is when you use too much aggregate route in your project your your the main class becomes very complicated because everything he has to handle now right he has to take all the requests and he has to then pass it on and then he has to do everything right so overall what happens is in aggregate route kind of architecture the whole the main class becomes too complicated and that is something you need to take care so you have to be very sure that if you want to use aggregate route or not did we care guys any questions here on aggregate route so in aggregate route you know that's what the definition is if you go online also to search I put it in the comments here in aggregate route what happens is that the objects are treated as a single unit and they go wire or root ok any questions on this aggregate root I am really surprised that only two or three hands on aggregate root it's like you should have used in this project a lot like it order order items customer addresses addresses me phones so always aggregate root yeah any questions any queries okay so let me go to the next one here there is something called as an iterator pattern so iterator pattern how many few gather use iterator pattern this is very important I guys this session I could have made an angular session this session I could have made a session of hardcore developers already have taken angular session right but this design pattern is all in your mind that how you think how you write good code right it makes you a better programmer so yeah iterator pattern anyone iterator pattern is not for each peoples are like lot of people say iterator pattern is for each right so here it is if you see your right cello I will talk about it so iterator pattern it says if you look at the definition it says it provides a way to access the element in an aggregate object so now look at this now let us go to this aggregate root here okay and over here what is this what is this expected how do i this people are catching thank you sub junda in it okay so now here now think about it okay this is good so you are following aggregate root and it is adding through a central but I want this addresses collection to be binded with the grid means you cannot make it private I want you to be exposed but I don't want to expose the add method are getting now what is happening is okay you you have done everything you know some good like you are checking but now there is a requirement which says okay which addresses are added I want to bind to a list so that means this has to be made public if this has to be made public I again go and invalidate that again do a mistake of making not creating an aggregate root right how what should I do here Dilek eight guys I want to go and loop I want to go and loo bind it to a list box bind it to a grid now how do i balance between aggregate root and also show it outside also he cannot modify directly create a list no miss display the list outside how do you display the list outside add a new method and that method will return what if he returns a list okay so a level I'll do this you know good this is how you think design pattern so like someone said you know like lot of people said do like this public list of address okay and I'll say get addresses as someone is saying like you know please expose out a method and I will say return underscore address with this you know if you see or the problem is the developers can go and do like this never underestimate a developer ah so cuckoo oregano so though what he will do is he will go and he will say get addresses dot ad because your collection is now exposed directly no I want to get the address collation outside I don't have to send it as a parameter which one public no even if you make a get you get the full list object outside right by reference I'm sure that even it is Java it's either PHP everything is by referent you modify the list he will modify that addresses did you get guys like so you said you want to go by aggregate route because there are some validations right so you went why I aggregate route now there is a imbalance saying that okay give me out of collection now you have stuck what the being from one side you will make all the brick other sides up on ebay right like what do you do for this right so that's what you know like if you look at this iterator pattern now you know what happens is this very important you know definitely in a project when you work two three ten patterns all going in one sense you know so here now when you say there is a aggregate route you will always get a little pattern iterator pattern is like connected with aggregate root okay so in this case now like what dot made guys do it and must be Java guys also have ienumerable ienumerator right so what you do is that you don't expose this as a list you actually make it as a ienumerable in java or do you have iterator i think so i don't know okay now what is this I never able to write this I inevitable says you can only loop you cannot go and do an ad so now what happens is if you see here if you look at this code here right in this code you will find that now I cannot do it can you see that I can only do a for each loop and if you want to add address I have to go via that method which I have created so that method I have to go okay so this method is only to go and add things and this method I can if you see here there are no methods of add or insert right so I can now I have the only way I can do is by using a a for each loop here iterator pattern iterator pattern helps you to iterate through a collection in a very safe way it does not expose how the manipulative methods like add insert update and delete it says you can only loop difficut guys so remember aggregate routes is always connected with the internet or pattern did we understand this yes any questions here so you can see now now this is natural that's what I am taking natural design pattern you said that you had a requirement you want to validate the whole object so you created a aggregate route now suddenly you said okay you want to expose out the collection then you start using iterator pattern nobody forced you now this kind of coding when you have write then you feel like is design pattern is natural okay any questions guys on aggregate root and iterator pattern did you get this code everyone okay solo let's see okay now one more our time is a constraint so I have six patterns if I am going near by the time I will create I will complete only four patterns but even if we do four patterns from this room and if you leave with for patterns in the head I think this event is successful okay at least for me for this session okay so must be I have said six but like I am talking so much how are alright so even like you know just and I'll get alert here if I get an alert I will not take the next pattern so any other patterns we can cover it through the email or something okay so let me start with the second pattern here the second pattern which is again very interesting here is a adapter pattern so can anyone tell me if you if you look at the definition that is the definition of adapter pattern it helps to make incompatible classes compatible what you understand from that get design patent may 8th line data I saw this and then that line is in a super English and then like like for example like guys like me they come from the Hindi medium and Marathi medium yeah but then you're like you know aggregate route when we come to know aggregate root polymer saith aggregate rules right now one of the biggest problem is that these all patterns are made in US and UK the workability of English when it comes to here in India it becomes difficult subdued Oh Java okay but what do you understand from that still what does it say function definition though it says incompatible classes there are two classes which are incompatible and you want to make them work together what is that situation which one casting is for data types this is at the class level casting two aapke one data type no that is not a force is no casting no no way okay good yeah so yeah you are you are like guys casting out Pedro or gyroplane like it's like it's going somewhere else okay so let me give you example here so what I've done in this project you know I have created the small small classes here and we can start using it now think about in a project right you are you're using a reporting you have a recording system okay so you are using that in let's say your you have 100 200 you guys everywhere you are using that reporting system and in that reporting system you have export method which exports to PDF or which exports to XLS now as a architect what do you think you know Oh like so people with people you know somebody can create an Excel report somebody can create a word report somebody can create a PDF report right so as architect you think like let us create an interface called as I export so that all the developers whoever is there he will say ok I want to create an excel report he follows the same naming convention export export export so for example like I tell some developer that you are to go and create a word so I will say ok public class a word report so he implements I report ok or somebody goes and says I want to create let's say an excel report so I say ok you also use I report right now with this what happens is you know there a lot of uniformity in my project and in any of the UI wherever this report is used I don't have to worry means anywhere when I use in my report like I just say here I report and I will just point it to excel report I will just system this is export and if I think that I should point towards a word report I I still think it is export so you know there is a there is a consistency you know across your you know things you know and everything is good right so as architect you say whatever report we have we will always point towards I report right now what happens suddenly you know there is a PDF to be generated a PDF report and you take up a third party now that third party does not have a safe method export method it has a method call is same now that is incompatible right so you end up writing a syntax in third party then save if not then this right so now here we have a situation where you have a third party DLL which is having a different naming convention and you cannot change it because normally when you get this DLL so these external things right you have to use as it is isn't it so now think about it you go so here is a let's say here's an example I'll say that this is let's say I have a third-party third-party PDF okay now this third party PDF says that no my naming convention is save third party PDF here now you are stuck now to think about it if you have something more than you just in you just increase your if conditions right so what we will do in such kind of condition are getting this is like I have written a class here but you cannot modify the method you will actually get a jar file or a DLL file you cannot change that right it's it's there you have got from a third party now how will you ensure that still it is always going through I export what will you do here is the bodies here kiss me kiss me export Kalugin look I cannot need your class say I cannot change it because it's a third party Manila kya pain but it's remember that it is a third party class I cannot change it right so what should I do to still ensure that I always point towards I report that name only says adapter when you have a plug and when you have a socket which is not getting connected what do you do you put adapter in between right so that means you know we need to have an adapter which will make that both the classes compatible so my class which is using export and that class which is using save I need to put at after in between getting an adapter pattern so what you do here is well what do you say like the wrapper classes how many guys have used I rap Tribune about that honestly only one adapter pattern so I will just show the example here so must be up for the code so here so what I'll do is I'll put adapter here adapter something you know PDF and this adapted PDF I can say that it implements this I export sorry I report right and in this what I will do is I will create an object off so I'll say your that this is third-party PDF X is equal to new third party PDF and X dot save now if you see here now if you look at my UI in the UI I I don't I will point towards that new adapter whatever it is and I still I call export it will get guys I have done nothing I've created a wrapper class nothing I have done so and after internally is nothing but a simple wrapper class which says that okay that is the third party you will just put a wrapper around it but you can see I have still implementing the same interface I export following it guys so that is a Raptor pattern it helps you to if you have to income incompatible classes it makes them compatible and especially when you're talking about third party integrations you always end up with a doctor any questions guys adapter pattern so we did adapter pattern we did iterator we did aggregate route way equations names man I know it's by coding me on the guy perfect I like you know I understand but see what happens in a project I said let's thank our sick thing but I can guarantee that a lot of people what they will do they will not use the adapter pattern or a flick a cake you say if this then third party if this they're not third party was you know done then there is one code there ten code 100 core sub you I'm a cool to be on yourself with and then it's a now change one more subject I change because they you know so like so you know the point is that in design pattern it has to click at the right time you know it if it leaks at the right time you save lot of things and a lot of people want the thing that design pattern should be done by seniors no I think design pattern should be done by a person who is even a one year experience because a senior guy how much he can control right Unni take a cold liquor how can he dictate from the top right he starts writing some bad code right he cannot go to every code and lie in khaki a Gurkha right so I think this design pattern should be learned by everyone I can understand that at a higher level when you see architecture etcetera I can understand but I think at the code level that person should know when to use adapter pattern because a senior cannot dictate this right only a junior can control it because he is coding he has to deliver ok ok so that is so that's quickly you know just I will put down the notes here so that whenever you feel like you know so first is as I said like we will cover two three patterns will will cover it properly aggregate route you go through a parent object right iterator pattern in aggregate route you loop without exposing that add update and delete methods while in adapter if you have incompatible classes you make them compatible now look at this now look at what I have done I put my 1 1 my own one-liners I did not deal gang go forgot one liners do not attempt data but the Ganga Fork of I suppose I say I say Boone line you don't have to write you can use your own English and put it in a simple word and then whenever you want to communicate communicate in that simple English do not try to voice egg evasive along a factory pattern I see balloon I mean is not needed you cannot be I'll at least both go away so it's not going to help out right so use whatever knowledge you have and English you have and try to make it simple okay let me know what timing it is a how much time you have you have okay this is very interesting solo I'll take template patterns first now I want I want the audience to talk huh but the my voltage or with a chrome even right click that template pattern now tell me what you understand from template pattern what do you understand from this and if if anyone tells me what is this mobile a check tonight Google overlay checker maybe then you will get a USB shallow if anyone tells me what this means a movable liar incompatible month up data type Isis of Nia like so so much you know if you answer this what is this it's a simple thing when I show the code you will understand it if you answer that you will get a USB and what is the second price cons are my iPhone what did I yeah okay fine whatever it is yeah - to me yeah yeah come on anyone may I be happening due to forgive me the people who are subscribed to correspond they cannot answer it now because like I have a learning tutorial I know my sick about oh yes and yes you are right you define a skeleton in the abstract class and what is about those operations and it is not inheritance some people thought so abstract class was node I see light design pretend cannot be like abstract classes the interfaces right it has to be a culmination of something so it is not objective you have to use objective programming yes anyone guys please are like you should go and you should at least like one design pattern in a day at least look at it right it will change the way you are programming 100% will change right anyone let us be my lil icky tiger okay so here it is well you know I don't know maybe puss net hike in a must be do I have the net chap now this is smooth no way in or restart okay fine I'm connected so here it is define the skeleton of an okay let me you know one of the things what happens is so you know in in architecture world like in project management or when I see those worlds right that definitions are fixed you cannot say agile is like this agile okay it can't have the variations but in architecture world what happens is the way if somebody will say it's a middle layer somebody will say it's a business layer and somebody will say it's a business object and somebody will say you know something so depending on the English lot of thing changes right so what I do is that sometimes we found to validate myself if I were to say that okay this definition am I thinking right or not I do a Google and I just searched that three or four answers at least they come together okay so here it is must be that once I show this so if anybody can tell me what is template pattern more so whatever URL comes first template pattern so the V key Curt a wiki a chair at suppose that we were here so nothing different anyone know okay so now what happens now here is example of template pattern I cannot wire Queeny no one so here it is now in template pattern as as you can see here it says let's go one by one so it says that define a skeleton of an algorithm and defer some steps to the client subclasses now think about it let us say you want to write some kind of a class like this which does ETL okay ETL you have you first do extraction then you do transformation and then you do loading right this sequence never changes this algorithm when you say algorithm does not mean matza so this is algorithm here which first extraction loads transformation loads and the loading loads right so what you do over here is you go and you define here so here it is I will say here so this is definitely an abstract class so so if you look at the definition here it says define the skeleton of an algorithm yes so there it is okay so here I will say this is an ETL where I will say that this is first extract how much me I can make it abstract okay so this is an extract method okay this is in what is that transform method right and this is an load method now what I'll do is I'll define one method this method nobody can override it I'll say this is execute and in this I will say like first the extraction loads then the transformation loads then the loading happens now so that is the first thing so now here what I have done is I have defined that this sequence nobody can change this algorithm nobody can change it is always like this for example people who have done dotnet your page life cycle your page life cycle like in it load event yes you can go and modify that load event if you want okay like people who are doing those HTTP handlers like when you go through the handlers right the sequence is fixed you cannot change the sequence okay so here you can see now this sequence is same but then I mean I will tell to my child classes I will say that okay my child class is a public class I will say let us say excel to word okay so in this what I will do is I only have the opportunity to override or I'll say implement so I will say your implement so now you can see here that's what the second thing is deferring some steps to the client subclasses can you see that so what happened I have a sequence defined in my abstract class whose sequence is fixed extraction transformation loading but the individual steps that how the extraction can be and how the transformation can be can be defined by the the child classes did we get guys see now this is now look at this the first time when you read it right you do not understand if you think it was - both - PG right but once you understand you look at the code you you understand oh this is what it is but now the biggest challenge is that when you see this problem next time in your sore in your application right it should click if it does not click you know the pattern you know there is a problem but that sixth sense should say no this should fit here naturally that is very difficult part that is what makes a personal experience developer I'll be getting is like I taught you iterator pattern okay so now it should click at the right time if it does not click then it's useless okay any questions here on this ma'am let me know the timing sir it's 15 minutes okay check it a lot because I want that even if I cover three four patterns I wanted to go go through it properly rather than covering extra more patterns let me see the other one which I have what I'll do is I will skip factory pattern I will skip factory pattern okay and people who want to know about factory pattern you email me I will tell you in detail okay because in that 15 minutes I can take one pattern and then we can go with a discussion or something right but here the interesting pattern bridge pattern what can you understand from that line again I will give you a USB I have not iPhone USB what this is bridge pattern anyone I requited to us Billy Joe what do you understand from that Google will a decagon opj correctness of look we will catch you in Indiana we have bulk of program versa college college giveth like one like the students who's a 50,000 programmer but then the quality of programming is going down day by day you know like we are just getting into manpower supplement I don't know how do i name that I think it's high time that we improve our quality like see what happens when you talk with some other person who's in us right they understand all this they know all this they they know this is a iterator pattern one is that English helps them right but another is like you know when they look at us right i cigar now but some look after now pro-style segregated ethos and then they say like quality is down and all that right yes anyone seniors kwibi junior level actual up Lonnie senior look at okay so here it is what do you mean by abstraction in implementation of a bit of both easier what is abstraction in object-oriented programming you seen each I'm a Chinese actor on this kind of Farooq right what is the abstraction yes no that is abstract classes declaring the function and that is abstract class abstract class or abstraction different a pop I would I can't go to the level is abstraction sob looking through with a 100% yes I can got it yeah yes other behavior go Heidegger that okay encapsulation is out there if you say like abstraction if you say hiding behavior that is encapsulation they got give my girl burger gaze of the winner yes abstraction complexity after indium in a car garage our or some examples of them lay like a car sell RPG encapsulate pathani engine career that is I understand that know if we don't care about the definition so okay thinking so what so abstraction means you know show only what is necessary so if you think that like you said right actually they complement each other okay Frankie so must be I can give you us before that okay so abstraction means you know show only what is necessary okay so for example if I say okay I have this class show only what is necessary okay now I think about this situation here and you'll come to know this is the last pattern I'm taking then I will go for discussion right I will not take factory pattern with the time limit so here it is bridge pattern now think about it you have an employee class okay in this you have some calculate salary method okay and then somebody says oh we have a manager now and that manager calculation is different so what you will do you will inherit from this class you will go and write some logic here he is causality I say calculate okay right so you end up writing like this you will go and you will say here now look at these are your mind your mind is thinking something and there is something actually wrong public class I'll say okay this is a general manager of the company or must be an HR HR will be sub collect employee and I'll say yeah okay let's let's make this virtual and I'll say okay overwrite this with calculate salary and I'll say okay or something you know I'll have a logic here this cannot be avoided it has to be a decimal okay and here I'll say okay return you know some calculation here return 8,000 or 80,000 salary whatever you know some some logic will be there right now think about it you you get something like let's say more general manager so what you will do you will again inherit you will do like this right is this going right is that something that is missing here see now look at it you know when does a person go from a manager to a general manager or you know to anything else right because of the role not because of the salary okay salary calculation is independent of the rule right abstraction encapsulation this mistake everyone makes huh everyone makes or Bob Miller's kamalu board are either change could either be a sub change or a right so here what is happening is you will add a new class when you get a new rule so that means you know that the salary calculation should be different there should be a different class called as salary and there should be different class called as hierarchy for managers for this right and the salary should be used inside that manager so here what is happening is you are thinking that the that you know that the the the hierarchy and the salary calculation are going together are we kidding guys this very important statement you know here what it should happen is you should actually say here okay here it is you should actually say here that I will only create a new class here when there is a new rule not when there is a new salary calculation so actually you should do this you should actually have a salary class here and then this salary class will have the calculation and he should be used inside that manager and this means the you were thinking that the abstraction for that manager etc is same like the salary no there are two abstractions salary and this normally I've seen like tax calculation suppose we mix all other tax calculation and that entity they all get mixed so must be this should be two different so that when he changes he will not change and when his role changes the salary does not change getting s okay so you now look at this now this design pattern it is not about coding it is about your thought that you make and even you mix this kind of mistake right it does not come you don't come to know at the project startup manager resent will be the optimum maintenance measure pay then somebody says Adam use salary bus is adding a new hierarchy so these kind of things you can only come to know when you go in maintenance and you have a issue right so that's why you know like when you do object-oriented programming that's what the object of programming says right this object is different this object is different you have to create the classes appropriately okay so this is more of a thought process so very quickly I guys we have three four patterns we have talked about you know now I want from everyone happy may USB USB sir HIV aku has been a Malaika be my a question is suppose us be doing right so what is an aggregate route a chancer which I have explained right in a line one line or cone column we'll get aggregate root we just covered I could get root yeah but answer it in English yes Nick have a burger I will I will ask the question or Mike I can give you the mic oh yes a chaplain alien I use beer please and I'll definitely give the USB now yeah so I'll just correct that you're right you know giving my USB parent more than parent I'll say root object because parent be can you have a child child parent thing right this is a root object okay good okay it's read better than a boot tsunami okay I'd have to a pattern or a English making demands on it so do class a is not be referred out there no no not like that like all in and not in over yeah like I don't know yes yes a blue shirt entry my fellow actor Peter India implement implement classes here no problem how about your from mind fire yes yeah so in KOCO it not to communicate know that that word communicate is wrong a buzz was I was not bullying very good it wasn't going this so then you have two classes whose interfaces are not same right and you want to make them compatible you put adapter in between and then you make a call right sure so yeah guys so any questions on this IP question is do a price the other question a poison away any questions guys so we have covered I'm leaving factory pattern what I would suggest is you can send me a mail or must be you can send a mail to do we have the mail - inna must be if you can send me a mail I can what I will do is here it is guys just as a future thought process right what is the best way to learn design patterns right so the best way to learn design patterns is by doing a project actually so I will you know like you guys have so you can see here like I will give you this videos video which I have here this videos declare mop it lab one lab to lab 3 right so in this I don't know how much you can see I'll just zoom it you know quickly this videos here at this so one thing which I understood right like so I have been teaching design patterns for 15 years now in the first year I should piece very silly like yeah I saw her Hazara done what I understood is that until you don't work on a project and you don't feel right you never understand design patterns how much ever you try okay so what I did is I created a lab you are saying okay first lab I create a screen I need this pattern then I say okay I do this I now need this pattern more natural process I did not go like Django for there is no point right you take a project and say let the patterns come in naturally right so I will give you this video DVD right you know so what you can do is if you can give me a feedback here about my session again like this one quickly you know before I end the session that I want I want that that thing to know that's that's the Doha but Kabir you know which says that a lot of time you know I've see people I said like both today there is a sutala way like factory pattern year pattern repository pattern you know whatever no it is not important that you read and you just know a lot of thousand patterns and you become architect as a developer even if you implement five patterns properly your your heart will say yes I am architect because you know today I had done this thing properly right so that is the thing you know I'm sure that you know people who are like everybody can read Hindi right so I'm sure that you know that Kabir stoa no you cannot so I'll tell you what what it says buthey puede perder jaga move up under the Bionic away means if you read lot of literature like you know just a burner like some people stand who are seniors why sakalava Thyrza a factory pattern because it will pattern here pattern now there is a junior you know so if you read a lot of literature with lot of jargons I say you can carry out yourself in the office but you don't know design pattern internally you know very well you are showing off right and ii says that biaxial frame caper days so pundit away means what if you implement something okay that's not exactly but I'm just trying to make a technical technical thing of it if you implement that in a project like one or two lines of code you know you would be more happy so do not try to boast yourself as an architect in India I will tell you the level of architects has gone down completely okay out there Archer PM AR which crammed in the name is ray so they become a technical architect now that is forcing yourself so there are very less people who are really architects who know design patterns properly who using the project who know UML properly who know estimation properly right so I think that's what we should target okay so any questions guys so that is the feedback link you know you what you can do is you can give the feedback about my session what I have done here and and if you if you give the feedback just tell me what is your home address of boom - for I will mail you the DVDs that DVD which I have read shown all the patterns you know with the full project is a 3040 video aching video gap by format alga the Attero you know so you any questions guys on this four or five patterns I have covered I have not covered factory patterns because I want to ensure that the other or you know present us also get time any questions yes okay very good question here yes yeah that that's why I put that is that that is not possible right so good question here that basically like how do I come to know that now which pattern to use now I'll tell you that is experience okay so first thing is that you know architecture pattern what to use you know that you will use MVC broader level you'll know MVP or you will know three layer whatever some broad level architecture you know right now you know as my experience what happens is I know that he has to use iterator pattern there because I can I can forecast it because the level of experience I know that he has to use a factory over there because there should be decoupling I know that he has to use adapter pattern there is a third party so some of the patterns you can forecast but then lot of patterns the code level patterns the developer at the night way bite hi Bobby so only he knows now at that more like you say like if you are on the line of fire right the commander can tell you tell good go to here if something is nearby here's to fire himself right so some of the patterns you cannot so I think like you can predict like 60 70 percent you know technical document but like that 20 30 percent is by the developers they have to understand it yes any questions no queries yeah there's a good question sometimes cows that you get a maintenance project to spend all their factory pattern live you debug f11 it goes in one more in where are we like you know yeah so you say that you know like some of the people they now what happens is you know the person who chose that pattern right or chose that architecture has to give a reason for it okay and when the developers are feeling uneasy about it that's why I say if it is not natural develop good bowling a caravan are I like this this is nonsense you know so that that's that's what I'm saying if it is not natural it is a problem okay any questions so thank you very much you can put the feedback out there right and give your home address your phone number I will mail you the DVDs [Applause]
Info
Channel: Tech Bhubaneswar
Views: 95,959
Rating: 4.6278157 out of 5
Keywords: TechBhubaneswar, Mindfire, Six Most Used Design Patterns in Project, Design Patterns, Design Patterns in Project
Id: cNPH6IPh5yk
Channel Id: undefined
Length: 49min 35sec (2975 seconds)
Published: Wed Dec 27 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.