Which principle is violated?
The situation
A system sends notifications. The current code:
java
class NotificationService {
void send(String type, String to, String body) {
if (type.equals("email")) {
// 20 lines of SMTP
} else if (type.equals("sms")) {
// 15 lines of gateway calls
} else if (type.equals("push")) {
// 25 lines of device tokens
}
}
}
Marketing now wants WhatsApp notifications, and the team keeps breaking SMS while adding things.
Which SOLID principle does this code most clearly break?