Factory Design Pattern in Java

  Рет қаралды 475,035

Telusko

Telusko

Күн бұрын

Spring and Microservices Live Course : bit.ly/springmslive
Coupon: TELUSKO25 (25% Discount)
Industry-Ready Java Spring Microservices Developer Live : bit.ly/JavaMS2
Complete Java Developer Course : bit.ly/Comp-Java-Dev-2
Coupon: TELUSKO20 (20% Discount)
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
TELUSKO Android App : bit.ly/TeluskoApp
Discord : / discord
What is Design Pattern? #factory
Recommended Book :
Head First Design Pattern : amzn.to/2pY5xbR
Factory Design pattern in java
Factory design pattern belongs to Creational design pattern which belongs to Design Patterns in java.
This video has practical sesssion on factory design pattern.
Factory Design Method Pattern defines an interface or abstract class for creating an object but let the subclasses decide which class to instantiate
Factory Method Pattern is also known as Virtual Constructor.
Java and Spring Framework For beginners with Spring Boot : - bit.ly/3LDMj8D
Java Tutorial for Beginners (2023) :- bit.ly/3yARVbN
Trainer: Navin Reddy
Subscribe to our other channel:
Navin Reddy : / @navinreddy
Telusko Hindi :
/ @teluskohindi
Subscribe to the channel and learn Programming in easy way.
Java Tutorial for Beginners : goo.gl/p10QfB
Scala Tutorials for Java Developers : goo.gl/8H1aE5
C Tutorial Playlist : goo.gl/8v92pu
Android Tutorial for Beginners Playlist : goo.gl/MzlIUJ
XML Tutorial : goo.gl/Eo79do
Design Patterns in Java : goo.gl/Kd2MWE
Java Servlet : goo.gl/R5nHp8
Hibernate Tutorial :goo.gl/N5ONYg
Spring MVC Tutorial : goo.gl/9ubbG2
OpenShift Tutorial for Beginners : goo.gl/s58BQH
Spring Framework with Maven : goo.gl/MaEluO
Sql Tutorial for Beginners : goo.gl/x3PrTg
String Handling in Java : goo.gl/zUdPwa
Array in Java : goo.gl/uXTaUy
Socket Programming in Java : goo.gl/jlMEbg
Exception Handling in Java : goo.gl/N4NbAW
Regards,
Navin Reddy

