• abhibeckert@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago
    class SendVerificationEmail extends Notification {}
    class SendAnnouncementFCM extends Notification {}
    class SendOtpSMS extends Notification {}
    

    What’s the point of those three classes? Why wouldn’t you just use Notification directly?

    • Mac@programming.devOP
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      1 year ago

      In the given example they don’t make much sense but I assume they’ve done that in case they want them to be extended with new behaviour for certain ones separate from their strategy pattern section in the future

      • abhibeckert@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Yeah I assume the same, but I’d really like to see a concrete example of that being done instead of having to guess (as someone who has never used the Strategy Design Pattern).