Factory Design Pattern in Java
Вставка
- Опубліковано 11 лип 2024
- Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-spring-cloud
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
Simple and straightforward explanation, this gonna stick with me forever as a Dev. Thx Nev
Thanks for very easy to grasp explanation! It was actually much easier than we think if presented right. Kudos!
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.
Clear, simple, nice and effective way to teach Factory Design Pattern! Super helpful to me!
I have watch many videos for this . finally got a simple understanding explanation for factory design pattern. tysm
Easy and quick explanation like other java pattern examples. Thanks for your hard work you put in to make us understand.
Awaiting for more...!! Amazing... thank you!
Thank you! wonderful explanation.
To the point. It really helped me. Thanks so much!
Absolute life saver, so much clearer than my lecture
This is the most straightforward implementation I've seen so far. Thanks a lot.
your video is crystal clear i got my understanding right from you thank you!
I really liked your comments about the mobile operating systems :D btw nice explanation , keep it like that !
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.🧐
as the usual, clear and nice explanation
Really a awesome video I got clear knowledge about design patterns especially factory design patterns.🙏🙏
That happy realization that its "instance" not intance :D
🤣🤣
Thankyou very much sir. Really to the point explanation.
Thanks.. excellent and simple .. way understanding .. for a layman
Very nice and simple tutorial....good job..
@
Everything Summed up in a nicely compact informative Session
Thank You for the clear explanation.
Great tutorial, thank you
Nice one , cleared a lot about FDP Thank you
Superlike. Thank you Sir. :)
Its simpler to understand than other videos in youtube
ekdam mast samjhaya hai thank you :)
I like your humor as well as teaching skills :D
nice explanantion....... very helpful
Thanks a lot clear explanation.❤
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.
I guess reason is being his opinion about Windows 😀
Thank you for this 🙏
Thank you Navin, it is clear and precise
Thank u so much!
Thank You, Naveen!
amazing
very easily explained
Thank you so much sir for explaining design patterns
Think you sir. This is very helpful.
This is a really nice and simple to understand explanation, thank you so much!
Yes it is, because this isn't Factory Method :)
amazing explanation
Thank you!!!!
Excellent example! Keep it up.
THANKS SO MUCH
Please upload more videos,Thank You.....
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.
Really amazing explanation..
Good content and explanation buddy
great job sir
PERFECT !!
Nice and simple to understand 👍👍👍👍
Thanks!
Good one.
Awesome
thank you
Nice explanation bro!!!
Super bro👍
Nice Explanation
love it
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
very nice
Thank you
thanks
Thank bhai
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 ?
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?
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!
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.
Thanks
which s/w you using for coding
Can we create this getInstance method as a static method in OS interface?
Your sense of Humour is Amazing. Windows OS: " I'm about to die" lol
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
Why is getInstance() method is returning OS type (6:30) in OperatingSystemFactory class. Can someone explain the reason behind it.
Thank you ,It is clear, Please let me know if we have a video for abstract factory design pattern
Hi Navin, Can you take video for Abstract Factory design pattern ?
which version of IOS you are using >??
Nice tutorial...I suggest you add abstract factory design pattern
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
What if we use hashmap for that ?
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
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?
People who have disliked his videos are those who are using Windows mobiles :p
Or perhaps they disliked it because it's not accurate. What's described is not the Factory Method Design Pattern.
@@risteardob2095 what is it then?
😂 you mean, they gonna die
thanks a lotttttttttttttttttttttttttttttttttttttttttttttttttttttttt
Very good human in the planet
Please make a video on Observer design pattern as well :)
Didn't understand from line 5 in OperatingSystemFactory.java.....We generally declare methods directly why r u creating as public Os getinstnce()......plz explain
Good for cross browser testing during automation testing using java
its good if OperatingSystemFactory is made singleton instead of using new operator in client code, isn't it?
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.
yes
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.
I was watching kudvenkat video and there this factory method was explained as Simple Factory and there was different code for Factory Method, so is this true that it's Simple Factory Method?
can u suggest me the structure of this example
3:44
even I also laughed so hard on that....
But it is not dying does it ? It still holds 75 pc market share today in desktop os
Shouldnt we implement singleton also here for maximum optimisation
what is that void spec called?
Can you please make videos on decorator and strategic design pattern
When you say that your exposing to the client the implementation () e.g when you do new Windows(); or new Android():, what does that mean? Who is the client? How does the client see the code? Isn't that the user who is using your application? Please clarify
@ridhwaan any The client is the class using the objects of the different OS
Think of this code as DLL and client is consuming that DLL
looking for more design patterns..
This is very similar to Facade Pattern! whats the difference between them ?
Could you please explain abstract factory pattern and difference between factory and abstract
does this pattern violates ocp?
In operating system factory why didn't we import android iOS, Windows packages?
7 years later and I am still watching it.
Hi Sir, thanks for presenting this topic in such an understandable manner!
Can you add real life video example with spring ? …switching between databases auto wiring with factory