# Drawing Structure: Class and Object Diagrams

How a design looks on paper: the classes and how they connect, then the real objects at run time, then this course's role diagrams. Sequence diagrams come at the start of Pass 2 and state diagrams with the State pattern, where they're first needed (*UML, just in time*).

Updated: November 17, 2026

## [Class Diagrams](https://www.ask-codey.com/courses/design-patterns/topics/dp-class-diagrams)

1. [Boxes: A Class on Paper](https://www.ask-codey.com/lessons/dp-class-diagram-boxes) (Novice): Code shows a design one line at a time, so teams draw it instead: each class as a box with its name, its fields and its methods, marked + for public and - for private, with an interface's box labeled as a promise.
2. [Arrows: Is-a, Has-a and Uses](https://www.ask-codey.com/lessons/dp-class-diagram-arrows) (Apprentice): Boxes alone don't say how classes connect, so a class diagram joins them with four arrows (inherits, implements, has and uses), each with its own line and arrowhead, and each one read out loud as a sentence about the design.
3. [How Many, and Who Owns It: Multiplicity and the Two Diamonds](https://www.ask-codey.com/lessons/dp-multiplicity-and-diamonds) (Apprentice): An arrow says that a rental has a rentable, but not how many or who owns it; numbers on the line (1, 0..1, \* and 1..\*) say how many, and a hollow or filled diamond says whether the part can live without the whole.

## [Objects at Run Time](https://www.ask-codey.com/courses/design-patterns/topics/dp-objects-at-run-time)

1. [Object Diagrams: A Snapshot of Real Objects](https://www.ask-codey.com/lessons/dp-object-diagrams) (Apprentice): A class diagram says what can exist; an object diagram shows what does exist at one moment, such as this Saturday's three rentals with their real values, so you can see links the class diagram only allows and catch the ones it forbids.

## [This Course's Diagrams](https://www.ask-codey.com/courses/design-patterns/topics/dp-this-courses-diagrams)

1. [Role Diagrams: How This Course Draws a Pattern](https://www.ask-codey.com/lessons/dp-role-diagrams) (Apprentice): A pattern's class diagram gives every box the same weight and hides which part changes and what calls what, so this course draws each pattern as a role diagram too: plain-word roles, numbered calls, and a dashed fence around the part that varies.
2. [Draw Your Own: Paper, Mermaid and draw.io](https://www.ask-codey.com/lessons/dp-draw-your-own-diagrams) (Apprentice): A design drawn on a whiteboard is lost by Friday, so pick the tool by the job: paper for thinking, Mermaid's text diagrams for the ones that live beside the code (GitHub and VS Code draw them for you), and draw.io for a tidy picture.

## [In Your Textbook](https://www.ask-codey.com/courses/design-patterns/topics/dp-in-your-textbook)

1. [In Your Textbook: UML](https://www.ask-codey.com/lessons/dp-uml-in-your-textbook) (Journeyman): A college class or a textbook's pattern diagram uses UML's formal words and marks (realization, stereotypes, italics for abstract, # and ~, notes), and the original pattern book used an older style; this optional lesson maps them to this chapter, and says in a paragraph each what the other UML diagrams show.

## [Exercise: Code from a Class Diagram](https://www.ask-codey.com/courses/design-patterns/topics/exercise-dp-code-from-a-diagram)

1. [Exercise: Code from a Class Diagram](https://www.ask-codey.com/lessons/exercise-dp-code-from-a-diagram) (Apprentice): Take a ticket from Riverside Library's app team: a class diagram of the library's media is agreed, and the code doesn't match it yet. Finish the classes so audiobooks are lent like books, a member holds up to five items, and giving one back makes room, with the tests green throughout.

Source: https://www.ask-codey.com/courses/design-patterns/chapters/dp-drawing-structure
