Strategy Design Pattern in Laravel and PHP

Поділитися
Вставка
  • Опубліковано 21 лип 2024
  • Learn what the strategy pattern is and how it can be implemented using PHP in Laravel.
    Socials:
    / nick_escobedo
    #strategydesignpattern #php #laravel #designpatterns #designpatternsinphp
  • Наука та технологія

КОМЕНТАРІ • 26

  • @marcosgonzales2007
    @marcosgonzales2007 5 місяців тому

    Very well explained. Thank you. I just finished reading about this in head first design patterns and wanted to see it in action.

  • @AmitGupta-cc9fk
    @AmitGupta-cc9fk 2 місяці тому +1

    I want more videos like this. This video is very useful 👌

  • @saeedrasheed3631
    @saeedrasheed3631 Рік тому +3

    Great work and great explanation it should be more practical like PayPal , Stripe and a credit/Debit Card. Thank you

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

      Thanks for your comment and watching the video! I've used this pattern before with credit, Apple Pay, and Google Pay. It can also be used for Stripe and Paypal too good suggestion.

  • @tahakhan5883
    @tahakhan5883 Рік тому +2

    Great explanation and yes im interested in more Design patterns,

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

      Awesome, I plan on creating more. Just released the factory design pattern a couple days ago.

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

    thank you so much for this type of tutorial please continue with teaching other design patterns

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

      Thank you for your kind words and support!

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

    Very useful and very simple explaines. Thanks for the content

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

      I appreciate the kind words!

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

    Really great tutorial. I loved It. I implemented in my own way after watching your video. Thanks a lot. Please make more design pattern video tutorials for Laravel. Thanks in Advance.

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

    Awesome! Thanks a lot!

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

      Thank you for the support!

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

    Nice video. What is the difference between this and the factory design pattern?

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

    Does not this violate the Open-Closed-Princiaple? Because every time a new method is added I have to go back to the constructor and add more?

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

      Exactly.. PaymentStrategyContext constructor argument should be type of PaymentMethod interface

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

    This also has a lot of similarities to the Registry Pattern, right? The Context class seems responsible for "registering" valid interface implementations. Are there any advantages or disadvantages to choosing one over the other?

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

      I think you'll find among the various patterns that they all have similarities in some way. I haven't used the registry pattern, so I'm not sure at the moment.

  • @user-sc7by4nv1f
    @user-sc7by4nv1f Рік тому

    Payment strategy context must getting object implemented payment interface and in context class need add method setNewPayment with input param payment interface, and in command we can set some strategy by default and change payment context with method setNewPayment

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

    Is this whats also called the adapter pattern and facade patten? Or is there a nuance im missing?

    • @vytautasgaldikas7588
      @vytautasgaldikas7588 Рік тому +3

      No, Facade or Adapter is something entirely different. Having said that most design patterns share some common ideas I would say

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

      Yes, completely agree. There are quite a few similarities among the design patterns, that's spot on!

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

    Context versus Factory?

  • @curiousbd8115
    @curiousbd8115 6 місяців тому

    I find no difference between factory and this pattern