0.4.11 Modeling Information Storage With an Activity Diagram

Model Saving and Loading a Soccer Note

A coach edits a training note on screen. The note can exist in working memory before it is saved. If the application closes first, those unsaved edits can be lost.

An activity diagram is useful here because saving and loading are actions in a process. A class diagram can describe the note's fields, but cannot by itself establish whether a save has occurred.

Separate Editing from Persistent Storage
Coach edits and chooses Save. Application requests a file write. Successful storage permits a saved confirmation; failure produces an error instead.
Save success and failure have different outcomes
  • New
  • Changed
  • Removed

The partitions identify responsibility. The coach chooses Save; the application requests the write; storage either succeeds or fails. A saved confirmation belongs only after success. A file write request alone is not evidence that the file changed.

Loading Moves Information Back into the Application
Choose a file, test whether it can be read, load stored text into working memory and display it, or explain failure.
Loading reads a persistent copy
  • New
  • Changed
  • Removed

Saving copies selected current information outward to persistent storage. Loading reads stored information inward. Neither operation needs to be modeled as destroying the other copy. If a later save overwrites the file, the diagram should make that overwrite rule clear.

Test the Boundary