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

КОМЕНТАРІ • 178

  • @tonnie7079
    @tonnie7079 2 роки тому +19

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

  • @tural.ahmatov
    @tural.ahmatov 2 роки тому +8

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

  • @ajaybabusingineedi804
    @ajaybabusingineedi804 7 років тому +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_ 2 роки тому +2

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

  • @manasranjan7894
    @manasranjan7894 5 місяців тому +1

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

  • @shaistakhalid7761
    @shaistakhalid7761 5 років тому

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

  • @NaveenKumarasinghe
    @NaveenKumarasinghe 8 років тому +2

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

  • @limbritadaikalam1847
    @limbritadaikalam1847 4 роки тому +3

    Thank you! wonderful explanation.

  • @AshutoshKumar-kq9vh
    @AshutoshKumar-kq9vh 5 років тому +1

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

  • @AM-qc7gh
    @AM-qc7gh 3 роки тому +1

    Absolute life saver, so much clearer than my lecture

  • @amtawfiq
    @amtawfiq 2 роки тому

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

  • @ee-sj8qr
    @ee-sj8qr 3 роки тому +1

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

  • @tanertasim3637
    @tanertasim3637 6 років тому +3

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

  • @topoisonfungus
    @topoisonfungus 5 років тому +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.🧐

  • @parthpatel3639
    @parthpatel3639 6 років тому

    as the usual, clear and nice explanation

  • @lokesh398
    @lokesh398 4 роки тому

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

  • @prakharawasthi2579
    @prakharawasthi2579 3 роки тому +35

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

  • @s3649
    @s3649 4 роки тому +1

    Thankyou very much sir. Really to the point explanation.

  • @saichaithvik
    @saichaithvik Рік тому +1

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

  • @praneetkumar4420
    @praneetkumar4420 7 років тому

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

  • @sohamdatey9035
    @sohamdatey9035 4 роки тому

    @
    Everything Summed up in a nicely compact informative Session

  • @kunaljain6210
    @kunaljain6210 3 роки тому

    Thank You for the clear explanation.

  • @romanterendiy5007
    @romanterendiy5007 4 роки тому

    Great tutorial, thank you

  • @palashkhatri7820
    @palashkhatri7820 7 років тому

    Nice one , cleared a lot about FDP Thank you

  • @Tanzeel431
    @Tanzeel431 5 років тому

    Superlike. Thank you Sir. :)

  • @pratimsarkar7205
    @pratimsarkar7205 4 роки тому +2

    Its simpler to understand than other videos in youtube

  • @puna770
    @puna770 7 років тому

    ekdam mast samjhaya hai thank you :)

  • @MrSaransh
    @MrSaransh 5 років тому +1

    I like your humor as well as teaching skills :D

  • @bishwajitsahu2100
    @bishwajitsahu2100 6 років тому

    nice explanantion....... very helpful

  • @dinushachathuranga7657
    @dinushachathuranga7657 Рік тому

    Thanks a lot clear explanation.❤

  • @rohannarkhede7479
    @rohannarkhede7479 5 років тому +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 4 роки тому +1

      I guess reason is being his opinion about Windows 😀

  • @umabharathyts1998
    @umabharathyts1998 14 днів тому

    Thank you for this 🙏

  • @muralidharang5664
    @muralidharang5664 Рік тому

    Thank you Navin, it is clear and precise

  • @snehashreer8356
    @snehashreer8356 6 років тому

    Thank u so much!

  • @techatnyc7320
    @techatnyc7320 10 місяців тому

    Thank You, Naveen!

  • @pranjalnegi9834
    @pranjalnegi9834 3 роки тому

    amazing
    very easily explained

  • @natashayxt3458
    @natashayxt3458 2 роки тому

    Thank you so much sir for explaining design patterns

  • @md.ruhulamin7963
    @md.ruhulamin7963 2 роки тому

    Think you sir. This is very helpful.

  • @sicariussss
    @sicariussss 5 років тому +2

    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 :)

  • @sagarmeena2596
    @sagarmeena2596 5 років тому

    amazing explanation

  • @michael_scarn_
    @michael_scarn_ 14 днів тому

    Thank you!!!!

  • @AyushVerma08
    @AyushVerma08 2 роки тому

    Excellent example! Keep it up.

  • @eliy5550
    @eliy5550 Рік тому

    THANKS SO MUCH

  • @FutureSmartAI
    @FutureSmartAI 8 років тому

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

  • @rmn6088
    @rmn6088 5 років тому +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.

  • @praveennandham2933
    @praveennandham2933 3 роки тому

    Really amazing explanation..

  • @vamshikrishna298
    @vamshikrishna298 6 років тому

    Good content and explanation buddy

  • @javatoyou862
    @javatoyou862 5 років тому

    great job sir

  • @BeWithNarendar
    @BeWithNarendar 2 роки тому

    PERFECT !!

  • @greentorainchannel386
    @greentorainchannel386 2 роки тому

    Nice and simple to understand 👍👍👍👍

  • @piotrboczar7967
    @piotrboczar7967 2 роки тому

    Thanks!

  • @kidslearningscience
    @kidslearningscience 8 років тому

    Good one.

  • @piraviperumal2544
    @piraviperumal2544 Рік тому +1

    Awesome

  • @mohammedviso2269
    @mohammedviso2269 8 років тому

    thank you

  • @hardikahuja5645
    @hardikahuja5645 3 роки тому

    Nice explanation bro!!!

  • @kosireddigangadhar7182
    @kosireddigangadhar7182 3 роки тому

    Super bro👍

  • @parulgupta8231
    @parulgupta8231 4 роки тому

    Nice Explanation

  • @sagarmeena0210
    @sagarmeena0210 5 років тому

    love it

  • @RetroGames1979
    @RetroGames1979 3 роки тому

    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

  • @ThePhysics1234
    @ThePhysics1234 7 років тому

    very nice

  • @biswa12
    @biswa12 4 роки тому

    Thank you

  • @kirankumarpurini2476
    @kirankumarpurini2476 6 років тому

    thanks

  • @akramladaf7817
    @akramladaf7817 3 роки тому

    Thank bhai

  • @mahinqureshi5809
    @mahinqureshi5809 2 роки тому +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 ?

  • @iamSSudheer
    @iamSSudheer 2 роки тому +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 Рік тому +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!

  • @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.

  • @AtifLightning2
    @AtifLightning2 5 років тому

    Thanks

  • @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?

  • @MegaRockandroll09
    @MegaRockandroll09 2 роки тому

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

  • @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

  • @karthican2010
    @karthican2010 4 роки тому

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

  • @muralidharang5664
    @muralidharang5664 Рік тому

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

  • @vinothKumar-ik9lu
    @vinothKumar-ik9lu 4 роки тому +1

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

  • @AspirantNoteBooks
    @AspirantNoteBooks 7 років тому

    which version of IOS you are using >??

  • @kreenu5035
    @kreenu5035 4 роки тому

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

  • @dkstudio7828
    @dkstudio7828 7 років тому +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 5 років тому

      What if we use hashmap for that ?

    • @divyeshkumarbalar7732
      @divyeshkumarbalar7732 5 років тому +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

  • @PremChougale
    @PremChougale 8 місяців тому

    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?

  • @nitinkhutemate2155
    @nitinkhutemate2155 7 років тому +57

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

    • @risteardob2095
      @risteardob2095 6 років тому +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 3 роки тому

      @@risteardob2095 what is it then?

    • @adithyarathnayake
      @adithyarathnayake Рік тому

      😂 you mean, they gonna die

  • @dulajudayanga4050
    @dulajudayanga4050 6 років тому

    thanks a lotttttttttttttttttttttttttttttttttttttttttttttttttttttttt
    Very good human in the planet

  • @meenakshisharma1870
    @meenakshisharma1870 5 років тому

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

  • @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

  • @delankoh3494
    @delankoh3494 Рік тому

    Good for cross browser testing during automation testing using java

  • @vinays8546
    @vinays8546 3 роки тому

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

  • @risteardob2095
    @risteardob2095 6 років тому +21

    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 роки тому +1

      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.

  • @VipinRawat_Offcial
    @VipinRawat_Offcial 2 роки тому

    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?

  • @vinaykumarneela4538
    @vinaykumarneela4538 6 років тому

    can u suggest me the structure of this example

  • @Studyroid
    @Studyroid 5 років тому +35

    3:44

    • @4cankursharma
      @4cankursharma 3 роки тому +1

      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

  • @abhijithss1244
    @abhijithss1244 Рік тому

    Shouldnt we implement singleton also here for maximum optimisation

  • @shreehaasans3679
    @shreehaasans3679 6 років тому

    what is that void spec called?

  • @moniljoshi1850
    @moniljoshi1850 5 років тому

    Can you please make videos on decorator and strategic design pattern

  • @ridhwaanany7480
    @ridhwaanany7480 8 років тому +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 6 років тому

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

    • @HimalayaGarg
      @HimalayaGarg 2 роки тому

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

  • @kishorthekhiladi
    @kishorthekhiladi 7 років тому

    looking for more design patterns..

  • @umabharathyts1998
    @umabharathyts1998 14 днів тому

    This is very similar to Facade Pattern! whats the difference between them ?

  • @Jaggahero
    @Jaggahero 11 місяців тому

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

  • @Detonat0r
    @Detonat0r 2 роки тому

    does this pattern violates ocp?

  • @gmmkeshav
    @gmmkeshav 8 місяців тому

    In operating system factory why didn't we import android iOS, Windows packages?

  • @Secretclaps
    @Secretclaps Рік тому

    7 years later and I am still watching it.

  • @rounakdas2633
    @rounakdas2633 Рік тому

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

  • @_xenomorph8096
    @_xenomorph8096 Рік тому

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