Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples
Play lesson

System Design Full Course - Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples

5.0 (4)
27 learners

What you'll learn

This course includes

  • 34.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

System Design Full Course Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples

Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples Transcript and Lesson Notes

حنji, کرے start so hello koder army welcome back to our LLD playlist today's lecture we are going to read factory design pattern this is one of the most used design pattern when you are giving an LLD interview or you are making a real world application 99% of the time the factory design pattern

Quick Summary

حنji, کرے start so hello koder army welcome back to our LLD playlist today's lecture we are going to read factory design pattern this is one of the most used design pattern when you are giving an LLD interview or you are making a real world application 99% of the time the factory design pattern

Key Takeaways

  • Review the core idea: حنji, کرے start so hello koder army welcome back to our LLD playlist today's lecture we are going to read factory design pattern this is one of the most used design pattern
  • Understand how System Design fits into Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples.
  • Understand how Low Level Design fits into Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples.
  • Understand how High level Design fits into Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples.
  • Understand how System Design for Beginner fits into Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples.

Key Concepts

Full Transcript

حنji, کرے start so hello koder army welcome back to our LLD playlist today's lecture we are going to read factory design pattern this is one of the most used design pattern when you are giving an LLD interview or you are making a real world application 99% of the time the factory design pattern will be applied so like the strategy design pattern this is also very important for your interviews point of view or when you work in real world or for applications for that point of view if you understand it well then let's jump directly on screen and see factory design pattern let's see we are going to see factory design pattern right? so this is how we understand what is real world factory so real world factory where you become an object a product that is in the same way the factory design pattern so the factory is a class where we get objects we get an object created okay? now you think we need an object creation a class right? we need a concept of factory so we need to understand this first so let's talk about in the last video we read strategy design pattern if you have seen my last video or you already know the strategy design pattern then you know what is in it?

we have a client in it and its multiple algorithms and we can use the algorithms interchangeably in client so let's see what we saw from the second time so in the last class we got a robot example we read a parent class robot okay? and we said that we have multiple strategies okay? which we can also call algorithms let's say we can't talk about a single talkable or a robot right? so we have a walkable fly ball we have multiple strategies right?

and we call these strategies algorithms so these are the multiple strategies which we call algorithms we call them dynamically in runtime we pass the robot class through the composition we pass them in the constructor and we can call them in the robot methods for example we call them in the talk method so the robot that was a touchable object touchable let's say T so what does it do? we call them in the talk method T dot talk same walkable and same fly ball we read the strategy design pattern in this whole strategy design pattern we were using this as a tool that this is a talkable functionality walkable or fly ball their object has already created already created we can just call them in the methods so when we passed T here we were sent to T equal to a new talkable like we call it a normal talk a normal talk let's say or we had a score no talk it has already been passed we have to call T dot talk right? so what we did? we did the whole object creation logic was abstracted we said we will not handle it we have already some other handel we have already that object has already created we have to call the method right?

we call it the dependency injection this is our dependencies talkable walkable and we inject it on our dependency so the robot is dependent on these three right? for our functionality then the talk will fly and fly because it will delegate its request so one thing has happened we had already created the object but when you are writing code then you have to declare you actually have to create an object basically create an object and when you want to create an object I want you to use this new keyword to create an object so you will be using it so I am the entire design pattern aim is what we do in our application is the business logic we separate it from it the logic of the object creation right? so you will know every application has a business logic okay? what is business logic?

business logic is the whole of the application is a centric for example if you are making a notification system then how will it go? who will it go? which notification will it go? email notification push notification all this is the business logic okay?

in that case let's say when is the object creating? I want to separate these two and I want this because when we keep them together then the code becomes complex to read to understand right? you want to know you are understanding a code which has a business logic and suddenly there are some objects creating some of the let's say from the way if you want to create a X then you have to create an object but this is the object creation logic it is the same as the separate so for this we will introduce a factory design pattern which is called we will make a separate class which will create the object of which the responsibility of creating the object okay? then what will we say?

