Interface-Based Notifications
Interfaces decouple the caller from a concrete delivery channel.
How it works
Send messages through interchangeable implementations.
The Notify method can accept any future implementation without changing its own code.
Runnable C# example
Program.cs
using System;
interface IChannel { void Send(string message); }
class Sms : IChannel { public void Send(string message) => Console.WriteLine($"SMS: {message}"); }
class Program
{
static void Notify(IChannel channel, string message) => channel.Send(message);
static void Main() => Notify(new Sms(), "Shipped");
}
SMS: ShippedPractice with the debugger
Set a breakpoint on an important assignment or condition, click Debug, and inspect the local values before stepping to the next line.