Factory Method Pattern in Python: Creating Objects with Ease

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 13

  • @MrAverageViewer
    @MrAverageViewer Год назад +4

    Very nice tutorial!! I really appreciate that you presented the visual diagram first, before delved into the code. That made it much easier to grasp the overall concept and purpose. Much appreciated!!

    • @campbelltech
      @campbelltech  Год назад +1

      Thank you for the excellent feedback!

  • @szymaniuk1983
    @szymaniuk1983 8 месяцев назад +2

    sheeeet man. That was a great vid. ❤❤❤

  • @Yassou1985
    @Yassou1985 10 месяцев назад +2

    Thank you, i have watched 2 of your videos and i really appreciate them. Thanks again for making far more understandable than refactoring guru :D. Just a remark : it would had been nice if you could add a small window on right low corner that highlight the class your are coding of you UML diagram. i was a little lost after the payment package code.

    • @campbelltech
      @campbelltech  10 месяцев назад

      Thanks @Yassou1985. This is awesome feedback and motivation for us. Like your idea about showing the class diagram while coding. Thank you.

  • @manuelgilsitio
    @manuelgilsitio 5 месяцев назад +1

    Thanks, great tutorial!!!

  • @robinscooby412
    @robinscooby412 10 месяцев назад +1

    you are awesome...❤

    • @campbelltech
      @campbelltech  9 месяцев назад

      Thank you Robin, I am glad you enjoyed the video :-)

  • @adilkhatri7475
    @adilkhatri7475 6 месяцев назад

    can you add all the design pattern for python.

  • @Michallote
    @Michallote 9 месяцев назад

    What happens when I have to pass different parameters to each factory? What if my CreditCard needs additional parametets different from GooglePay or whatever

    • @campbelltech
      @campbelltech  9 месяцев назад

      Good question. I would suggest using Polymorphism to overcome this challenge. In other words, have a single parameter that is of a complex object base type. Then you can have multiple concrete classes with the specific fields that you need that extend the base class. Then you can cast the base to the concrete class in your specific implementation (which the factory returns). I hope this makes sense?