LLD Interview Question - Design a Scalable Notification Service

By Pradyumna Chippigiri

March 11, 2026

Problem Statement

Design a simple notification system that can send messages through multiple channels such as Email, SMS, and Push notifications.


A client should be able to:

Each channel should simulate sending a message by printing something like:

Email Sent: Welcome to my service!
SMS Sent: Welcome to my service!
Push Notification Sent: Welcome to my service!

Your design should allow new notification channels (e.g., WhatsApp, Slack) to be added in the future without changing the existing system.

Solution

Since the common functionality here is to send a message, then i can implement a common interface for all the notification channels, and then implement the implementation for each channel.

Now we need to implement the interface.

public interface Notification { 
  void send(String message);
}
public class EmailService implements Notification { 
  @Override 
  public void send(String message) { 
    System.out.println("Email sent: " + message);
  }
}
 
public class SMSService implements Notification { 
  @Override 
  public void send(String message) { 
    System.out.println("SMS sent: " + message);
  }
}
 
public class PushNotificationService implements Notification {   
  @Override 
  public void send(String message) { 
    System.out.println("Push notification sent: " + message);
  }
}

Now we need to create a class that will manage the notification services, because otherwise it would become tightly coupled if we directly use the notification services in the client code.

public class NotificationService { 
private List<Notification> channels = new ArrayList<>();
 
public void addChannel(Notification channel) { 
  channels.add(channel);
}
 
public void notifyAllChannels(String message) { 
  for (Notification channel : channels) { 
    channel.send(message); 
  }
 
}
}

Now we can use the notification service in the client code.

public class Client { 
  public static void main(String[] args) { 
    NotificationService notificationService = new NotificationService();
    notificationService.addChannel(new EmailService()); 
    notificationService.addChannel(new SMSService()); 
    notificationService.addChannel(new PushNotificationService()); 
    notificationService.notifyAllChannels("Welcome to my service!");
  }
}

This gives the extensibility to add new notification channels in the future without changing the existing system. Like say if i want to add a notification channel for WhatsApp, I can just create a new class that implements the Notification interface and add it to the notification service.

public class WhatsAppService implements Notification { 
  @Override 
  public void send(String message) { 
    System.out.println("WhatsApp sent: " + message);
  }
}

Now we can add the WhatsApp service to the notification service.

public class Client { 
  public static void main(String[] args) { 
    NotificationService notificationService = new NotificationService();
    notificationService.addChannel(new WhatsAppService());
    notificationService.notifyAllChannels("Welcome to my service!");
    }
    }

Follow up question

If the number of notification channel increases, then the client code will become too complex to maintain right.


So how can we improve the design to make it more extensible?


We can use the Factory Pattern to create the notification services.

public class NotificationFactory {
    public static Notification createNotification(String type) {
        if (type.equalsIgnoreCase("email")) {
            return new EmailService();
        } else if (type.equalsIgnoreCase("sms")) {
            return new SMSService();
        } else if (type.equalsIgnoreCase("push")) {
            return new PushNotificationService();
        } else if (type.equalsIgnoreCase("whatsapp")) {
            return new WhatsAppService();
        }
 
        throw new IllegalArgumentException("Invalid notification type");
    }
}

and then the client code can use the factory to create the notification services.

public class Client { 
  public static void main(String[] args) { 
    List<String> channelTypes = Arrays.asList("email", "sms", "push", "whatsapp");
    NotificationService notificationService = new NotificationService();
    for (String type : channelTypes) {
      notificationService.addChannel(NotificationFactory.createNotification(type));
    }
    notificationService.notifyAllChannels("Welcome to my service!");
  }
}