Is there a good design pattern for this messaging class?
- by salonMonsters
Is there a good design pattern for this?
I want to create a messaging class.
The class will be passed:
the type of message (eg. signup, signup confirmation, password reminder etc)
the client's id
The class needs to then look up the client's messaging preferences in the db (whether they want communication by email, sms or both)
Then depending on the client's preference it will format the message for the medium (short version for sms, long form for email) and send it through our mail or sms provider's API.
Because the fact that we want to be able to change out email and sms providers if need be I wondered if the Command Pattern would be a good choice.