No video

5. Factory Pattern Vs Abstract Factory Pattern Explanation, Low Level System Design interview

  Рет қаралды 80,135

Concept && Coding - by Shrayansh

Concept && Coding - by Shrayansh

2 жыл бұрын

Hi, in this video we have covered #factoryPattern and #abstractFactoryPattern design patter out of many design pattern which is asked in Low level system design interview.
➡️ Become a Member: / @conceptandcoding

Пікірлер: 154
@umangmalhotra1222
@umangmalhotra1222 Жыл бұрын
I am following your videos in LLD and HLD religiously. For not only any interview preparation, but to become a good engineer. Upade - finished this today.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Glad to know that buddy 👍
@kaustavgalacticos
@kaustavgalacticos 8 ай бұрын
And regarding abstract factory, although, you haven't coded it here, I just thought it is worth mentioning for the wider audience on the real use-case of that pattern. The example you showed is not the ideal use-case of the abstract factory. Luxury or ordinary, a car is still a car, so it should still be a factory. But, the most appropriate pattern for it is decorator, which prevents class explosion of different types of cars. Now coming to the real use-case of abstract factory. It has a very niche use-case, like some other behavioural patterns (e.g. flyweight). That use-case is creation of products in factory in a package. Imagine a racing game with different backgrounds, different landscapes, etc. you still need to create different unrelated objects, in same quantity, but with minor changes in the characteristics. That's where you use the abstract factory. For instance, one abstract factory will produce all the objects required in the game if it is played in rainy mountainous terrain, another abstract factory will create the same objects but in sunny desert terrain. The point is, when you create an object of sunny desert terrain, all the other objects of the game have to be created in sunny desert terrain, not rainy mountainous terrain. that's where the abstract factory really comes to the fore. so it is a bundled creation of objects based on criteria that drives whether you should use abstract factory or not.
@HA-ky5vd
@HA-ky5vd 7 ай бұрын
jyada gyat mat do
@ankitgoyal8556
@ankitgoyal8556 5 ай бұрын
Thanks dude.
@ritikchhillar4963
@ritikchhillar4963 4 ай бұрын
good example
@srinivasa6981
@srinivasa6981 Жыл бұрын
These patterns were in my To-Do List since long. May be more than 2 years. But finally I was able to understand and completed the tasks successfully within two days. I really enjoyed the video. Looking forward for more videos like this. Thank you for your great efforts.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thanks a lot. Kindly check the playlist, you will find many content like this :)
@anant1995rawat1995
@anant1995rawat1995 Жыл бұрын
Studied the design pattern for the first time, but after studying it from your channel it felt like I have known these concepts for a long time. Amazing work bro...
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thanks 👍
@SrijoniChakraborty
@SrijoniChakraborty Ай бұрын
Hi shreyans, I used to watch your LLD and HLD designs. I built my knowledge completely relying on those. I got an offer from microsoft as SDE(L60) Thanks for explaining so well.
@ConceptandCoding
@ConceptandCoding Ай бұрын
congratulations
@AtharvaRao0104
@AtharvaRao0104 Жыл бұрын
what you have described is a "SimpleFactory" . The creational pattern "factory method" pattern. Most get confused between the 2. in factory method pattern, In your super class you describe the work to be done using an abstraction. (coding to an interface) But someone has to create the real object. This creation is delegated to the sub class. The advantage is conformance to OCP. You create a new class which just creates the derived object which implements the abstraction.
@Mohit_Gupta24
@Mohit_Gupta24 3 ай бұрын
The first pattern is not Factory pattern. It is Simple Factory, which is more of a good programming practice. Also, In the class diagram, Shape "has a" Shape Factory to delegate responsibility of object creation to factory, but it is missing in the code implementation part. Also, please include Factory Method pattern.
@trilochan6475
@trilochan6475 9 ай бұрын
Appreciate your explanation.. thank you very much. Very helpful for redesigning the existing module too.
@ConceptandCoding
@ConceptandCoding 9 ай бұрын
Thanks
@SugamMaheshwari
@SugamMaheshwari 3 ай бұрын
Great explanation of factory and abstract factory design pattern!
@rahulsharma15
@rahulsharma15 2 жыл бұрын
Easy to grab explanation 🙂 Please build the full playlist of design patterns. You are doing a great work Thanks buddy
@ConceptandCoding
@ConceptandCoding 2 жыл бұрын
thanks Rahul, pls do check my LLD playlist, i have covered many design pattern in it.
@shaileshgande3875
@shaileshgande3875 7 ай бұрын
One small correction: ShapeFactory interface doesn't have a "has-a" relationship with Shape interface. It doesn't hold a Shape object, instead, one of it's method creates and returns a shape object to the client based on some logic. Please correct me if I'm missing anything.
@rohan8758
@rohan8758 5 ай бұрын
right shailesh, I am also reasoning the same.
@subhajitkarmakar22
@subhajitkarmakar22 2 ай бұрын
Nice video. Also please keep on adding more live coding examples along with concepts.
@ayushpanigrahi2041
@ayushpanigrahi2041 2 жыл бұрын
the explanation with the code is just on point please keep making such videos 😀
@ConceptandCoding
@ConceptandCoding 2 жыл бұрын
thank you
@sachindwivedi546
@sachindwivedi546 11 ай бұрын
Great video, because no one can explain in hindi in a simple way because in english there are tons of videos, but kuch samaj nahi aata unka and many indian FAANG are just making videos in english. pta nahi kya promote kr rahe hai. but acha hai LEARNING VIDEO should always be in hindi tabhi samajh aata hai bhale hi problem kitni bdi kyu na ho.
@user-zk2fn8xv6x
@user-zk2fn8xv6x 29 күн бұрын
Hi shreyans, I am following your playlist for LLD and HLD its really great content, can you please provide the code repo for all the design patterns it would be really helpful
@VanguardHere
@VanguardHere Жыл бұрын
Amazing sir, Very crisp info in such a short time
@ConceptandCoding
@ConceptandCoding Жыл бұрын
thank you
@tanishajindal5660
@tanishajindal5660 Жыл бұрын
Great work. Best resource for covering all hld and lld topics in a structured way.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thanks
@sravanakirtana2787
@sravanakirtana2787 4 ай бұрын
Superb explanation not taking unnecessary extra time. Awesome thank you Sir
@ayushijain2911
@ayushijain2911 2 жыл бұрын
Hello Shrayansh, Thanks for quality content. I am learning from your tutorials and also found this playlist one of the best. Recommending to my friends as well. Thanks
@ConceptandCoding
@ConceptandCoding 2 жыл бұрын
thanks a lot Ayushi. Thanks for recommending, It means a lot to me.
@RAHULKUMAR-co7ye
@RAHULKUMAR-co7ye Жыл бұрын
Great Work It help us a lot please make more videos that help us to understand company standard
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thanks, Pls do check the complete LLD and HLD playlist
@umangkumar2005
@umangkumar2005 8 ай бұрын
best way of explaining
@ConceptandCoding
@ConceptandCoding 8 ай бұрын
thanks
@suchitrasrinivas4330
@suchitrasrinivas4330 Жыл бұрын
Very Nicely explained both factory and abstract factory patterns. Thanks a lot!
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Most welcome!
@shubhamaptekar7748
@shubhamaptekar7748 Жыл бұрын
than you so much sir great job understanding easily
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thank you
@arshkatyal2807
@arshkatyal2807 6 күн бұрын
Amazing content man I have 1 doubt here..since we wrote a switch case to decide which shape class it should take(factory pattern),but isn't that violating open/closed principle. If a new shape comes along , then we have to make changes in the same class Is there a way to avoid that ??Any help is appreciated
@dileepkumareduvaka4864
@dileepkumareduvaka4864 Ай бұрын
really good content man :)
@amitthakur2799
@amitthakur2799 2 жыл бұрын
Excellent Explanation!!, Thanks
@ConceptandCoding
@ConceptandCoding 2 жыл бұрын
thank you
@sameerchoudhary8590
@sameerchoudhary8590 6 ай бұрын
Even in my company's codebase, factory pattern is used a lot. Nicely explained.
@theritesh973
@theritesh973 2 жыл бұрын
Awesome explanation!!! Thank you!
@ConceptandCoding
@ConceptandCoding 2 жыл бұрын
thanks
@jaymanik
@jaymanik Жыл бұрын
Great Explaination. Keep up the awesome work.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thanks
@jaymanik
@jaymanik Жыл бұрын
@@ConceptandCoding Which should i learn first LLD or HLD? I am 8 years experienced software developer preparing for interviews.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
@@jaymanik both need to be learn parallerly buddy, as both are imp for this much of experience and both are independent of each other
@jaymanik
@jaymanik Жыл бұрын
@@ConceptandCoding Thank you for super quick reply. I intend to watch all videos in both your playlists. Thanks again.
@veereshb3249
@veereshb3249 Жыл бұрын
firstly thanks for doing this, really great stuff... secondly your examples help a lot.. can you please try giving more examples Sir.. I really wanted more abstract factory pattern examples.. helps in remembering
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Sure
@akshaymahajan9626
@akshaymahajan9626 6 ай бұрын
Very Well explained !
@ConceptandCoding
@ConceptandCoding 6 ай бұрын
thanks
@rishabhvarshney7811
@rishabhvarshney7811 Жыл бұрын
I really liked and impressed by your explanation in all the videos, very good content. did not understand why your channel has very less subscriber.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Really glad to know that you liked the content. 🙂 youtube reach is less, but I am trying to promote through my LinkedIn as much as I can.
@noneedtoknowthishandle
@noneedtoknowthishandle Ай бұрын
interfaces shall always have I as prefix. In the example you shared the interface must have a name IShape.
@shriharikulkarni3986
@shriharikulkarni3986 Жыл бұрын
Awesome explanation
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Glad you liked it
@ajayjangid1164
@ajayjangid1164 5 ай бұрын
💡💡The name is “Abstract factory” coz the sub-factory-class is got abstracted in main-factory-class.
@shantanuverma331
@shantanuverma331 Жыл бұрын
Hi I have started this playlist today, will edit this comment after completing, hope I am motivated to do so
@ConceptandCoding
@ConceptandCoding Жыл бұрын
:) sure
@SatyamKumar-bw4vi
@SatyamKumar-bw4vi Жыл бұрын
Hare Krishna..! Great Video🙂
@naruto5437
@naruto5437 Жыл бұрын
bhai bahot badhiya samjhaya....
@kaustavgalacticos
@kaustavgalacticos 8 ай бұрын
Good content. Although, I just wanted to point out something so that other viewers are also aware of the nuance. This is a factory pattern, which is not really a design pattern, technically speaking. The actual pattern is factory method pattern, where the same over-ridden method will create different products.
@vishaldas5692
@vishaldas5692 6 ай бұрын
do you have any video of it
@vinayakgandhi5690
@vinayakgandhi5690 Жыл бұрын
No words. Hats off.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
thank you
@rohitkumar-gt9wp
@rohitkumar-gt9wp 7 ай бұрын
Great work 👍
@dhivyaj4542
@dhivyaj4542 Ай бұрын
Hi Is there no English version available. Please share if it is available
@jahedulislam3438
@jahedulislam3438 16 күн бұрын
Why it show member only to me? And how to become a member?
@ravikanhreddymanik7767
@ravikanhreddymanik7767 11 ай бұрын
Excellent brother!!!
@ConceptandCoding
@ConceptandCoding 11 ай бұрын
Thank you
@ShekharSingh-qr3qu
@ShekharSingh-qr3qu Жыл бұрын
Hi Shrayansh, You are doing a great job and the number of people like me get to learn the concepts in an easy way. However, in this video the factory pattern you explained is not the one from the gang of four factory patterns.please correct me if I mistaken.
@deepanshukumar3943
@deepanshukumar3943 Жыл бұрын
I had the same question but I didn't ask.
@akshay_g
@akshay_g 6 ай бұрын
Nice videos
@hemantranjan2297
@hemantranjan2297 22 күн бұрын
What is the difference between factory and factory method design pattern?
@amansharma2466
@amansharma2466 2 жыл бұрын
Great work!
@obsessiveDreamer
@obsessiveDreamer 2 жыл бұрын
Nice Explanation❣❣
@AmanSharma-vb5jl
@AmanSharma-vb5jl Жыл бұрын
Good one
@chandrikasaha6301
@chandrikasaha6301 9 ай бұрын
Too good
@ConceptandCoding
@ConceptandCoding 9 ай бұрын
Thanks
@kanupriya3926
@kanupriya3926 5 ай бұрын
Great explanation sir thank you so much.....i have a question can i took example of db connections here
@sourabhchoudhary7289
@sourabhchoudhary7289 4 ай бұрын
How there is "has a" relationship btw factory and shape ? as factory don't have a shape instance it just returns it.
@ADITYAKUMARking
@ADITYAKUMARking Жыл бұрын
Great Explanation. Thanks for video. One Question, though: In many codebases i saw that developers use HashMap() instead of switch cases in factory function/method. Is this good practice or bad practice? Can you clarify ?
@ShekharSingh-qr3qu
@ShekharSingh-qr3qu Жыл бұрын
They are using that to remove switch or if conditions. From a collection they can manage. In dependency injections framework like ninject same way they are implementing i thought 🤔
@hemakiran5968
@hemakiran5968 6 ай бұрын
Correct me if Im wrong, the "Has-A" relation-ship symbol should be in reverse right? Ex: ShapeFactory
@_dheerajmittal
@_dheerajmittal 4 ай бұрын
Hey, I was trying to get the youtube membership for your channel, but transaction keeps on failing, is it still enabled?
@ConceptandCoding
@ConceptandCoding 4 ай бұрын
i am not sure buddy, i can see yesterday also some engineers joined the membership. So its working fine. you can try udemy then. Link is in Channel about section
@eshaandevgan312
@eshaandevgan312 Жыл бұрын
Help me understand it right. If we have a new Factory coming up as an economical luxury, is such a case, I would change the lower classes, right? For example, Hyundai should move from ordinary to econ. luxury. But that would be violating the SOLID principle classes not open to change. Any recommendation? Is there a way for concrete classes to select which factory they should belong to?
@sauravlikhar
@sauravlikhar Жыл бұрын
Nice video
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Thanks
@harshinredzone
@harshinredzone Жыл бұрын
Shrayansh, will you please consider my one request? Sort the videos in the playlist in proper order. I'm watching this video and you mentioned that we have covered strategy and observer etc but in the playlist, they are below this video. So, I've not covered them all. It might be case for many. Just a suggestion. Thaks again for these insights. 🙂
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Hi, i have given the numbering to the videos and also mentioned in playlist description that, pls start the playlist from bottom buddy.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
It's in sorted form, start from bottom and move upwards
@harshinredzone
@harshinredzone Жыл бұрын
@@ConceptandCoding correct but when KZbin doesn't give auto Play option in reverse order. No worries. ☺️
@bodybuildingtheory5337
@bodybuildingtheory5337 7 ай бұрын
It would be great if you can share the notes in description.
@khalidhashimeh
@khalidhashimeh 3 ай бұрын
I was hoping you would explain in English for a larger audience, thank you
@ConceptandCoding
@ConceptandCoding 3 ай бұрын
i covered in english too, pls check "All Creational", "All Behavioral", "All Structural" design patterns.
@rohan8758
@rohan8758 5 ай бұрын
Hi shreyansh, can you please provide code/github repo of given example of Abstract Factory pattern please ? I am trying to implement it but unable to do so.
@ConceptandCoding
@ConceptandCoding 5 ай бұрын
this is the link, but abstract factory pattern code seems not there, will add it : gitlab.com/shrayansh8/interviewcodingpractise/-/tree/main/src/LowLevelDesign
@rohan8758
@rohan8758 5 ай бұрын
Ok sir, Thanks
@prankuragrawal1206
@prankuragrawal1206 11 ай бұрын
I Have jpined the channel but not able to see members only videos. Please do needful
@ConceptandCoding
@ConceptandCoding 11 ай бұрын
You should be able to buddy, pls check again
@darkhorse4466
@darkhorse4466 Жыл бұрын
Hi Sir, just 1 doubt. What is the use of Abstract factory pattern. We could have use factory pattern itself for luxury and ordinary cars. What are the cons of using factory pattern in the scenario mentioned in the video??
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Its nothing but a factory of factory. Whenever in your code you have multiple factory pattern and we want to pick which particular factory method to call, then this pattern can be used. To be honest. Factory pattern is very popularly used but Abstract Factory is very rarely used. But good to know this,
@anookimmidisetty2939
@anookimmidisetty2939 Жыл бұрын
@@ConceptandCoding can you share code for Abstract factory pattern for the example you explained here?
@ayushsahu8731
@ayushsahu8731 10 ай бұрын
How is factory pattern different from strategy pattern?
@prasad.kenkre
@prasad.kenkre 10 ай бұрын
Strategy pattern is a behavioral design pattern which is basically used to interchangibly use only one algorithm using polymorphism based on the object need where as factory is a creational design pattern that delegates object creation process to other class seperating out the dependent class and its actual dependacy (object of another class that it needs)
@manvendrasingh3664
@manvendrasingh3664 Жыл бұрын
In the previous videos you said that system design should be free now you also made it for members only.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Only interview questions buddy, everything else is free
@HEMANTVERMA-pv2pe
@HEMANTVERMA-pv2pe Жыл бұрын
Great explanation. Though 1 thing I always struggle with is if factory needs to be an interface or abstract class. In one of the scalar masterclass It was said that behaviour difference => interface, attribute commons => abstract class. Is that correct?
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Why you need factory class to be interface or abstract. It can be normal class also right. Could you please elaborate your question?
@HEMANTVERMA-pv2pe
@HEMANTVERMA-pv2pe Жыл бұрын
​@@ConceptandCoding When we talk about abstract factory design pattern. Factory needs to be abstract, rather than being a concrete class, right?
@dhanbahadurchhettri2712
@dhanbahadurchhettri2712 Жыл бұрын
@@HEMANTVERMA-pv2pe Ig yes, becoz it has different sub classes ( luxury and normal cars classes) under it And we want to return the factory obj assigned to those specific sub classes.. Not sure if I'm getting it right I'm assuming from the factory pattern at 5:26 , like he is assigning circle obj to Shape interface object ( he could assign square obj to Shape interface as well) , becoz both classes circle and square are implementing Shape interface
@umeshkaushik710
@umeshkaushik710 11 ай бұрын
Its a humble request please don't make LLD & HLD paid like everyone. It was really great when all video were free. Please bhaiya
@ConceptandCoding
@ConceptandCoding 11 ай бұрын
almost all videos are free only, only few interview questions are for member only buddy.
@pnthrillz
@pnthrillz 2 ай бұрын
Bro this is not a factory pattern. This is just a simple factory, it is not even considered a design pattern.
@puskinmittal8956
@puskinmittal8956 Жыл бұрын
why are you lock the main videos ex parking lot and other.If you want to earn then you can earn via adds easily?
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Those are interview questions buddy. All basics, principles, patterns and fundamentals are open.
@premium3968
@premium3968 Жыл бұрын
Need more of interview questions examples with pattern this vehicle pen pencil less relatable
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Noted
@aryankumar488
@aryankumar488 Жыл бұрын
Can you please provide link for demo code of abstract factory pattern as well.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Noted
@sabbulingineni
@sabbulingineni 6 ай бұрын
If i want see videos of membership I need to pay 199 for lld and hld videos ?
@ConceptandCoding
@ConceptandCoding 6 ай бұрын
199rs for lld, hld and java (all will get unlocked)
@sabbulingineni
@sabbulingineni 6 ай бұрын
@@ConceptandCoding can we get some notes or material. We need to pay every month right ? Once after completion we can stop it is like that ?
@ConceptandCoding
@ConceptandCoding 6 ай бұрын
@@sabbulingineni yes it can be stopped anytime. notes link i have given in description section. for few it’s missing
@sabbulingineni
@sabbulingineni 6 ай бұрын
@@ConceptandCoding thanks
@commentator2407
@commentator2407 10 ай бұрын
U didn't show us abstract factory Patten code😢
@siddhantjaiswal5999
@siddhantjaiswal5999 Жыл бұрын
Hey, can you please provide the onenote link or some notes images? it would be very helpful.
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Sure will do
@shivomkumar628
@shivomkumar628 Жыл бұрын
you have not explained abstract factory design properly, you should make another video for the same , also one suggestion , try to extend example of factory design pattern only for abstract factory , that will help students more to clearly understand the difference between the two
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Hi Shivom. Thanks for the feedback. Sure, in Live LLD session will do that and cover in detail
@itsankit09
@itsankit09 Жыл бұрын
Please provide real example github code links as well. Understanding these patterns are easy but we need to see how they where implemented in real code. Some ref github repo should be enough
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Sure Ankit.
@sashibhushanarajput1194
@sashibhushanarajput1194 Жыл бұрын
abstract factory kaa bhi code example plzz
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Noted
@yogeshjoshi8021
@yogeshjoshi8021 10 ай бұрын
Can you please provide github link for the project
@soundarya4314
@soundarya4314 7 ай бұрын
I really wish you explain in English
@ConceptandCoding
@ConceptandCoding 7 ай бұрын
covered it in English too, pls check video no 27 in this playlist
@ekrem8847
@ekrem8847 Жыл бұрын
i am watching for a minute to decide if this is English or not
@ConceptandCoding
@ConceptandCoding Жыл бұрын
It's Hindi. But all latest videos are in English:)
@premium3968
@premium3968 Жыл бұрын
This 1 felt fast with no code
@ConceptandCoding
@ConceptandCoding Жыл бұрын
Sorry to hear this, let me know if it's not clear, we can discuss.
@mynameisjeff9124
@mynameisjeff9124 11 ай бұрын
Dude is this english or what am I listening to?
@ConceptandCoding
@ConceptandCoding 11 ай бұрын
Few initial videos are in Hindi, but I have covered them in English in later videos. Like: All Creational Design Patterns in 1 video and All Structural Design Patterns in 1 video
@akhilkumaramarneni8153
@akhilkumaramarneni8153 Жыл бұрын
github link please
@ConceptandCoding
@ConceptandCoding Жыл бұрын
gitlab.com/shrayansh8/interviewcodingpractise/-/tree/main/src/LowLevelDesign
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 2,5 МЛН
The Giant sleep in the town 👹🛏️🏡
00:24
Construction Site
Рет қаралды 18 МЛН
Joker can't swim!#joker #shorts
00:46
Untitled Joker
Рет қаралды 38 МЛН
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 2,5 МЛН