Design for Change and Extensibility
📖 Scenario: You are working on a simple software system that manages notifications for users. The system currently supports only email notifications, but you want to prepare it so that it can easily add other notification types like SMS or push notifications in the future.
🎯 Goal: Build a basic design structure that supports easy addition of new notification types without changing existing code. You will create a simple setup, add a configuration variable, implement the core logic to send notifications, and complete the design to allow future extensibility.
📋 What You'll Learn
Create a dictionary called
notifications with one entry: 'email': 'Send email notification'Add a variable called
default_notification set to 'email'Write a function called
send_notification that takes a method parameter and returns the message from notifications for that methodAdd a new notification type
'sms' with the message 'Send SMS notification' to the notifications dictionary💡 Why This Matters
🌍 Real World
Designing software that can easily adapt to new requirements, like adding new notification channels without rewriting existing code.
💼 Career
Software engineers often need to write code that is easy to maintain and extend. This project teaches a basic approach to achieve that.
Progress0 / 4 steps