this post was submitted on 16 Nov 2023
6 points (100.0% liked)

PHP

548 readers
1 users here now

Welcome to /c/php! This is a community for PHP developers and enthusiasts to share and discuss anything related to PHP. From the latest updates and tutorials, to your burning questions and amazing personal projects, we welcome all contributions.

Let's foster an environment of respect, learning, and mutual growth. Whether you're an experienced PHP developer, a beginner, or just interested in learning more about PHP, we're glad to have you here!

Let's code, learn, and grow together!

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 year ago (2 children)
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 1 points 1 year ago* (last edited 1 year ago) (1 children)

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

[–] [email protected] 1 points 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).