0% found this document useful (0 votes)
8 views2 pages

SOLID Principles in Student Management System

The document outlines a scenario-based exercise focused on applying SOLID principles to a Student Management System for a university. It identifies issues with the current design, which violates SOLID principles by having a single class manage multiple responsibilities, and provides tasks for refactoring the system to adhere to each principle. The tasks include creating separate classes for different functionalities, making the grading system extensible, ensuring substitutability of student types, splitting interfaces, and using abstraction for notification services.

Uploaded by

rvsravani2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

SOLID Principles in Student Management System

The document outlines a scenario-based exercise focused on applying SOLID principles to a Student Management System for a university. It identifies issues with the current design, which violates SOLID principles by having a single class manage multiple responsibilities, and provides tasks for refactoring the system to adhere to each principle. The tasks include creating separate classes for different functionalities, making the grading system extensible, ensuring substitutability of student types, splitting interfaces, and using abstraction for notification services.

Uploaded by

rvsravani2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Scenario-Based Exercise: Applying SOLID Principles in a Student Management System

You are designing a Student Management System for a university. The system should handle:

1. Student Records – Storing student details (name, roll number, course).

2. Attendance Management – Marking attendance for students.

3. Grade Calculation – Calculating student grades based on marks.

4. Fee Payment System – Handling student fee payments.

5. Report Generation – Generating reports for student performance and attendance.

However, the current design has a single class StudentManagement handling all these operations.
This violates SOLID principles and makes the system difficult to modify or extend.

Exercise Tasks (Applying Each SOLID Principle)

1. Single Responsibility Principle (SRP)

Problem:
The StudentManagement class handles multiple responsibilities like student details, attendance,
grades, fee payment, and reports.

Task:

 Refactor the system by separating responsibilities into different classes.

 Example: Create Student, AttendanceManager, GradeCalculator, FeeManager, and


ReportGenerator classes.

2. Open/Closed Principle (OCP)

Problem:
Currently, the grading system only supports percentage-based grading. The university now wants to
add a CGPA-based grading system.

Task:

 Modify the grading system so that new grading methods can be added without modifying
the existing code.

 Use an interface or abstract class to make the system extensible.

3. Liskov Substitution Principle (LSP)

Problem:
There are two types of students:

 Regular Students (attend classes physically)

 Online Students (attend virtual classes)


Both students should be able to mark attendance, but Online Students don’t attend in-person.

Task:

 Ensure that substituting an OnlineStudent object in place of a RegularStudent does not


break the system.

 Use an abstract class or interface to define common behavior.

4. Interface Segregation Principle (ISP)

Problem:
A StudentServices interface has methods like registerStudent(), payFees(), generateReport(), and
markAttendance().
However, some students only access online lectures and don’t need fee payment or attendance
tracking.

Task:

 Split the interface into smaller, more specific ones so that a class does not implement
methods it doesn’t need.

5. Dependency Inversion Principle (DIP)

Problem:
The StudentManagement class directly depends on EmailNotification for sending alerts.
Now, the university wants to support SMS and WhatsApp notifications.

Task:

 Use abstraction (NotificationService) so that new notification types can be added without
modifying the StudentManagement class.

You might also like