Factory Design Pattern in Java

Sdílet
Vložit
  • čas přidán 27. 07. 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

Komentáře • 178

  • @tonnie7079
    @tonnie7079 Před 2 lety +19

    Simple and straightforward explanation, this gonna stick with me forever as a Dev. Thx Nev

  • @tural.ahmatov
    @tural.ahmatov Před 2 lety +8

    Thanks for very easy to grasp explanation! It was actually much easier than we think if presented right. Kudos!

  • @ajaybabusingineedi804
    @ajaybabusingineedi804 Před 7 lety +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.

  • @thestarinthesky_
    @thestarinthesky_ Před 2 lety +2

    Clear, simple, nice and effective way to teach Factory Design Pattern! Super helpful to me!

  • @manasranjan7894
    @manasranjan7894 Před 6 měsíci +1

    I have watch many videos for this . finally got a simple understanding explanation for factory design pattern. tysm

  • @NaveenKumarasinghe
    @NaveenKumarasinghe Před 8 lety +2

    Awaiting for more...!! Amazing... thank you!

  • @tanertasim3637
    @tanertasim3637 Před 6 lety +3

    I really liked your comments about the mobile operating systems :D btw nice explanation , keep it like that !

  • @AM-qc7gh
    @AM-qc7gh Před 3 lety +1

    Absolute life saver, so much clearer than my lecture

  • @shaistakhalid7761
    @shaistakhalid7761 Před 5 lety

    Easy and quick explanation like other java pattern examples. Thanks for your hard work you put in to make us understand.

  • @amtawfiq
    @amtawfiq Před 2 lety

    This is the most straightforward implementation I've seen so far. Thanks a lot.

  • @limbritadaikalam1847
    @limbritadaikalam1847 Před 4 lety +3

    Thank you! wonderful explanation.

  • @AshutoshKumar-kq9vh
    @AshutoshKumar-kq9vh Před 5 lety +1

    To the point. It really helped me. Thanks so much!

  • @pratimsarkar7205
    @pratimsarkar7205 Před 4 lety +2

    Its simpler to understand than other videos in youtube

  • @ee-sj8qr
    @ee-sj8qr Před 3 lety +1

    your video is crystal clear i got my understanding right from you thank you!

  • @topoisonfungus
    @topoisonfungus Před 5 lety +6

    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.🧐

  • @MrSaransh
    @MrSaransh Před 5 lety +1

    I like your humor as well as teaching skills :D

  • @lokesh398
    @lokesh398 Před 4 lety

    Really a awesome video I got clear knowledge about design patterns especially factory design patterns.🙏🙏

  • @prakharawasthi2579
    @prakharawasthi2579 Před 4 lety +35

    That happy realization that its "instance" not intance :D

  • @parthpatel3639
    @parthpatel3639 Před 6 lety

    as the usual, clear and nice explanation

  • @s3649
    @s3649 Před 4 lety +1

    Thankyou very much sir. Really to the point explanation.

  • @saichaithvik
    @saichaithvik Před rokem +1

    Thanks.. excellent and simple .. way understanding .. for a layman

  • @palashkhatri7820
    @palashkhatri7820 Před 7 lety

    Nice one , cleared a lot about FDP Thank you

  • @sicariussss
    @sicariussss Před 5 lety +2

    This is a really nice and simple to understand explanation, thank you so much!

    • @Tydides64
      @Tydides64 Před 4 lety

      Yes it is, because this isn't Factory Method :)

  • @kunaljain6210
    @kunaljain6210 Před 3 lety

    Thank You for the clear explanation.

  • @praneetkumar4420
    @praneetkumar4420 Před 7 lety

    Very nice and simple tutorial....good job..

  • @romanterendiy5007
    @romanterendiy5007 Před 4 lety

    Great tutorial, thank you

  • @Tanzeel431
    @Tanzeel431 Před 5 lety

    Superlike. Thank you Sir. :)

  • @sohamdatey9035
    @sohamdatey9035 Před 4 lety

    @
    Everything Summed up in a nicely compact informative Session

  • @muralidharang5664
    @muralidharang5664 Před rokem

    Thank you Navin, it is clear and precise

  • @dinushachathuranga7657

    Thanks a lot clear explanation.❤

  • @puna770
    @puna770 Před 7 lety

    ekdam mast samjhaya hai thank you :)

  • @natashayxt3458
    @natashayxt3458 Před 2 lety

    Thank you so much sir for explaining design patterns

  • @bishwajitsahu2100
    @bishwajitsahu2100 Před 6 lety

    nice explanantion....... very helpful

  • @pranjalnegi9834
    @pranjalnegi9834 Před 3 lety

    amazing
    very easily explained

  • @AyushVerma08
    @AyushVerma08 Před 2 lety

    Excellent example! Keep it up.

  • @sagarmeena2596
    @sagarmeena2596 Před 5 lety

    amazing explanation

  • @snehashreer8356
    @snehashreer8356 Před 6 lety

    Thank u so much!

  • @rohannarkhede7479
    @rohannarkhede7479 Před 5 lety +6

    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 Před 4 lety +1

      I guess reason is being his opinion about Windows 😀

  • @vamshikrishna298
    @vamshikrishna298 Před 6 lety

    Good content and explanation buddy

  • @praveennandham2933
    @praveennandham2933 Před 3 lety

    Really amazing explanation..

  • @md.ruhulamin7963
    @md.ruhulamin7963 Před 2 lety

    Think you sir. This is very helpful.

  • @piraviperumal2544
    @piraviperumal2544 Před rokem +1

    Awesome

  • @javatoyou862
    @javatoyou862 Před 5 lety

    great job sir

  • @FutureSmartAI
    @FutureSmartAI Před 8 lety

    Please upload more videos,Thank You.....

  • @umabharathyts1998
    @umabharathyts1998 Před měsícem

    Thank you for this 🙏

  • @MegaRockandroll09
    @MegaRockandroll09 Před 2 lety

    Your sense of Humour is Amazing. Windows OS: " I'm about to die" lol

  • @kidslearningscience
    @kidslearningscience Před 8 lety

    Good one.

  • @greentorainchannel386
    @greentorainchannel386 Před 2 lety

    Nice and simple to understand 👍👍👍👍

  • @eliy5550
    @eliy5550 Před rokem

    THANKS SO MUCH

  • @hardikahuja5645
    @hardikahuja5645 Před 3 lety

    Nice explanation bro!!!

  • @techatnyc7320
    @techatnyc7320 Před 10 měsíci

    Thank You, Naveen!

  • @parulgupta8231
    @parulgupta8231 Před 4 lety

    Nice Explanation

  • @mohammedviso2269
    @mohammedviso2269 Před 8 lety

    thank you

  • @BeWithNarendar
    @BeWithNarendar Před 2 lety

    PERFECT !!

  • @ThePhysics1234
    @ThePhysics1234 Před 7 lety

    very nice

  • @kreenu5035
    @kreenu5035 Před 4 lety

    Nice tutorial...I suggest you add abstract factory design pattern

  • @sagarmeena0210
    @sagarmeena0210 Před 5 lety

    love it

  • @meenakshisharma1870
    @meenakshisharma1870 Před 5 lety

    Please make a video on Observer design pattern as well :)

  • @rmn6088
    @rmn6088 Před 5 lety +3

    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.

  • @vinothKumar-ik9lu
    @vinothKumar-ik9lu Před 5 lety +1

    Hi Navin, Can you take video for Abstract Factory design pattern ?

  • @biswa12
    @biswa12 Před 4 lety

    Thank you

  • @piotrboczar7967
    @piotrboczar7967 Před 2 lety

    Thanks!

  • @RetroGames1979
    @RetroGames1979 Před 3 lety

    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

  • @kirankumarpurini2476
    @kirankumarpurini2476 Před 6 lety

    thanks

  • @dulajudayanga4050
    @dulajudayanga4050 Před 7 lety

    thanks a lotttttttttttttttttttttttttttttttttttttttttttttttttttttttt
    Very good human in the planet

  • @kosireddigangadhar7182

    Super bro👍

  • @michael_scarn_
    @michael_scarn_ Před měsícem

    Thank you!!!!

  • @muralidharang5664
    @muralidharang5664 Před rokem

    Thank you ,It is clear, Please let me know if we have a video for abstract factory design pattern

  • @delankoh3494
    @delankoh3494 Před rokem

    Good for cross browser testing during automation testing using java

  • @mahinqureshi5809
    @mahinqureshi5809 Před 2 lety +3

    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 ?

  • @AtifLightning2
    @AtifLightning2 Před 5 lety

    Thanks

  • @Pratapsingh-mt9cu
    @Pratapsingh-mt9cu Před 5 lety

    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

  • @kishorthekhiladi
    @kishorthekhiladi Před 7 lety

    looking for more design patterns..

  • @moniljoshi1850
    @moniljoshi1850 Před 5 lety

    Can you please make videos on decorator and strategic design pattern

  • @akramladaf7817
    @akramladaf7817 Před 3 lety

    Thank bhai

  • @iamSSudheer
    @iamSSudheer Před 2 lety +4

    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 Před rokem +1

      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!

  • @saisnehitha1043
    @saisnehitha1043 Před 4 lety

    What you have said in this video is a simple factory..

  • @sharaththatikonda5386
    @sharaththatikonda5386 Před 6 lety

    make videos on all design patterns.

  • @Jaggahero
    @Jaggahero Před rokem

    Could you please explain abstract factory pattern and difference between factory and abstract

  • @Secretclaps
    @Secretclaps Před rokem

    7 years later and I am still watching it.

  • @dilipsoni4695
    @dilipsoni4695 Před 6 lety

    which s/w you using for coding

  • @Studyroid
    @Studyroid Před 5 lety +35

    3:44

    • @4cankursharma
      @4cankursharma Před 3 lety +1

      even I also laughed so hard on that....

    • @lalithmahadev5027
      @lalithmahadev5027 Před 3 lety

      But it is not dying does it ? It still holds 75 pc market share today in desktop os

  • @dkstudio7828
    @dkstudio7828 Před 7 lety +5

    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 Před 5 lety

      What if we use hashmap for that ?

    • @divyeshkumarbalar7732
      @divyeshkumarbalar7732 Před 5 lety +1

      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

  • @rounakdas2633
    @rounakdas2633 Před rokem

    Hi Sir, thanks for presenting this topic in such an understandable manner!

  • @jemschaudhary5922
    @jemschaudhary5922 Před 4 lety

    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.

  • @nitinkhutemate2155
    @nitinkhutemate2155 Před 7 lety +57

    People who have disliked his videos are those who are using Windows mobiles :p

    • @risteardob2095
      @risteardob2095 Před 6 lety +4

      Or perhaps they disliked it because it's not accurate. What's described is not the Factory Method Design Pattern.

    • @honest_bishop5905
      @honest_bishop5905 Před 3 lety

      @@risteardob2095 what is it then?

    • @adithyarathnayake
      @adithyarathnayake Před rokem

      😂 you mean, they gonna die

  • @Pratapsingh-mt9cu
    @Pratapsingh-mt9cu Před 5 lety

    factory design pattern is only use to the minimal modification is required but again we are not achieving the complete loosely couple

  • @AspirantNoteBooks
    @AspirantNoteBooks Před 7 lety

    which version of IOS you are using >??

  • @SvetoslavHristov-uh4eo

    Can we create this getInstance method as a static method in OS interface?

  • @karthican2010
    @karthican2010 Před 4 lety

    Why is getInstance() method is returning OS type (6:30) in OperatingSystemFactory class. Can someone explain the reason behind it.

  • @_xenomorph8096
    @_xenomorph8096 Před rokem

    Can you add real life video example with spring ? …switching between databases auto wiring with factory

  • @nonamespls3468
    @nonamespls3468 Před 2 lety

    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.

  • @vinays8546
    @vinays8546 Před 3 lety

    its good if OperatingSystemFactory is made singleton instead of using new operator in client code, isn't it?

  • @VipinRawat_Offcial
    @VipinRawat_Offcial Před 2 lety

    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?

  • @digiartpassion8513
    @digiartpassion8513 Před 2 lety

    Didn't understand from line 5 in OperatingSystemFactory.java.....We generally declare methods directly why r u creating as public Os getinstnce()......plz explain

  • @PremChougale
    @PremChougale Před 8 měsíci

    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?

  • @tinkot
    @tinkot Před 4 lety

    What you call importing the package is importing the class.

  • @abhijithss1244
    @abhijithss1244 Před rokem

    Shouldnt we implement singleton also here for maximum optimisation

  • @ridhwaanany7480
    @ridhwaanany7480 Před 8 lety +3

    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

    • @ontest5819
      @ontest5819 Před 6 lety

      @ridhwaan any The client is the class using the objects of the different OS

    • @HimalayaGarg
      @HimalayaGarg Před 2 lety

      Think of this code as DLL and client is consuming that DLL

  • @ritikshrivastava9442
    @ritikshrivastava9442 Před rokem

    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.