we will have a client he will call the client a factory that for this I will give an object and the factory will return the entire object that is, what was the second thing we said? we did not tell the client that how the object is created the client is not necessary to tell and every time you have noticed in the whole of the LLD in the design pattern in the design principle in the oops principle we keep thinking that how to decouple the client from your application or from your application it is different from the history so we are also doing decouple we want to tell the client how the object is created is it logical is it like a computation? we will tell the client that the factory will return the object and the factory will return the object as simple as that okay? this is our aim that we want to decouple and to achieve this aim we have a factory design pattern so we start so look we have a 3-data factory okay?

so what is the first one? so the first one is a simple factory and the second one is a factory method and the third one is an abstract factory method so now what are these 3? we will study it once if you think that the simple factory then the factory method and the abstract factory method are extended versions of this okay? first of all, you can understand this simple factory it is not a design pattern from the start okay?

you can decouple a design principle but you cannot decouple a pattern but the abstract factory method is a proper design pattern we will understand that later let's understand the simple factory okay? so we understand the simple factory through an example so now I have taken an example we take an example of a burger shop where it is multiple-like burger and we can prepare it like that so let's see how the factory will help us okay? so let's suppose we have a class of burger so we have a main class now we have a method which we call a prepare and this is also a virtual method that is, the abstract method okay? we have just declared the demand so if this is an abstract method then I will write an abstract here right?

you will understand it now now because this abstract method then I will have to make concrete methods which will inherit it so I will make some sort of burgers okay? let's see we get three kinds of burgers on the shop okay? one is our basic burger and the other two kinds of burgers which we get is standard burger and the premium burger so these three kinds of burgers are basic burger, standard burger, premium burger which we get here okay? we get three kinds of burgers on the shop so what will happen to the three?

will be our prepare function which will be overriding right? so the three have our prepare function which we get overriding so let's suppose we say that in basic burger it will be simple burger it won't be much better in standard burger we will do something we will do something in premium burger it is very premium burger so these are the create okay? now I am saying that we need a factory this burger is a product which we need to create we need a factory which will create this object in factory design pattern so what should I do? in some client code okay?

our code will be going at some point I will create this burger using a new keyboard that I want a new basic burger or a new standard burger but I don't know which type of burger I want whatever user my customer my shop tell me how to eat a burger I will tell the factory to bring a burger and give the object okay? I will do a factory class okay? so let's make a factory class which I will tell you burger factory okay? so I have made a factory class now in this burger factory there is only one method which we will call create burger okay?

so what is the purpose of this? to create a burger so create a burger and let's say this method is a type and this is the object of this string which we will tell you how to eat a burger so let's say we can give 3 values we can give it in a string basic, standard or premium so we can give 3 values in any type of a create burger so what will we do? we will return this a burger type object right? so now you will know what is the relationship composition that burger factory has a burger so burger factory we will return this burger now we will explain this design what we have just said we have said this is our product burger which is the basic, standard or premium and we have made a burger factory which is a method of create burger we will give it a type it is the basic, standard or premium so let's return this burger so how will we see the code?

so if you think about it we will try to open the code if we see the code then we will try to show you that if the type is equal is the basic okay? so let's return sorry so let's return our basic burger okay? if the type is equal is the standard then let's return the standard burger and so on for premium burger this will be written and this is the complete simple factory if you understood this then the complete design of simple factory is the complete design of simple burger and we will see in the photo-fart code how it is so look, this is the simple factory code which we have seen in our UML we have made a burger class which is a prepare this virtual method and we have made a burger a new basic burger a standard burger and a premium burger okay? three of these prepared methods have an override let's say we prepare it with basic burger with bun and we make some premium and we add some gourmet buns now we have made our own burger factory you see what it does?

