Course Code: CS-202
Credit Hours: 3 (2-1)
Course Level: Undergraduate
Prerequisite: Programming Fundamentals
Course Description
This course introduces the principles of object-oriented programming (OOP) using Python. It covers key concepts such as classes, objects, inheritance, polymorphism, abstraction, and exception handling. Students will gain practical experience in designing and implementing software solutions using Python’s object-oriented capabilities.
Course Learning Outcomes (CLOs)
By the end of the course, students will be able to:
- Understand the principles of object-oriented programming in Python and their importance in software development.
- Design and implement Python classes and objects to model real-world problems.
- Apply inheritance, polymorphism, and abstraction to develop reusable and maintainable Python code.
- Use advanced OOP concepts such as exception handling, file I/O, and design patterns in Python.
Weekly Course Outline
Week 1: Introduction to Object-Oriented Programming
Topics:
- Overview of programming paradigms.
- Introduction to OOP in Python.
- Comparison with procedural programming.
Lab Activity: Write simple Python programs demonstrating OOP concepts like objects and classes.
Week 2: Classes and Objects
Topics:
- Defining classes and creating objects in Python.
- Constructors (
__init__
) and destructors (__del__
). - Access modifiers (public, protected, private) in Python.
Assignment: Implement a class to model a real-world entity (e.g., a bank account) in Python.
Week 3: Encapsulation and Data Hiding
Topics:
- Encapsulation in Python and its benefits.
- Getters and setters using property decorators.
- Data hiding with private attributes (
__attribute
).
Lab Activity: Create a Python class with private attributes and public getter/setter methods.
Week 4: Inheritance
Topics:
- Concept of inheritance and its types in Python.
- Base and derived classes.
- Method overriding using
super()
.
Assignment: Develop a Python program demonstrating single and multilevel inheritance.
Week 5: Polymorphism (Part 1)
Topics:
- Compile-time polymorphism (method overloading) using default arguments.
- Constructor overloading in Python.
Lab Activity: Implement method and constructor overloading in a Python class.
Week 6: Polymorphism (Part 2)
Topics:
- Runtime polymorphism (method overriding).
- Dynamic method dispatch.
Quiz: Differences between compile-time and runtime polymorphism in Python.
Week 7: Abstraction and Interfaces
Topics:
- Abstract classes and methods using
abc
module. - Interfaces in Python using abstract base classes.
- Differences between abstract classes and interfaces.
Assignment: Create an abstract class in Python and implement it in derived classes.
Week 8: Association, Aggregation, and Composition
Topics:
- Relationships between classes in Python.
- Examples of association, aggregation, and composition.
Lab Activity: Implement a Python program with aggregation and composition relationships.
Week 9: Midterm Examination
Week 10: Exception Handling
Topics:
- Types of exceptions in Python.
try
,except
,finally
blocks.- Raising and handling custom exceptions.
Assignment: Develop a Python program to handle file input/output exceptions.
Week 11: File Handling in OOP
Topics:
- File input/output operations in Python.
- Reading from and writing to files using OOP.
- Serialization and deserialization using
pickle
.
Lab Activity: Create a Python program to read/write student records from/to a file.
Week 12: Collections and Generics
Topics:
- Introduction to collections (
list
,tuple
,set
,dict
). - Generics in Python using type hints.
- Iterating through collections with
for
loops.
Quiz: Concepts of collections and their usage in Python.
Week 13: GUI Programming (Optional)
Topics:
- Basics of GUI programming with Tkinter.
- Event-driven programming in Python.
Class Activity: Create a simple GUI application in Python (e.g., a calculator).
Week 14: Introduction to Design Patterns
Topics:
- Importance of design patterns in OOP.
- Common design patterns: Singleton, Factory, Observer in Python.
Assignment: Implement the Singleton design pattern in Python.
Week 15: Advanced Topics and Project Work
Topics:
- Review of advanced OOP concepts in Python.
- Best practices in Python OOP.
Class Activity: Begin final project presentations.
Week 16: Final Project Submission and Review
Topics:
- Final project submission and demonstration.
- Comprehensive review of course topics.
Teaching Methodology
- Interactive lectures with Python code demonstrations.
- Hands-on lab sessions using Jupyter Notebook or PyCharm.
- Group discussions and problem-solving activities.
- Assignments and quizzes for continuous assessment.
Assessment Criteria
- Class Participation: 10%
- Assignments: 20%
- Quizzes: 10%
- Lab Work: 20%
- Midterm Examination: 20%
- Final Project and Examination: 20%
Recommended Reading
- Lutz, M. — Learning Python (O’Reilly).
- Guttag, J. — Introduction to Computation and Programming Using Python.
- Sweigart, A. — Automate the Boring Stuff with Python.
- Deitel, P., & Deitel, H. — Python for Programmers.