Пікірлер: 175
@tonnie7079
@tonnie7079 2 жыл бұрын
Simple and straightforward explanation, this gonna stick with me forever as a Dev. Thx Nev
@tural.ahmatov
@tural.ahmatov 2 жыл бұрын
Thanks for very easy to grasp explanation! It was actually much easier than we think if presented right. Kudos!
@thestarinthesky_
@thestarinthesky_ 2 жыл бұрын
Clear, simple, nice and effective way to teach Factory Design Pattern! Super helpful to me!
@amtawfiq
@amtawfiq 2 жыл бұрын
This is the most straightforward implementation I've seen so far. Thanks a lot.
@ajaybabusingineedi804
@ajaybabusingineedi804 7 жыл бұрын
Really nice and worth for gaining knowledge.Thanks for that. Humble request you to make videos on the other missed Design Patterns as well. Many Thanks.
@shaistakhalid7761
@shaistakhalid7761 5 жыл бұрын
Easy and quick explanation like other java pattern examples. Thanks for your hard work you put in to make us understand.
@AM-qc7gh
@AM-qc7gh 3 жыл бұрын
Absolute life saver, so much clearer than my lecture
@manasranjan7894
@manasranjan7894 4 ай бұрын
I have watch many videos for this . finally got a simple understanding explanation for factory design pattern. tysm
@ee-sj8qr
@ee-sj8qr 3 жыл бұрын
your video is crystal clear i got my understanding right from you thank you!
@limbritadaikalam1847
@limbritadaikalam1847 4 жыл бұрын
Thank you! wonderful explanation.
@pratimsarkar7205
@pratimsarkar7205 3 жыл бұрын
Its simpler to understand than other videos in youtube
@NaveenKumarasinghe
@NaveenKumarasinghe 7 жыл бұрын
Awaiting for more...!! Amazing... thank you!
@AshutoshKumar-kq9vh
@AshutoshKumar-kq9vh 4 жыл бұрын
To the point. It really helped me. Thanks so much!
@saichaithvik
@saichaithvik Жыл бұрын
Thanks.. excellent and simple .. way understanding .. for a layman
@lokesh398
@lokesh398 3 жыл бұрын
Really a awesome video I got clear knowledge about design patterns especially factory design patterns.🙏🙏
@tanertasim3637
@tanertasim3637 6 жыл бұрын
I really liked your comments about the mobile operating systems :D btw nice explanation , keep it like that !
@rohannarkhede7479
@rohannarkhede7479 4 жыл бұрын
1lakh views and not even 1k+ likes... Guys don't just watch the video and go... At least show some respect to this guy and his work.
@kandisaganesh
@kandisaganesh 4 жыл бұрын
I guess reason is being his opinion about Windows 😀
@s3649
@s3649 4 жыл бұрын
Thankyou very much sir. Really to the point explanation.
@palashkhatri7820
@palashkhatri7820 6 жыл бұрын
Nice one , cleared a lot about FDP Thank you
@prakharawasthi2579
@prakharawasthi2579 3 жыл бұрын
That happy realization that its "instance" not intance :D
@pranavkr3565
@pranavkr3565 2 жыл бұрын
🤣🤣
@parthpatel3639
@parthpatel3639 6 жыл бұрын
as the usual, clear and nice explanation
@kunaljain6210
@kunaljain6210 3 жыл бұрын
Thank You for the clear explanation.
@muralidharang5664
@muralidharang5664 Жыл бұрын
Thank you Navin, it is clear and precise
@sicariussss
@sicariussss 4 жыл бұрын
This is a really nice and simple to understand explanation, thank you so much!
@Tydides64
@Tydides64 4 жыл бұрын
Yes it is, because this isn't Factory Method :)
@topoisonfungus
@topoisonfungus 5 жыл бұрын
Hi Naveen,I am preparing a introductory video set for freshers in my team and I have selected many of your basic online lessons. Thank you for the videos..real time saver for me.👏 One question: what's the background behind the hello aliens greetings and object names in your video? Nation wants to know.🧐
@natashayxt3458
@natashayxt3458 2 жыл бұрын
Thank you so much sir for explaining design patterns
@MrSaransh
@MrSaransh 5 жыл бұрын
I like your humor as well as teaching skills :D
@praneetkumar4420
@praneetkumar4420 7 жыл бұрын
Very nice and simple tutorial....good job..
@sohamdatey9035
@sohamdatey9035 4 жыл бұрын
@ Everything Summed up in a nicely compact informative Session
@romanterendiy5007
@romanterendiy5007 4 жыл бұрын
Great tutorial, thank you
@dinushachathuranga7657
@dinushachathuranga7657 11 ай бұрын
Thanks a lot clear explanation.❤
@pranjalnegi9834
@pranjalnegi9834 3 жыл бұрын
amazing very easily explained
@puna770
@puna770 7 жыл бұрын
ekdam mast samjhaya hai thank you :)
@AyushVerma08
@AyushVerma08 2 жыл бұрын
Excellent example! Keep it up.
@Tanzeel431
@Tanzeel431 5 жыл бұрын
Superlike. Thank you Sir. :)
@md.ruhulamin7963
@md.ruhulamin7963 2 жыл бұрын
Think you sir. This is very helpful.
@bishwajitsahu2100
@bishwajitsahu2100 6 жыл бұрын
nice explanantion....... very helpful
@sagarmeena2596
@sagarmeena2596 5 жыл бұрын
amazing explanation
@praveennandham2933
@praveennandham2933 3 жыл бұрын
Really amazing explanation..
@snehashreer8356
@snehashreer8356 6 жыл бұрын
Thank u so much!
@FutureSmartAI
@FutureSmartAI 7 жыл бұрын
Please upload more videos,Thank You.....
@techatnyc7320
@techatnyc7320 9 ай бұрын
Thank You, Naveen!
@greentorainchannel386
@greentorainchannel386 2 жыл бұрын
Nice and simple to understand 👍👍👍👍
@javatoyou862
@javatoyou862 5 жыл бұрын
great job sir
@vamshikrishna298
@vamshikrishna298 6 жыл бұрын
Good content and explanation buddy
@eliy5550
@eliy5550 11 ай бұрын
THANKS SO MUCH
@piraviperumal2544
@piraviperumal2544 Жыл бұрын
Awesome
@Pratapsingh-mt9cu
@Pratapsingh-mt9cu 5 жыл бұрын
In ur explain u can take also template design pattern need to modification required just create one super template class and here declare all the abstract method and override it but in future any thing modification required then only go to the super class and modified without any ur os and android class
@RetroGames1979
@RetroGames1979 2 жыл бұрын
The only thing you are missing, is why? as in, you could use the args[] to pass the OS type at run time, depending on what OS you are running, therefore having a dynamic application based on what is passed to it by the caller
@kreenu5035
@kreenu5035 4 жыл бұрын
Nice tutorial...I suggest you add abstract factory design pattern
@delankoh3494
@delankoh3494 Жыл бұрын
Good for cross browser testing during automation testing using java
@mohammedviso2269
@mohammedviso2269 8 жыл бұрын
thank you
@BeWithNarendar
@BeWithNarendar 2 жыл бұрын
PERFECT !!
@parulgupta8231
@parulgupta8231 3 жыл бұрын
Nice Explanation
@kidslearningscience
@kidslearningscience 7 жыл бұрын
Good one.
@rmn6088
@rmn6088 5 жыл бұрын
Can you please also tell how can we use it with @Autowire I want to be able to switch between the two databases using factory pattern.
@muralidharang5664
@muralidharang5664 Жыл бұрын
Thank you ,It is clear, Please let me know if we have a video for abstract factory design pattern
@kirankumarpurini2476
@kirankumarpurini2476 6 жыл бұрын
thanks
@hardikahuja5645
@hardikahuja5645 3 жыл бұрын
Nice explanation bro!!!
@sagarmeena0210
@sagarmeena0210 5 жыл бұрын
love it
@biswa12
@biswa12 4 жыл бұрын
Thank you
@ThePhysics1234
@ThePhysics1234 6 жыл бұрын
very nice
@vinothKumar-ik9lu
@vinothKumar-ik9lu 4 жыл бұрын
Hi Navin, Can you take video for Abstract Factory design pattern ?
@AtifLightning2
@AtifLightning2 5 жыл бұрын
Thanks
@mahinqureshi5809
@mahinqureshi5809 2 жыл бұрын
Hey .. i m new in this learning journey of Design Pattern . This video was really helpful but i m confused in this one thing , who is this "client" ? I m sure its not the end user .. is it someone who's gonna use that result to work further? A fellow programmer ?
@meenakshisharma1870
@meenakshisharma1870 5 жыл бұрын
Please make a video on Observer design pattern as well :)
@piotrboczar7967
@piotrboczar7967 2 жыл бұрын
Thanks!
@rounakdas2633
@rounakdas2633 Жыл бұрын
Hi Sir, thanks for presenting this topic in such an understandable manner!
@Jaggahero
@Jaggahero 10 ай бұрын
Could you please explain abstract factory pattern and difference between factory and abstract
@moniljoshi1850
@moniljoshi1850 5 жыл бұрын
Can you please make videos on decorator and strategic design pattern
@saisnehitha1043
@saisnehitha1043 4 жыл бұрын
What you have said in this video is a simple factory..
@akramladaf7817
@akramladaf7817 3 жыл бұрын
Thank bhai
@kosireddigangadhar7182
@kosireddigangadhar7182 3 жыл бұрын
Super bro👍
@dulajudayanga4050
@dulajudayanga4050 6 жыл бұрын
thanks a lotttttttttttttttttttttttttttttttttttttttttttttttttttttttt Very good human in the planet
@nitinkhutemate2155
@nitinkhutemate2155 7 жыл бұрын
People who have disliked his videos are those who are using Windows mobiles :p
@risteardob2095
@risteardob2095 5 жыл бұрын
Or perhaps they disliked it because it's not accurate. What's described is not the Factory Method Design Pattern.
@honest_bishop5905
@honest_bishop5905 3 жыл бұрын
@@risteardob2095 what is it then?
@adithyarathnayake
@adithyarathnayake Жыл бұрын
😂 you mean, they gonna die
@iamSSudheer
@iamSSudheer 2 жыл бұрын
Hi Naveen, when we are adding OS obj = osf.getInstance("something"), it means we are modifying the client class and we need to compile it. How is this different from directly creating object of IOS class?
@joseph2073
@joseph2073 Жыл бұрын
When you'll create a full project ... Then this string will be taken from the user from the frontend and based on that we r creating object and returning it. So user doesn't need to create object , he only needs to type the string and thus object creation stays hidden!
@MegaRockandroll09
@MegaRockandroll09 2 жыл бұрын
Your sense of Humour is Amazing. Windows OS: " I'm about to die" lol
@kishorthekhiladi
@kishorthekhiladi 7 жыл бұрын
looking for more design patterns..
@dilipsoni4695
@dilipsoni4695 6 жыл бұрын
which s/w you using for coding
@SvetoslavHristov-uh4eo
@SvetoslavHristov-uh4eo Жыл бұрын
Can we create this getInstance method as a static method in OS interface?
@Pratapsingh-mt9cu
@Pratapsingh-mt9cu 5 жыл бұрын
factory design pattern is only use to the minimal modification is required but again we are not achieving the complete loosely couple
@sharaththatikonda5386
@sharaththatikonda5386 6 жыл бұрын
make videos on all design patterns.
@_xenomorph8096
@_xenomorph8096 Жыл бұрын
Can you add real life video example with spring ? …switching between databases auto wiring with factory
@Studyroid
@Studyroid 5 жыл бұрын
3:44
@4cankursharma
@4cankursharma 3 жыл бұрын
even I also laughed so hard on that....
@lalithmahadev5027
@lalithmahadev5027 3 жыл бұрын
But it is not dying does it ? It still holds 75 pc market share today in desktop os
@karthican2010
@karthican2010 4 жыл бұрын
Why is getInstance() method is returning OS type (6:30) in OperatingSystemFactory class. Can someone explain the reason behind it.
@nonamespls3468
@nonamespls3468 Жыл бұрын
This guy has a lot of great videos, learned a lot from his videos. Although for this one, and some of his videos he doesn't really explain the purpose clearly, why would you do that? why bother? also factory classes for most implementations I saw , then getInstance method is static, makes sense, you don't need to create new factory every time you want some object. Also some best practices would help, like some implementations I see enum as the param type of getInstance.
@dkstudio7828
@dkstudio7828 7 жыл бұрын
It very nice, but do you think your OperatingSystemFactory class is violation of "Open Closed Principle"? I think we should use other way instead if-else
@MrSaransh
@MrSaransh 5 жыл бұрын
What if we use hashmap for that ?
@divyeshkumarbalar7732
@divyeshkumarbalar7732 5 жыл бұрын
i think its better to package all 3 OS with interface and make those classes default rather public and then make a public factory there in the same package without if/else. that would be more secure
@jemschaudhary5922
@jemschaudhary5922 3 жыл бұрын
Nice video... I have a question about inheritance and polymorphism. I am creating a static method in child class which have private constructor. And the parent class have same private constructor and stayic method. Parent class extends GrandParent class which have public constructor with 3 arguments. My problem is the error shown in child class for making its own constructor. Can you please show me any direction.
@yudhisthirsingh8401
@yudhisthirsingh8401 4 жыл бұрын
clear hai
@tinkot
@tinkot 4 жыл бұрын
What you call importing the package is importing the class.
@gamerkids-india
@gamerkids-india 5 ай бұрын
Wow
@risteardob2095
@risteardob2095 5 жыл бұрын
What you have described is not the Factory Method Design Pattern. I think you're describing the Simple Factory which isn't an actual design pattern.
@abhisheksengupta2819
@abhisheksengupta2819 4 жыл бұрын
yes
@LargerThanCats
@LargerThanCats 4 жыл бұрын
It is the Factory Design Pattern. The Simple Factory uses the Factory Design pattern with one caveat. In this example he is simply demonstrating abstracting away the creation of a product from the client. Extending it to the Factory Design Pattern means instead of simple abstracting away the creation, you're controlling the creation and management of that newly created product. Such as Spring and bean creation. So not exactly the same thing, you're right, but it is a demonstration of one element of the Factory Design Pattern.
@abhijithss1244
@abhijithss1244 11 ай бұрын
Shouldnt we implement singleton also here for maximum optimisation
@Secretclaps
@Secretclaps 10 ай бұрын
7 years later and I am still watching it.
@vinaykumarneela4538
@vinaykumarneela4538 5 жыл бұрын
can u suggest me the structure of this example
@PremChougale
@PremChougale 7 ай бұрын
What if we want to add more Operating systems but don't want to make changes in OperatingSystemFactory. Is there any way to do this?
@AspirantNoteBooks
@AspirantNoteBooks 7 жыл бұрын
which version of IOS you are using >??
@vinays8546
@vinays8546 3 жыл бұрын
its good if OperatingSystemFactory is made singleton instead of using new operator in client code, isn't it?
@digiartpassion8513
@digiartpassion8513 2 жыл бұрын
Didn't understand from line 5 in OperatingSystemFactory.java.....We generally declare methods directly why r u creating as public Os getinstnce()......plz explain
@ritikshrivastava9442
@ritikshrivastava9442 10 ай бұрын
Factory design pattern = if you are creating object on the basis of some condition(here based on the parameter that is passed) then it is known as factory design pattern.