it is a burger type object and it has a great create burger what it does? it is a type object it is a string type and it has an if-else statement that if the type is basic then it returns a new basic burger if the type is standard then it returns a premium burger and if we add a new basic burger and it has an if-else statement then it will return a extra type and it will say it is a burger okay? now we have a type of how to use a burger okay? now it can be a standard it can be a basic we have made a standard here then we will make a burger an object a new burger factory and now we will make a burger object when we call it create burger in my burger factory by giving the type then we will give a standard so we will give it a standard and it will be standard so we will give it a standard what will we return a standard burger so when we call it a standard burger then when we call it a premium burger then this one will be a premium burger right?

so if we run it once then see this a preparing standard burger with one patty cheese and lettuce okay? so this is it okay? so this is the whole code of the code now we will go back to the screen okay? I hope you understand what is the simple factory if we make it a standard UML diagram then you can make it like a wood diagram that let's suppose we have a product in this case we have a burger okay?

a product and this is because it is an abstract class okay? this is the product interface or an abstract class so this product has multiple concrete products okay? so we have a lot of concrete products okay? because it is very much like this so in this case we have multiple concrete products one is the basic burger standard burger premium burger okay?

so we have a factory which is the work of this product okay? so this is our factory and we have a product so the factory has a product and we return what we do? we return some type of concrete product so this is standard UML diagram simple factory definition simple factory definition is very simple simple factory definition is just a factory class that decides which concrete class to instantiate so this was the case we have a factory class which was which was which concrete class should be depending on the type so we give basic standard premium type so this is our concrete class okay? so this is simple factory now if we extend this then we have a factory method now this is the type and why now we will understand let's see factory method so we have a simple factory which was used to extend this example so we had said that we have a burger so if we draw a hierarchy then this is our entire hierarchy we have a burger class and we have a different basic standard premium and we have a prepared method so we had said that what we had we made this made a factory and we said this factory is responsible for making a burger but I am saying we have concrete class these are concrete classes and both are made or it can be a basic premium or a standard but we have a concrete factory and this is the burger so you think that the factory is also made and is a multi-tipal-concreate class i.e.

