Module 4
Case Study: Object-Oriented Programming Concepts in
Python
Title: Designing a School Management System using Python
OOP
Introduction
Overview of the Module Topic
Object-Oriented Programming (OOP) is a methodology for designing modular and
reusable software using real-world entities like classes and objects. Python supports all
OOP principles such as encapsulation, inheritance, polymorphism, and abstraction. These
principles simplify software design and development, especially for systems that grow in
complexity.
Relevance of the Case Study
- Helps in structuring large systems logically
- Encourages code reuse and maintenance
- Suitable for modeling real-life entities such as students, teachers, and subjects
Case Description
Brief on the Case Context
A school wants to digitize its management system. It needs to maintain records for
students, teachers, and their assigned courses. The school also wants to provide role-
specific access and functions, such as grading by teachers and course registration by
students.
Main Issues Highlighted
- Lack of modularity in the current procedural design
- Code duplication across different entities
- Difficulty in maintaining and extending the system
Analysis
Python can implement all core OOP concepts to solve these issues in the school
management system.
Encapsulation Example:
CASE STUDY 1
class Student:
def __init__(self, name, grade):
self.name = name
self.__grade = grade # private attribute
def get_grade(self):
return self.__grade
Inheritance Example:
class Person:
def __init__(self, name):
self.name = name
class Teacher(Person):
def assign_grade(self):
print(f"{self.name} assigns grades.")
Polymorphism Example:
class Student:
def role(self):
print("Student attends classes.")
class Teacher:
def role(self):
print("Teacher conducts classes.")
def show_role(person):
person.role()
Abstraction Example:
from abc import ABC, abstractmethod
class User(ABC):
@abstractmethod
def access(self):
pass
CASE STUDY 2
class Admin(User):
def access(self):
print("Admin access granted.")
Findings
- OOP reduces redundancy and improves code clarity
- Easier maintenance and expansion (e.g., adding roles like librarian)
- Real-world entities are easily modeled with classes and objects
Recommendations
1. Business Strategy Recommendations:
Use OOP design for any future systems to reduce maintenance overhead and support
scalability.
2. Technical Improvements:
- Modularize user roles with base classes and inheritance
- Encapsulate sensitive data like grades or personal info
3. Future Enhancements:
- Add login systems and dashboards using Flask/Django
- Store class objects in JSON or databases for persistence
Conclusion
Python provides robust support for implementing object-oriented designs. These features
enable developers to build real-world systems that are structured, scalable, and easy to
manage.
Implications
- Class-based design promotes team collaboration
- OOP structures map directly to real-world scenarios
- Enables flexible and maintainable codebase for institutions
References Used
- https://docs.python.org/3/tutorial/classes.html
- https://realpython.com/python3-object-oriented-programming/
- https://www.geeksforgeeks.org/python-oops-concepts/
CASE STUDY 3