Python Course Design Note 18 of 52
Classes and Objects
Chapter11
Task Name - Classes and Objects
Task Overview
- Understand the concept of object-oriented programming
- Understand what happens when a class is defined and when an object is created
Community Topic
Why does object-oriented programming in Python improve efficiency?
Details
Object-oriented programming calls for a god’s-eye way of thinking
Check-in Requirements
- What is object-oriented programming?
- Should every program be designed in an object-oriented way? Why?
- What is an object? What is a class?
- In procedural programming, when we think about a solution, we analyze which steps are needed to complete the task and in what order to write them; in object-oriented programming we shift from being the operator to being the commander. What do we think about first?
- A class usually contains variables and functions. What does each of them describe?
- What happens when a class is defined? What happens when an object is created?
- Programming exercise:
Student grade management system
1. View all of a student's grades by name
2. View everyone's grades in a given subject
3. View the overall average score
4. View a given student's grade in a given subject
5. Delete a student's information by name
Enhanced version requirements (optional)
1. First write a data file in JSON format whose content is the students
2. Parse the JSON data, convert it into student objects, and then perform create, delete, update and query operations