making a different factory and we think that the simple factory is made and we know that this is the burger and we have two different different things are made and the basic standard premium is the second thing is made in healthy options so there are three different basic and premium and premium so what do we want to say now we have a factory i.e. burger factory this is an abstract class and a method which is created and now i will declare and i will write the other classes as we have a single burger and the other method and the other method is a single single burger and the other method is a single burger and the other method is a normal basic standard premium but the other method is a basic standard premium and the other method is a basic standard premium and the other method is a single burger and the king burger is a single burger and the other method is a normal basic standard premium and the other method is a single burger and the other method is a account and the theres two ох framework the whole franchise meaning you know the name لیکن یہ ہماراک کلاïnt ہے اب کلاïnt کیا کریں گa وہ جب بیگ برگر فیکٹریک کا عبجیکٹ بنائے گa تو وہ کچھ اس طرح بنائے گa تو جب بیگ کلاïnt ایک برگر فیکٹریک کا عبجیکٹ بنائے گa تو وہ اس طرح بنائے گa برگر فیکٹریکٹریکڈو نیو اب یہاں پے پاس کرتا ہے سے کون سی فیکٹریچ چایا ہے Singh برگر والی فیکٹری یا King برگر والی فیکٹری اب دیپینڈنگ اپون کی وہ ہمیں گa اب پے اگر Singh پاس کرتا ہے تو Singh برگر والی فیکٹری میں بھی کریٹ برگر کا میتھا ہے اور جبھی کریٹ برگر کا میتھا کال ہوگا یہ اپنے ساب سے یہ والا یہ والا یہ والا یہ والا برگر منا گa اگر یہ King پاس کرتا تو یہ والا یہ والا یہ والا یہ والا برگر منا تھا تو احوپ آپ کو سمجھایا گa کہ ہم نے بس یہاں پے کیا کیا جسی اپسٹریکشن کی لیر ہمارے پاس پروڑٹ سائڈ پیٹی اسی طرح کی اپسٹیکشن کی لیر ہم نے اپنے فیکٹری سائڈ پیٹی اور یہ ہو گیا ہمارے فیکٹری میتھا ہے اس کو فتح فٹ کوڑ میں دیکھتے ہیں تو دیکھیں یہ پروڑٹ براکھا براکھا جو بھی ہم نے بات کی سب سے پہلے ہم نے کیا بنا اپنے کلاس برگر کلاس بنا لی جو ہم نے پہلے بھی دیکھا تو ہم نے چھے طرح کیا لگلک برگرز بنا لیے ایک تو بیسک برگر سٹندڈ برگر پریمیم برگر اور بیسی بیسی کویٹ برگر سٹندڈ بیٹ برگر اور پریمیم بیٹ برگر سب کے پاس اپنا پریپیر میں تھڈے فیر اپنی برگر فیکٹری بنالی جس کے پاس اگی میں تھڈے کریٹ برگر اور یہ بپسٹیکت میتھڈ ہو گیا اپسٹیک کلاس ہو گیا جس کے پاس ایک ورچول میں تھڑے اب اس کو اووڑٹ کرنے گلیا نے دو طرح کی فیکٹری بنالے تو دعونا نظری برگر اپنی برگر اور ایک اپنی برگر اب یہ جو سنگ برگر اور كیکن برگر دونوں نے قریٹ برگر کو اووڑٹ کی اپنے پر تلی کیسے دونوں نے ٹائپ لیا اور ٹائپ ہو سکتے یا تو بیسیک ہو گا یہ سٹندڈ ہو گا یہ پریمیم ہو گا تو سنگ برگر جو کی نورمال برگر بنالے ویڈ برگر نہیں بنالے تو کہ بیسیک ہے تو وہ ریٹن کر دے گا نیو بیسیک برگر سٹندڈ ہے تو نیو سٹندڈ برگر اور پریمیم ہے تو نیو بریمیم برگر ویسیک جو کیگر برگر ہے وہ صرف ویڈ برگرز بناتے تو اسمیا گر بیسیک ہو تو بیسیک ویڈ برگر ریٹن کر گا ایسی سٹندڈ کے لیسیک اور پریمیم کے لیسیک پریمیم کی لیسیک تو اس طرح اسے ساری میتر سٹل رہے ہیں اب کلائنٹ سائٹ میں دیکھو کسی دیسیک کر دیکھا کہ ہم نے سب سے پہلے ٹیپ لییا بیسیک پھر ہم نے کی فیکٹری بنائیں اپنی اور فیکٹری بنائیں سبار نیو کنگ برگر ٹیپ یعنی کی ہمیں ویڈ بیسٹ برگر ملے گا اب اس فیکٹری پہ ہم نے قریب کر میتر کال کر دیا یہ ٹیپ دیکھیں بیسی ٹیپ دیکھیں تو میں بیسیک ویڈ بیسٹ برگر ملے گا اور اس کو برگر ریپنے سمیسےک کر لیا اب جب ہم اس برگر میں پریپیر میتر کال کر دیں گے تو ہمارا کنسہ برگر ٹیپ اگه ہمارا ٹیپ برگر ٹیپ اگه جو بیسیک ہوگا بیسیک ویڈ برگر تو اگه رہا ہم اس کو رنگر ایک بر تو یہ دیکھو پریپیریں بیسیک ویڈ برگر ویڈ برگر بند پیٹی اور اگه اب اگهر ہم اس کینگ برگر کی جگا سینگ برگر لگا دیتے تو ہمارا ٹیپریپریپرگر بیسیک برگر بیسیک برگر بند پیٹینگ کیچھا اگه اس بر بیٹ برگر نہیں بنا اگه اگه ببکو اس سمجھا جا ہوگا چلو باپس اس کچھ ایک بر ایوامل دیکھتے تو اب آپ اس پورے کے پورے ایوامل دیگرام کو زاادہ بیٹر تاری کے سمچھ پائیں گے ہم نے کور میں ایساب دیکھا ہے اب ایک بر دیکھتے ہے اس کا سکسٹندد ایوامل دیگرام کیسے بناتے ہیں تو سکسٹندد ایوامل میں ہم بلک initiation اسی ایوامل میں تھوڑاثا چینگ کریں گے ہے تو ہم نے جو یئے بایا ایوامل دیگرام بنایا تھا یہ بایا اس میں بس توڑاثا چینگу نے والے اور اس چینگ کو دیکھتے ہیں کیا ہے سپسے پہلے ہم وہی کپی کرلے جو بنے ابھی بنایا تھا تو دیکھو یہ وہی ایوامل دیگرامے کپی کیاں اپڑ سے اب ہم نے کہتا اس میں میں تھوڑا سا چینچ کرنے کہ ایک product کے پاس ملٹیپل تراکے کنگریٹ products ہو سکتے ہیں Right. اس کے اس میں ہم نے Veet Burgers اور Normal Burgers کی اگیم پلیا تھا Veet Burgers میں بھی بہت ساری برایٹی اس دی بیسک stand out premium اور same Normal Burgers میں بہت ساری برایٹی دی تو اگر ہم اس کو القلہ کریں تو یہ کچھ ایسا دیکھے گا تو دیکھو میں نے کیا کیا میں نے کنگریٹ product A key list بنالی اپماان سکتے ہو یہ ہے Normal Burgers کے list اور یہ ہے Veet Burgers کے list تو یہ Normal Burgers میں stand out basic burger یہ stand out burger یہ ہے Basic wheat burger stand out wheat اور premium wheat تو یہ القلہ product کے list بنالی اب ویسے ہم نے کیا کرنا تھا یہ جو فیکٹری ہے اس کے پاس سیدہ ہیزا ریلیشن شپ نہیں ہوگا بل کی اب یہ جو فیکٹری ہے خودے اپسٹریک بن جائے گی تو اس کو ہم اپسٹر کر لیتے ہیں تو فیکٹری ابھی خود اپسٹریک بن جائے گی اور اس کے پاس بھی اپنی конкретشن سوں گی تو اس کو drop ڈے ہیں تو یہ ہم our past concrete factory ڈے ہو گی اور ہم نے کیا تھا کی concrete factory بھی بہترہ کی ہو سکتی ہیں تو ہم multiple concrete factories ڈے لہی چکے ابھی کلہ ہم لٹھ سے دو ہی بن آتے ہیں و ہم کہتے ہیں ایک concrete factory کسی ایک طرح کے products کو بنائے گی اور دوسری concrete factory کسی دوسری طرح کے products کو بنائے گی اب دوسری طرح کے products تو decide which class to instantiate. یہی تو ہوا رہاں یہاں پہیں.

