Decorator Solution
To solve this problem, we'll need to create special classes called decorators (which look like Russian Matryoshka dolls, because they wrap each other) and the Notifier interface which will describe only one method - Send(msg string) error. All the notifiers and decorators must implement this interface.
For example, we want to send a notification via phone + facebook:
- We create PhoneNotifier instance
- We pass this instance to FacebookDecorator constructor
- We execute the job.
The program will call successively the decorator's Send() method, which fires the facebook notification, and then will proceed to the phone notifier's Send() method, which sends the notification via phone.