Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Language: c#
Tool: VS2017

I create a complaint view for the user and now I want to notify the user with email. And this notification, I want to do it by design pattern way. But I don't know which pattern is useful to notify the user.

Also, I have another service which is sms service.

Any suggestion, seriously considered.

Thank you.

What I have tried:

Design Patterns - Wikipedia[^]
Posted
Updated 2-Sep-19 9:23am
v3
Comments
Richard MacCutchan 2-Sep-19 4:34am    
Why do you think a design pattern is needed just to send an email?

A design pattern is a construction (a tool) which aims at solving a specific issue/requirement. You choose a design pattern because it solves the issue/requirement, not the other way around.
Saying "I want to use a design pattern" is a misconception of what a design pattern is. That would be like saying "I want to cook a cake; which screwdriver would be best for that?"
 
Share this answer
 
To get the solution of notifications,
You can choose Strategy pattern or Observer.
Observer will keep your solution loosely coupled and provide a way to automatically notify to subscriber.
Whereas using Strategy pattern you can define notification strategy based on context ie email in you case.

For Observer implementation you can have a look of following article:
Behavioral Design Patterns: Observer Design Pattern[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900