یہاں پہیں جو سبقلاصیدے یہی decide کرتے ہیں کہ ان کو کون سیقلاصیس کو instantiate کرنا ہے. کون سی a product بن آتے ہیں. بنانے یہ فیکٹری کی سبقلاص decide کرتے ہیں. تو یہی ہے پورا کبھورa فیکٹری métھڑ.

اب abstract فیکٹری سمجھنا اور easy ہو گیا. کیونکی effectery métھڑ کو تھوڑا ساہ رکستین کر دو وہ بن جاتا ہے. abstract factory method. تو دیکھتے ہیں.

چلو اب abstract factory method samosa. دیکھتے ہیں. اپسٹرین مجھایا او اس میں کیا آرادہ دو طرح کی فرنچائی دی تھی King Burger اور Sing Burger. اور دونوں القائل اترکے برگرز بن آتے تھے.

King Burger ویٹ برگر بن آتے تھا اور Sing Burger Normal Burger بن آتے تھا. اب کیا ہوں آپ کو کہوں کی یہ جو فرنچائیزی ہے na King Burger اور Sing Burger. ابھی تا کیے صرف ایکی product بن آرے تھے جو کی تھا Burger. But let's suppose وہ ایک سے زیادہ product بن آئی تو مدلب King Burger صرف برگر نہ بن آکے گارلیک بریٹ بھی بن آئی اور Same Sing Burger صرف برگر نہ بن آکے گارلیک بریٹ بھی بن آئی تو اسی کو ہم کہے دیں گے اپسٹیک فیکٹری میں تھا بیسی کلی وہ فیکٹریز جو ایک سے زیادہ product کو بن آنے کے لیرسپونسیبل ہوتی ہے اسی کو اپسٹیک فیکٹری میں تھا کہتے ہیں.

