222.3 Class diagram and CRC cards
This section presents a system-level view of the app design using a class diagram and CRC cards to define class responsibilities and interactions.
Class diagram
The class diagram shows the relationship between the Task
and TaskManager
classes. It outlines their attributes and methods, giving a high-level overview of the object-oriented structure before implementation begins.
+---------------------+
| Task |
+---------------------+
| - title |
| - description |
| - due_date |
| - is_complete |
+---------------------+
| + mark_complete() |
| + mark_incomplete() |
| + display_summary() |
| + display_details() |
+---------------------+
used by
+-----------------------------+
| TaskManager |
+-----------------------------+
| - tasks (list of Task) |
+-----------------------------+
| + add_task() |
| + list_tasks() |
| + find_task() |
| + remove_task() |
| + display_all_tasks() |
| + get_incomplete_tasks() |
| + get_completed_tasks() |
+-----------------------------+
CRC cards
CRC stands for Class–Responsibility–Collaborator. These cards serve as a planning tool to describe what each class is responsible for and with which other classes it interacts. Below are the CRC cards for this project.
Task
Responsibilities
Store task data
Report task details
Update completion status
Collaborators
TaskManager (calls methods on Task objects)
TaskManager
Responsibilities
Store and manage a list of Task objects
Add, find, and remove tasks
Display lists of tasks based on user input
Collaborators
Task (instantiates and manages instances)
Notes on object interaction
The TaskManager
acts as the controller, maintaining a list of Task
objects and calling their methods as needed. This design keeps individual tasks simple and modular, while allowing the manager class to coordinate complex behaviours.
Last updated
Was this helpful?