0
0
Software Engineeringknowledge~30 mins

Design for change and extensibility in Software Engineering - Mini Project: Build & Apply

Choose your learning style9 modes available
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 method
Add 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
1
DATA SETUP: Create the initial notifications dictionary
Create a dictionary called notifications with one entry: 'email': 'Send email notification'
Software Engineering
Hint

Use curly braces {} to create a dictionary with the key 'email' and its message.

2
CONFIGURATION: Add the default notification method
Add a variable called default_notification and set it to the string 'email'
Software Engineering
Hint

Just assign the string 'email' to the variable default_notification.

3
CORE LOGIC: Write the send_notification function
Write a function called send_notification that takes a parameter method and returns the message from the notifications dictionary for that method
Software Engineering
Hint

Use the dictionary get method to safely get the message for the given method.

4
COMPLETION: Add SMS notification to the dictionary
Add a new entry to the notifications dictionary with key 'sms' and value 'Send SMS notification'
Software Engineering
Hint

Add the new key-value pair inside the notifications dictionary.