بس اتنی سی آئی یہ اب ہمیں بس اپنے کوڑ میں تھوڑا سا چینچ کرنا جو میں Sing Burger or King Burger میں صرف برگر بن آئی اُس کی جگا اب ہم گارلیک بریٹ بھی بن آئی یعنی کی ایک ایک فیکٹری دو طرحا کی product بن آئی تو چلو اپنے ایک برسٹینڈ ایمل بن آتے ہیں اس کو اور فیرس کو دیسکس کرتے ہیں تو دیکھے یہ بنے گا پورا پر اپر ایمل دائگرام دیکھنے میں بہت компریگیڈ لگرے پر وہی سبہ جو بھی تک ہمیں دیسکس کیا کہ ہمیں پاس ایک Burger کی حرار کیا جو Basic Burger اور اس کے پیچے ہے Standard Burger or Premium Burger ایک میں بن آ دیا اور اعلق طرحا کی or Burger میں آتی ایمل ویڈ Burger تو Basic ویڈ Burger Standard ویڈ Burger or Premium ویڈ Burger ایک اور حنیا product آگیا ہمیں پاس گارلیک بریٹ یہ بھی same دو طریقے کے ہو سکتے ہیں Basic Gardleek Bread Premium Gardleek Bread Standard Gardleek Bread اور بسی V2 Let's say Basic V2 Standard V2 or Premium V2 ہم اور بھی کو ایک Classification لیتاکتا Depending upon جو بھی آپ کو پتا ناتی ہے Right اب ہمارے پاس same طرح کی دو Factor T Singh Burger or King Burger Tsk اب یہ Factor Tsk صرف Burger بنانے کے رسپنسیبل نہیں ہے یہ ایک اور product جو کیا Gardleek Bread وہ بھی بنانے کے رسپنسیبل ہے تو میں یہ کہتا یہ جو Singh Burger ہے اس کے بس دو مثہ دوں کے Crate Burger Crate Gardleek Bread same اس کے پاس بھی اور Factor یہی دو مثہ دیتی ہوگی Right اب Singh ke Pasna جو Burger کا Object Rate ہوتا ہوں وہ ان سب میں سے بنتا ہوں کیوں کہ وہ V2 نہیں بنانا تھا Same جو اس کے پاس Gardleek Bread کا Object Rate ہوتا ہوں وہ ان سب میں سے بنتا ہوں کیوں کہ وہ اگر این Gardleek Bread بھیٹ میں نہیں بنانے گا اور اگر این جو King Burger وہ Burger بھی بنانے گا V2 اور Gardleek Bread بھیٹ میں یہ پورا کا بورا UML Diagram بنا گا ہمارے اس Example کے لئے اب ایک بر its کا ایک Proper Code دیکھلے دیکھیں آپ کو ساری چیے سیسے سمجھا جائے گی تو دیکھیں یہ پورا کا پورا کا بورا جو پھر ایک جو پھر دکھا اس کیا سپ سے پہلے ہم نے پہلا پرٹکھ بنہا ہے Burger تو Same ہے Burger اس کے پاس بیسک برگھر STANDARD ہے PREMIUM Burger بیسک بیٹ STANDARD بیٹ PREMIUM بیٹ اب ام نے نیا پرٹک نیا Gardleek Bread اس کے پاس بھی PREMIUM میں تھا ہے جو کی ورچوال ہے اس کے پاس دو ہے بیسک Gardleek Bread چیس Gardleek Bread اور دو اور ہے بیسک Viet Gardleek Bread اور چیس Viet Gardleek Bread دیکھیں اب ام نے ایک فیکٹری بنا لی اس کا نام اس برہم نے دیا MEAL FACTER کیا اسے برگا نہیں دو نو چیزے بنا لیے ٹیگے اس کے پاس اب دو میتا دوں گے CREATE BARGAR اور CREATE GARDLEek Bread CREATE BARGAR Birgur Birgur Tyco Object اور CREATE GARDLEek Bread ہمیں Gardleek Bread Tyco Object اپسینگ Birgur اور King Birgur دو فرنچائی دی ہمیں پاس اب دو فرنچائی دی کے باس دو دو میتا دو ووریٹ کرنے کے لئے ایک ہے CREATE BARGAR اور ایک ہے CREATE GARDLEek Bread اب یہ دو نو کیسے کرتے ہیں same ڈریگے سے Depend کرتے ہیں اپسینگ بیسیک STANDARDی اپریمیم اسے آپ سے وہ BASIC BARGAR Shandabagara PREMIUM BARGAR دیتے اور یہاں پیتا ہے BASIC کیا چیز اسے آپ سے وہ BASIC GARDLEek Bread چیز GARDLEek Bread ویسے ہی King Birgur بھی ہی کام کرتے وہ پہلے تو CREATE BARGAR call کرتے Depending اپن کی دیکھو ہم نے BARGAR ٹائپ کو رکھا بیسک GARDLEek Bread کو رکھا چیز ٹیکیاں ہم نے اس بر MEAL FACTRY برگر کی ٹیکیاں کی ہمیں VEET BASIC BARGAR اور VEET BASIC GARDLEek Bread چیز چیز چیز کوئی بھی GARDLEek Bread یا کوئی بھی BARGAR ٹیکیاں اب ہم کیا کرتے ہیں اس MEAL FACTRY پہ دو ماذا call کرتے ہیں تو CREATE BARGAR اور ایک CREATE GARDLEek Bread CREATE BARGAR میں BARGAR ٹائپ بیسک دیگتے ہیں اور GARDLEek Bread میں ہم GARDLEek Bread ٹائپ چیز ٹائپ اور جو بھی آتا ہے اس کو BARGAR اور GARDLEek Bread کی عبجیک میں سٹور کر کے اس کا prepare میں ذہت call کرتے ہیں اب اگر ہم اس کو ایک برنگرے تو یہ دیکھو prepareing basic wheat burger with bun patty and ketchup prepareing cheese wheat GARDLEek Bread with extra cheese دو نو wheat wale print ہم نے King Burger کی شرنچائی چوز کی تھی ٹائپ بہت سمجھا آیا گا فتح فٹس کا بھی ایک stand-in-d-umel diagram دیکھلے تھی تو یہ میں stand-in-d-umel diagram میں نے بہت کشش کیا کہ میں اس کو جتنا نی ٹرکسا کو رکھوں but I hope آپ کو سمجھا آیا گا تو ہمارے پس ایک product ایک ایک ایک CREATE GARDLE اور ایک Product B کی CREATE GARDLE اب ایک بہت سیک فیکٹری ہوتی ہے اس سے آپ کو زادہ بیٹر سمجھا آیا گا کہ ہم نے جو ایک زمپلیا تھا وہ اس سے کس اصویت کرتے ہیں Right اب اس کی فائنلے ایک بردیفینیشن دیکھلے تھے تو یہ افیشل دیفینیشن اپسٹیک فیکٹری متھڈ کی کی TROVIDE سن INTERFACE فر CREATE GARDLE فاملیز افریلیٹی روپجیکٹ Without specifying their concrete classes کیا مطلب فاملیز افریلیٹی یہ جو SING BARGAR تھا وہ BARGAR اور GARDLEGBIT دونوں میں نہ سکتا تھا اور BARGAR میں بھی وہ DIFFERENT طرح کے BARGAR میں نہ سکتا تھا BASIC BARGAR SHANDER BARGAR PREMIUM BARGAR Right تو یہی وہ DEFINITION کہتی ہے Right اب that's it all about Factor Design Pattern چاہلو اب دیکھتے ایسی کونسی PRACTICAL APPLEGATION ہے جس میں Factor Design Pattern بہتچھے سے use جس میں کسی بھی user کو Notification BASIC اب یہ Capsicure Class تم Alla GALA TARAQ Notification BASIC TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TAN TANётся唯 הכ k Wie V Bakag N V V تو یہیک реLifeExample ہو sq.a. Is Factor Design Pattern پر اگر آپ ایک پر دیان سے سوچو آپ کو نہیں لکتا Is Design Pattern کو تو ہم Stratagy C بھی بناؤ sq.a. جو بھی لیسٹ ویڈیوں میں پڑا تھا اس میں ہم کیا کرتے تھے اگر ہم Is Factor کو نہ اماجن کرتے ہم مانتے یہ جو SMS Push اور Email Notification یہ Different Strategies تو Email SMS Notification Strategy Push Notification اور Email Strategy اور ہم Notification System میں اس کو Composition یا Dependency Injection کیا کرتے ہیں Compose کرالے تھا اور اس کو یہاں رکھلے تھا تو کہنے کا مثل یہ کیا کرتے ہیں Notification System بناؤ اور یہ اگر اگر اگر اگر Strategy بناؤ SMS Strategy اور Email Strategy تو یہاں میں کیا کرتے ہیں اس کو Compose کرالے ہیں کیا کرتے ہیں کیا ہوا یہاں ہم ہمارے پاس ایک SMS Strategy ہوتی ہو ہوتی ہوگی اور ویسے ایک email Strategy ہے نا اور تبھیا ماری نوڑیش جل جائے گی اور same مگر امیل کی Object Let's say email کو email.send Notification call کرتے ہیں تو email کی Notification چل جائے گی Right email نوڑیش جل جائے گی پر ہم نے ہم نے آپے Strategy Using a کر کے Q Factor Design Pattern use کیا اور Q Do Design Pattern use ہوا پارے ہیں دیکھا کیا ہوتے ہیں Real Wild Application میں آپ کو ایک Problem کو Solve کرنے کے Multiple design Patterns اور ہر design Pattern Intent آپ کو ایک Particular scenario Co-on-Thur Design Patterns آپ کو Notification Co-on-Thur Design Patterns Clareify Factory Strategy یہ بات Multiple design Patterns use ایک Problem کو خودگا قبل Subjective Opinion یہ باتцию là Open Scold قبل shelf ی Pro לא T T T T T Timothy T L Omar T T T T T T T Tarts 3ív-cav dh

Lesson FAQs

What is Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples about?

حنji, کرے start so hello koder army welcome back to our LLD playlist today's lecture we are going to read factory design pattern this is one of the most used design pattern when you are giving an LLD interview or you are making a real

What key concepts are covered in this lesson?

The lesson covers System Design, Low Level Design, High level Design, System Design for Beginner, System Design for advance level.

What should I learn before Factory Design Pattern | Simple, Factory Method & Abstract Factory with Real-Life Examples?

Review the previous lessons in System Design Full Course, then use the transcript and key concepts on this page to fill any gaps.

How can I practice after this lesson?

Practice by applying the main concepts: System Design, Low Level Design, High level Design, System Design for Beginner.

Does this lesson include a transcript?

Yes. The full transcript is visible on this page in indexable HTML sections.

Is this lesson free?

Yes. CourseHive lessons and courses are available to learn online for free.

Continue Learning

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Lessons

Related Courses

FAQs

Course Hive
Download CourseHive and keep learning anywhere
Get App