Blame
|
1 | > **DRAFT** — under teacher review. |
||||||
| 2 | ||||||||
| 3 | # Object Descriptions and Class Diagrams |
|||||||
| 4 | ||||||||
| 5 | The Hamilton and Alexandra College · Year 12 · 2026 |
|||||||
| 6 | ||||||||
| 7 | If your solution uses **objects and classes**, the fifth design tool is the **object description**. VCAA defines it as a tool that *"describes all of the relevant properties, methods and events in an object or class."* A **class diagram** is the standard way to draw a whole set of object descriptions at once and show how the classes relate. |
|||||||
| 8 | ||||||||
| 9 | This is a **Level 7+** tool in C5-1, and at **Level 9** you are also expected to write pseudocode for the methods inside your classes. |
|||||||
| 10 | ||||||||
| 11 | > [!NOTE] |
|||||||
| 12 | > **Only if you use OOP.** If your solution genuinely does not use classes and objects, you do not need object descriptions. But most SAT projects of any real size have at least a few classes — and a class diagram is the clearest way to show them. |
|||||||
| 13 | ||||||||
| 14 | --- |
|||||||
| 15 | ||||||||
| 16 | ## Reading a class diagram |
|||||||
| 17 | ||||||||
| 18 | Each box is a **class**. The top section lists its **attributes** (properties), the bottom section lists its **methods** (actions), and the arrows show **relationships** between classes. |
|||||||
| 19 | ||||||||
| 20 | ```mermaid |
|||||||
| 21 | --- |
|||||||
| 22 | title: Animal example |
|||||||
| 23 | --- |
|||||||
| 24 | classDiagram |
|||||||
| 25 | note "From Duck till Zebra" |
|||||||
| 26 | Animal <|-- Duck |
|||||||
| 27 | note for Duck "can fly<br>can swim<br>can dive<br>can help in debugging" |
|||||||
| 28 | Animal <|-- Fish |
|||||||
| 29 | Animal <|-- Zebra |
|||||||
| 30 | Animal : +int age |
|||||||
| 31 | Animal : +String gender |
|||||||
| 32 | Animal: +isMammal() |
|||||||
| 33 | Animal: +mate() |
|||||||
| 34 | class Duck{ |
|||||||
| 35 | +String beakColor |
|||||||
| 36 | +swim() |
|||||||
| 37 | +quack() |
|||||||
| 38 | } |
|||||||
| 39 | class Fish{ |
|||||||
| 40 | -int sizeInFeet |
|||||||
| 41 | -canEat() |
|||||||
| 42 | } |
|||||||
| 43 | class Zebra{ |
|||||||
| 44 | +bool is_wild |
|||||||
| 45 | +run() |
|||||||
| 46 | } |
|||||||
| 47 | ``` |
|||||||
| 48 | ||||||||
| 49 | Read it like this: `Animal` is the **base class**. `Duck`, `Fish` and `Zebra` are all *a kind of* Animal, so each one **inherits** Animal's attributes (`age`, `gender`) and methods (`isMammal()`, `mate()`) and then adds its own. `Duck` adds `beakColor`, `swim()` and `quack()`; it doesn't have to redefine `age` because it already has it from `Animal`. |
|||||||
| 50 | ||||||||
| 51 | --- |
|||||||
| 52 | ||||||||
| 53 | ## The notation you need |
|||||||
| 54 | ||||||||
| 55 | | Symbol | Meaning | |
|||||||
| 56 | |---|---| |
|||||||
| 57 | | `+` | **Public** — usable from outside the class | |
|||||||
| 58 | | `-` | **Private** — usable only inside the class | |
|||||||
| 59 | | `age : int` | An **attribute** and its **data type** | |
|||||||
| 60 | | `isMammal()` | A **method** (an action the object can perform) | |
|||||||
| 61 | | `isUpcoming() : bool` | A method and its **return type** | |
|||||||
|
62 | |||||||
| 63 | **Relationships** are shown with arrows between classes. The inheritance arrow `<|--` means *"is a kind of"* — writing `Animal <|-- Duck` says **Duck is a kind of Animal**, so Duck inherits all of Animal's attributes and methods and then adds its own. (Two others you may meet: *composition* `*--`, "is made of", and *association* `-->`, "uses".) |
|||||||
|
64 | |||||||
| 65 | > [!TIP] |
|||||||
| 66 | > Every attribute should have a **data type** and every method should show its **parameters and return type**. "`age`" alone is weak; "`+ age : int`" is design-ready. This is exactly the precision that lifts C5-1 from the middle bands into 7–9. |
|||||||
| 67 | ||||||||
| 68 | --- |
|||||||
| 69 | ||||||||
|
70 | ## Object descriptions — the written form |
||||||
| 71 | ||||||||
| 72 | A class diagram is the *picture*. An **object description** is the *written* version of the same information: a small table, one per class, listing each property and method (and, for interface objects, each event). VCAA accepts either form — most folios use both, the diagram for the overview and object descriptions for the detail. |
|||||||
| 73 | ||||||||
| 74 | The video below builds two worked examples in a game engine. Watch how each class is captured by its properties and methods — and notice the idea of an **abstract class**: a base class that exists only as a *template* for others to inherit from, and is never created on its own (exactly like `Animal` in the diagram above — you never make a plain "Animal", only a Duck or a Dog). |
|||||||
| 75 | ||||||||
| 76 | **🎯 Watch for:** two class families — `Animal → Dog`, and a `Skill` made of `SkillEffect`s — and how the base class declares a method that each child class then fills in. |
|||||||
| 77 | ||||||||
| 78 | {{Video|src=https://www.youtube.com/watch?v=h21Lmg4o1Ks}} |
|||||||
| 79 | ||||||||
| 80 | > [!NOTE] |
|||||||
| 81 | > This is a Godot (game-engine) tutorial, so the code is GDScript — but the *object-description skill* is identical to what VCAA asks for. Read it for the structure, not the language. |
|||||||
| 82 | ||||||||
| 83 | ### Example 1 — Animal and Dog |
|||||||
| 84 | ||||||||
| 85 | **`Animal`** — an abstract base class (a template; never created on its own) |
|||||||
| 86 | ||||||||
| 87 | | Member | Kind | Returns / type | Description | |
|||||||
| 88 | |---|---|---|---| |
|||||||
| 89 | | `make_sound()` | Method (abstract) | `void` | The sound the animal makes. Declared here but **not** implemented — every subclass must define its own. | |
|||||||
| 90 | ||||||||
| 91 | **`Dog`** — extends `Animal` |
|||||||
| 92 | ||||||||
| 93 | | Member | Kind | Returns / type | Description | |
|||||||
| 94 | |---|---|---|---| |
|||||||
| 95 | | `make_sound()` | Method (override) | `void` | Implements the abstract method — outputs "woof". | |
|||||||
| 96 | ||||||||
| 97 | ### Example 2 — a Skill made of effects ("object descriptions about skills") |
|||||||
| 98 | ||||||||
| 99 | A `Skill` (think turn-based RPG) holds a list of effects. When you activate it, it loops through those effects and applies each one. The effects share an abstract base, `SkillEffect`, so new effects can be added without ever changing the `Skill` class. |
|||||||
| 100 | ||||||||
| 101 | **`Skill`** |
|||||||
| 102 | ||||||||
| 103 | | Member | Kind | Returns / type | Description | |
|||||||
| 104 | |---|---|---|---| |
|||||||
| 105 | | `effects` | Property | array of `SkillEffect` | The effects this skill applies. | |
|||||||
| 106 | | `activate(target)` | Method | `void` | Loops through `effects` and applies each one to the target. | |
|||||||
| 107 | ||||||||
| 108 | **`SkillEffect`** — abstract base class (template only) |
|||||||
| 109 | ||||||||
| 110 | | Member | Kind | Returns / type | Description | |
|||||||
| 111 | |---|---|---|---| |
|||||||
| 112 | | `apply(target)` | Method (abstract) | `void` | Applies this effect to the target. Each concrete effect defines its own. | |
|||||||
| 113 | ||||||||
| 114 | **`ApplyDamage`** — extends `SkillEffect` |
|||||||
| 115 | ||||||||
| 116 | | Member | Kind | Returns / type | Description | |
|||||||
| 117 | |---|---|---|---| |
|||||||
| 118 | | `damage_amount` | Property | `int` | How much damage to deal. | |
|||||||
| 119 | | `apply(target)` | Method (override) | `void` | Subtracts `damage_amount` from the target's health. | |
|||||||
| 120 | ||||||||
| 121 | > [!TIP] |
|||||||
| 122 | > The same pattern runs through both examples: a **base class declares a method** (`make_sound`, `apply`) and each **child class fills it in**. Showing that in your object descriptions — the shared method on the parent, the specific version on each child — is exactly the inheritance evidence that scores at the top of C5-1. |
|||||||
| 123 | ||||||||
| 124 | --- |
|||||||
| 125 | ||||||||
|
126 | ## Properties, methods — *and events* |
||||||
| 127 | ||||||||
| 128 | A class diagram shows properties and methods well. But VCAA object descriptions also include **events** — especially for **GUI objects** (buttons, text fields, menus). An event is something the object *responds to*, like a click. |
|||||||
| 129 | ||||||||
| 130 | For a login button you might describe the object like this: |
|||||||
| 131 | ||||||||
| 132 | | Aspect | Example for `btnLogin` (a button) | |
|||||||
| 133 | |---|---| |
|||||||
| 134 | | **Properties** | `caption` = "Log in", `enabled` = true | |
|||||||
| 135 | | **Methods** | `setEnabled(state)` | |
|||||||
| 136 | | **Events** | `onClick` → runs the *Validate User* process | |
|||||||
| 137 | ||||||||
| 138 | So: the class diagram carries your properties and methods; for interface objects, add a short note or table documenting the **events** as well. |
|||||||
| 139 | ||||||||
| 140 | --- |
|||||||
| 141 | ||||||||
| 142 | ## How it connects to your other design tools |
|||||||
| 143 | ||||||||
| 144 | The object description is not an island — it ties the whole detailed design together: |
|||||||
| 145 | ||||||||
|
146 | - **Properties ↔ data dictionary.** Every attribute is a field. `studentID : int` becomes a data-dictionary row with a type, size and format. See [Data Dictionary](/sd/C05/Data%20Dictionary). |
||||||
|
147 | - **Methods ↔ pseudocode.** At Level 9 you write pseudocode for each method. The `is_passing()` example on the pseudocode page is exactly a method from a class diagram, written out. See [VCAA Pseudocode — Not Python](/sd/C05/VCAA%20Pseudocode%20Not%20Python). |
||||||
| 148 | - **Classes ↔ mock-ups and IPO charts.** The objects are what sit *behind* your screens and processes. |
|||||||
| 149 | ||||||||
| 150 | --- |
|||||||
| 151 | ||||||||
| 152 | ## Common mistakes |
|||||||
| 153 | ||||||||
| 154 | ### Mistake 1: An object description with no methods |
|||||||
| 155 | ||||||||
| 156 | > ~~A box listing only attributes~~ |
|||||||
| 157 | ||||||||
| 158 | That is just a data dictionary in disguise. An object description must include the **methods** (and, for GUI objects, the **events**) — that is what makes it an *object*. |
|||||||
| 159 | ||||||||
| 160 | ### Mistake 2: No visibility or data types |
|||||||
| 161 | ||||||||
| 162 | > ~~`beakColor`, `swim`~~ |
|||||||
| 163 | ||||||||
| 164 | Show whether each member is public (`+`) or private (`-`), give every attribute a **type**, and give every method its **parameters and return type**. |
|||||||
| 165 | ||||||||
| 166 | ### Mistake 3: Classes drawn with no relationships |
|||||||
| 167 | ||||||||
| 168 | If `Teacher` is a kind of `Student`, draw the inheritance arrow. A diagram of disconnected boxes hides the design thinking the arrows are meant to show. |
|||||||
| 169 | ||||||||
| 170 | ### Mistake 4 (Level 9): A class diagram but no method pseudocode |
|||||||
| 171 | ||||||||
| 172 | At Level 9 the methods in your diagram must be backed by pseudocode. A diagram on its own caps you below the top band. |
|||||||
| 173 | ||||||||
| 174 | --- |
|||||||
| 175 | ||||||||
| 176 | ## Check Your Understanding |
|||||||
| 177 | ||||||||
| 178 | 1. In the Animal diagram, name two things `Duck` inherits from `Animal`, and one thing `Duck` adds of its own. |
|||||||
| 179 | ||||||||
| 180 | >| **Inherits** (any two): `age`, `gender`, `isMammal()`, `mate()`. **Adds** (any one): `beakColor`, `swim()`, `quack()`. |
|||||||
| 181 | ||||||||
| 182 | 2. What do `+` and `-` mean in front of an attribute or method? |
|||||||
| 183 | ||||||||
| 184 | >| `+` means **public** (accessible from outside the class); `-` means **private** (accessible only inside the class). |
|||||||
| 185 | ||||||||
| 186 | 3. Which design tool turns the *methods* in your class diagram into step-by-step logic — and at which level is it required? |
|||||||
| 187 | ||||||||
| 188 | >| **Pseudocode**, required at **Level 9** (pseudocode for the functions and methods within your classes). See [VCAA Pseudocode — Not Python](/sd/C05/VCAA%20Pseudocode%20Not%20Python). |
|||||||
| 189 | ||||||||
| 190 | --- |
|||||||
| 191 | ||||||||
| 192 | ## Credits |
|||||||
| 193 | ||||||||
| 194 | - Class-diagram example adapted from the [Mermaid](https://mermaid.js.org/) documentation's *Animal* sample. |
|||||||
| 195 | ||||||||
| 196 | --- |
|||||||
| 197 | ||||||||
| 198 | ## See also |
|||||||
| 199 | ||||||||
| 200 | - [VCAA Pseudocode — Not Python](/sd/C05/VCAA%20Pseudocode%20Not%20Python) — write the pseudocode for each method (Level 9) |
|||||||
|
201 | - [Data Dictionary](/sd/C05/Data%20Dictionary) — each attribute is a data-dictionary field |
||||||
|
202 | - [Sketch vs Mock-up](/sd/C05/Sketch%20vs%20Mock-up) |
||||||
| 203 | - [C05 Resources](/sd/Resources/C05-Resources) |
|||||||
| 204 | ||||||||
| 205 | ← Back to [C05 Home](/sd/C05/C05-home) · [VCE Software Development Hub](/sd/VCE%20Software%20Development%20Hub) |
|||||||
