Python Programming from First Principles: Learn to Code, Think Computationally, and Solve Real-World Problems
PDFEPUB
BOOK 000 · CHAPTER 7 · Activity Diagram

Activity Diagram

An activity diagram shows a workflow. Actions use rounded rectangles; a diamond branches on a condition. The filled circle starts the workflow and the bullseye ends it.

Receive existing Student and CourseAlready enrolled in this Course object?yesnoRaise ValueErrorCreate Enrollment with grade NoneAppend same link to Student and CourseReturn Enrollment

This is the implemented Student.enroll operation. It rejects a duplicate before changing either collection. Otherwise it creates one Enrollment, records it on both sides and returns it.

Trace it: follow the diagram for a first enrollment and a repeated request. Capacity and prerequisite checks would need additional decisions and tests.

The activity view explains the decisions within enrollment; a sequence diagram will show the objects that carry out those steps.