UML Class Diagram Tests

1. Shared-Target Inheritance

Detailed description

UML class diagram with 3 classes (Animal, Dog, Cat). Dog extends Animal. Cat extends Animal.

Classes

  • Animal — Attributes: public name: str — Operations: public speak()
  • Dog — Attributes: public breed: str — Operations: public fetch(item: str)
  • Cat — Attributes: public indoor: bool — Operations: public purr()

Relationships

  • Dog extends Animal
  • Cat extends Animal

2. Interface Realization (Dashed Arrows)

Detailed description

UML class diagram with 2 classes (Circle, Rectangle), 1 interface (Drawable). Circle implements Drawable. Rectangle implements Drawable.

Classes

  • Circle — Attributes: private radius: double — Operations: public draw()
  • Rectangle — Attributes: private width: double; private height: double — Operations: public draw()

Interfaces

  • Drawable — Attributes: none declared — Operations: public draw()

Relationships

  • Circle implements Drawable
  • Rectangle implements Drawable

3. All Relationship Types

Detailed description

UML class diagram with 4 classes (Rectangle, Color, Canvas, Logger), 1 abstract class (Shape). Rectangle extends Shape. Shape composes Color. Shape aggregates Canvas. Canvas depends on Logger labeled "uses".

Classes

  • Rectangle — Attributes: private width: int; private length: int — Operations: public setWidth(width: int); public setHeight(height: int)
  • Color — Attributes: private r: int; private g: int; private b: int — Operations: none declared
  • Canvas — Attributes: none declared — Operations: public render()
  • Logger — Attributes: none declared — Operations: public log(msg: str)

Abstract classes

  • Shape — Attributes: private color: int — Operations: public area(): double (abstract); public setColor(r: int, g: int, b: int)

Relationships

  • Rectangle extends Shape
  • Shape composes Color
  • Shape aggregates Canvas
  • Canvas depends on Logger labeled "uses"

4. Multiplicities and Labels

Detailed description

UML class diagram with 3 classes (University, Professor, Student). University is associated with Professor with multiplicity one to many labeled "employs". Professor is associated with Student with multiplicity one to many labeled "advises".

Classes

  • University — Attributes: public name: str — Operations: none declared
  • Professor — Attributes: public name: str; public department: str — Operations: none declared
  • Student — Attributes: public name: str; public id: int — Operations: none declared

Relationships

  • University is associated with Professor with multiplicity one to many labeled "employs"
  • Professor is associated with Student with multiplicity one to many labeled "advises"

4b. Navigability Combinations (Association / Aggregation / Composition)

Detailed description

UML class diagram with 16 classes (AssocUnspecified, AssocNavigable, AssocBidirectional, AssocNonNavigable, AssocNonNavigableBoth, AssocTarget, AggUnspecified, AggNavigable, AggBidirectional, AggNonNavigable, AggTarget, CompUnspecified, CompNavigable, CompBidirectional, CompNonNavigable, CompTarget). AssocUnspecified is associated with AssocTarget labeled "association (unspecified)". AssocNavigable references AssocTarget labeled "association (navigable)". AssocBidirectional and AssocTarget reference each other labeled "association (bidirectional)". AssocNonNavigable has a non-navigable association with AssocTarget labeled "association (non-navigable)". AssocNonNavigableBoth and AssocTarget have a non-navigable association labeled "association (non-navigable both ends)". AggUnspecified aggregates AggTarget labeled "aggregation (unspecified)". CompUnspecified composes CompTarget labeled "composition (unspecified)".

Classes

  • AssocUnspecified — Attributes: none declared — Operations: none declared
  • AssocNavigable — Attributes: none declared — Operations: none declared
  • AssocBidirectional — Attributes: none declared — Operations: none declared
  • AssocNonNavigable — Attributes: none declared — Operations: none declared
  • AssocNonNavigableBoth — Attributes: none declared — Operations: none declared
  • AssocTarget — Attributes: none declared — Operations: none declared
  • AggUnspecified — Attributes: none declared — Operations: none declared
  • AggNavigable — Attributes: none declared — Operations: none declared
  • AggBidirectional — Attributes: none declared — Operations: none declared
  • AggNonNavigable — Attributes: none declared — Operations: none declared
  • AggTarget — Attributes: none declared — Operations: none declared
  • CompUnspecified — Attributes: none declared — Operations: none declared
  • CompNavigable — Attributes: none declared — Operations: none declared
  • CompBidirectional — Attributes: none declared — Operations: none declared
  • CompNonNavigable — Attributes: none declared — Operations: none declared
  • CompTarget — Attributes: none declared — Operations: none declared

Relationships

  • AssocUnspecified is associated with AssocTarget labeled "association (unspecified)"
  • AssocNavigable references AssocTarget labeled "association (navigable)"
  • AssocBidirectional and AssocTarget reference each other labeled "association (bidirectional)"
  • AssocNonNavigable has a non-navigable association with AssocTarget labeled "association (non-navigable)"
  • AssocNonNavigableBoth and AssocTarget have a non-navigable association labeled "association (non-navigable both ends)"
  • AggUnspecified aggregates AggTarget labeled "aggregation (unspecified)"
  • CompUnspecified composes CompTarget labeled "composition (unspecified)"

4c. Reverse-Direction Navigability (Explicit)

Detailed description

UML class diagram with 12 classes (AssocL, AssocR, AssocL2, AssocR2, AggL, AggR, AggL2, AggR2, CompL, CompR, CompL2, CompR2). AssocR references AssocL labeled "association (navigable to left)". AssocL2 has a non-navigable association with AssocR2 labeled "association (non-navigable to left)".

Classes

  • AssocL — Attributes: none declared — Operations: none declared
  • AssocR — Attributes: none declared — Operations: none declared
  • AssocL2 — Attributes: none declared — Operations: none declared
  • AssocR2 — Attributes: none declared — Operations: none declared
  • AggL — Attributes: none declared — Operations: none declared
  • AggR — Attributes: none declared — Operations: none declared
  • AggL2 — Attributes: none declared — Operations: none declared
  • AggR2 — Attributes: none declared — Operations: none declared
  • CompL — Attributes: none declared — Operations: none declared
  • CompR — Attributes: none declared — Operations: none declared
  • CompL2 — Attributes: none declared — Operations: none declared
  • CompR2 — Attributes: none declared — Operations: none declared

Relationships

  • AssocR references AssocL labeled "association (navigable to left)"
  • AssocL2 has a non-navigable association with AssocR2 labeled "association (non-navigable to left)"

4d. Tolerant Alias Forms

Detailed description

UML class diagram with 3 classes (Alias1, Alias2, Alias3).

Classes

  • Alias1 — Attributes: none declared — Operations: none declared
  • Alias2 — Attributes: none declared — Operations: none declared
  • Alias3 — Attributes: none declared — Operations: none declared

5. Observer Design Pattern

Detailed description

UML class diagram with 3 classes (ConcreteSubject, ConcreteObserverA, ConcreteObserverB), 1 abstract class (Subject), 1 interface (Observer). ConcreteSubject extends Subject. Subject references Observer labeled "notifies". ConcreteObserverA implements Observer. ConcreteObserverB implements Observer.

Classes

  • ConcreteSubject — Attributes: private state: int — Operations: public getState(): int; public setState(s: int)
  • ConcreteObserverA — Attributes: none declared — Operations: public update(data: Object)
  • ConcreteObserverB — Attributes: none declared — Operations: public update(data: Object)

Abstract classes

  • Subject — Attributes: private observers: List — Operations: public attach(o: Observer); public detach(o: Observer); public notify()

Interfaces

  • Observer — Attributes: none declared — Operations: public update(data: Object)

Relationships

  • ConcreteSubject extends Subject
  • Subject references Observer labeled "notifies"
  • ConcreteObserverA implements Observer
  • ConcreteObserverB implements Observer

6. Train System (from Lecture)

Detailed description

UML class diagram with 5 classes (Train, Station, Button, RequestButton, EmergencyButton). RequestButton extends Button. EmergencyButton extends Button. Station is associated with Button with multiplicity one to one. Train is associated with Button with multiplicity one to 2.

Classes

  • Train — Attributes: private lastStop: char; private nextStop: char; private velocity: double; private doorsOpen: boolean — Operations: public startTrain(velocity: double): void; public stopTrain(): void; public openDoors(): void
  • Station — Attributes: public name: str — Operations: none declared
  • Button — Attributes: public pressed: boolean — Operations: public press()
  • RequestButton — Attributes: none declared — Operations: public press()
  • EmergencyButton — Attributes: none declared — Operations: public press()

Relationships

  • RequestButton extends Button
  • EmergencyButton extends Button
  • Station is associated with Button with multiplicity one to one
  • Train is associated with Button with multiplicity one to 2

7. Dependency

Detailed description

UML class diagram with 2 classes (Train, ButtonPressedEvent). Train depends on ButtonPressedEvent.

Classes

  • Train — Attributes: none declared — Operations: public addStop(stop: event): void
  • ButtonPressedEvent — Attributes: public station: str; public timestamp: int — Operations: none declared

Relationships

  • Train depends on ButtonPressedEvent

8. Abstract Class with Stereotype

9. Note with Constraint (Bottom)

Detailed description

UML class diagram with 1 class (BankAccount).

Classes

  • BankAccount — Attributes: public owner: String; public balance: Number — Operations: public deposit(amount: Number); public withdraw(amount: Number)

10. Multi-line Note with Code and LaTeX

Detailed description

UML class diagram with 2 classes (Order, Customer). Customer is associated with Order with multiplicity one to many labeled "places".

Classes

  • Order — Attributes: public id: int; public status: String; public total: double — Operations: none declared
  • Customer — Attributes: public name: String; public email: String — Operations: none declared

Relationships

  • Customer is associated with Order with multiplicity one to many labeled "places"

10b. Notes on Attributes and Operations

Detailed description

UML class diagram with 1 class (Account).

Classes

  • Account — Attributes: public owner: String; public balance: double — Operations: public deposit(amount: double); public withdraw(amount: double)

10b2. Observer Notes Avoid Relation Endpoints

Detailed description

UML class diagram with 2 classes (ConcreteSubject, ConcreteObserver), 2 interfaces (Subject, Observer). ConcreteSubject implements Subject. ConcreteObserver implements Observer. Subject is associated with Observer with multiplicity one to many labeled "observers". ConcreteObserver references ConcreteSubject labeled "subject".

Classes

  • ConcreteSubject — Attributes: private subjectState: String — Operations: public getState(): String; public setState(value: String): void
  • ConcreteObserver — Attributes: private subject: ConcreteSubject; private observerState: String — Operations: public update(): void

Interfaces

  • Subject — Attributes: none declared — Operations: public attach(observer: Observer): void; public detach(observer: Observer): void; public notifyObservers(): void
  • Observer — Attributes: none declared — Operations: public update(): void

Relationships

  • ConcreteSubject implements Subject
  • ConcreteObserver implements Observer
  • Subject is associated with Observer with multiplicity one to many labeled "observers"
  • ConcreteObserver references ConcreteSubject labeled "subject"

10c. Note with Python Syntax Highlighting

Detailed description

UML class diagram with 1 class (BankAccount).

Classes

  • BankAccount — Attributes: public owner: String; public balance: float — Operations: public deposit(amount: float); public withdraw(amount: float)

10d. Note with Java Syntax Highlighting

Detailed description

UML class diagram with 1 class (OrderService).

Classes

  • OrderService — Attributes: none declared — Operations: public placeOrder(order: Order): boolean

10e. Note with JavaScript Syntax Highlighting

Detailed description

UML class diagram with 1 class (EventEmitter).

Classes

  • EventEmitter — Attributes: none declared — Operations: public on(event: String, callback: Function); public emit(event: String, data: Object)

10f. Note with C++ Syntax Highlighting

Detailed description

UML class diagram with 1 class (Matrix).

Classes

  • Matrix — Attributes: private rows: int; private cols: int — Operations: public transpose(): Matrix

UML Sequence Diagram Tests

11. Basic Synchronous Call & Response

Detailed description

UML sequence diagram with 2 participants (Client, LibraryServer). Messages: client calls server with "GET /book/id"; server replies to client with "responseCode=200, book".

Participants

  • Client
  • LibraryServer

Messages

  • 1. client calls server with "GET /book/id"
  • 2. server replies to client with "responseCode=200, book"

10. Alt Fragment

Detailed description

UML sequence diagram with 2 participants (Client, LibraryServer). Messages: client calls server with "GET /book/id"; in alt branch [book found], server replies to client with "responseCode=200, book"; in alt branch [else], server replies to client with "responseCode=404".

Participants

  • Client
  • LibraryServer

Combined fragments

  • alt branch [book found]
  • alt branch [else]

Messages

  • 1. client calls server with "GET /book/id"
  • 2. in alt branch [book found], server replies to client with "responseCode=200, book"
  • 3. in alt branch [else], server replies to client with "responseCode=404"

11. Multiple Participants (Login Flow)

Detailed description

UML sequence diagram with 5 participants (User, WebBrowser, LoginController, AuthService, UserDB). Messages: user calls browser with "enter credentials"; browser calls login with "POST /login"; login calls auth with "authenticate(user, pass)"; auth calls db with "findUser(user)"; db replies to auth with "userRecord"; auth replies to login with "authResult"; login replies to browser with "200 OK + token"; browser replies to user with "show dashboard".

Participants

  • User
  • WebBrowser
  • LoginController
  • AuthService
  • UserDB

Messages

  • 1. user calls browser with "enter credentials"
  • 2. browser calls login with "POST /login"
  • 3. login calls auth with "authenticate(user, pass)"
  • 4. auth calls db with "findUser(user)"
  • 5. db replies to auth with "userRecord"
  • 6. auth replies to login with "authResult"
  • 7. login replies to browser with "200 OK + token"
  • 8. browser replies to user with "show dashboard"

12. Loop Fragment

Detailed description

UML sequence diagram with 3 participants (Client, Server, Database). Messages: c calls s with "getItems(page)"; in loop [for each item in page], s calls db with "fetchItem(id)"; db replies to s with "itemData"; s replies to c with "itemList".

Participants

  • Client
  • Server
  • Database

Combined fragments

  • loop [for each item in page]

Messages

  • 1. c calls s with "getItems(page)"
  • 2. in loop [for each item in page], s calls db with "fetchItem(id)"
  • 3. db replies to s with "itemData"
  • 4. s replies to c with "itemList"

13. Opt Fragment (Optional)

Detailed description

UML sequence diagram with 3 participants (User, App, NotificationService). Messages: user calls app with "submitOrder()"; in optional fragment [user has notifications enabled], app calls notif with "sendEmail(user, order)"; notif replies to app with "sent"; app replies to user with "orderConfirmation".

Participants

  • User
  • App
  • NotificationService

Combined fragments

  • optional fragment [user has notifications enabled]

Messages

  • 1. user calls app with "submitOrder()"
  • 2. in optional fragment [user has notifications enabled], app calls notif with "sendEmail(user, order)"
  • 3. notif replies to app with "sent"
  • 4. app replies to user with "orderConfirmation"

14. Train System Sequence (from Lecture)

Detailed description

UML sequence diagram with 5 participants (Passenger, StationButton, TrainSystem, Train, Doors). Messages: p calls btn with "press()"; btn calls sys with "requestStop(stationA)"; sys calls train with "stopTrain()"; train replies to sys with "stopped"; sys calls doors with "openDoors()"; doors replies to sys with "doorsOpen"; p calls train with "board"; p calls train with "pressRequestButton(stationB)"; train calls sys with "requestStop(stationB)"; sys calls doors with "closeDoors()"; doors replies to sys with "doorsClosed"; sys calls train with "startTrain(velocity)".

Participants

  • Passenger
  • StationButton
  • TrainSystem
  • Train
  • Doors

Messages

  • 1. p calls btn with "press()"
  • 2. btn calls sys with "requestStop(stationA)"
  • 3. sys calls train with "stopTrain()"
  • 4. train replies to sys with "stopped"
  • 5. sys calls doors with "openDoors()"
  • 6. doors replies to sys with "doorsOpen"
  • 7. p calls train with "board"
  • 8. p calls train with "pressRequestButton(stationB)"
  • 9. train calls sys with "requestStop(stationB)"
  • 10. sys calls doors with "closeDoors()"
  • 11. doors replies to sys with "doorsClosed"
  • 12. sys calls train with "startTrain(velocity)"

15. Execution Specifications (Explicit Activation)

Detailed description

UML sequence diagram with 3 participants (Client, LibraryServer, Database). Messages: client calls server with "GET /book/id"; server calls db with "SELECT * FROM books"; db replies to server with "resultSet"; server replies to client with "responseCode=200, book".

Participants

  • Client
  • LibraryServer
  • Database

Messages

  • 1. client calls server with "GET /book/id"
  • 2. server calls db with "SELECT * FROM books"
  • 3. db replies to server with "resultSet"
  • 4. server replies to client with "responseCode=200, book"

16. Nested Activations

Detailed description

UML sequence diagram with 4 participants (User, Application, AuthService, UserDB). Messages: user calls app with "login(credentials)"; app calls auth with "authenticate(user, pass)"; auth calls db with "findUser(user)"; db replies to auth with "userRecord"; auth replies to app with "token"; app replies to user with "loginSuccess".

Participants

  • User
  • Application
  • AuthService
  • UserDB

Messages

  • 1. user calls app with "login(credentials)"
  • 2. app calls auth with "authenticate(user, pass)"
  • 3. auth calls db with "findUser(user)"
  • 4. db replies to auth with "userRecord"
  • 5. auth replies to app with "token"
  • 6. app replies to user with "loginSuccess"

17. Self-Message

Detailed description

UML sequence diagram with 2 participants (Client, Server). Messages: client calls server with "request()"; server calls server with "validate()"; server calls server with "process()"; server replies to client with "response".

Participants

  • Client
  • Server

Messages

  • 1. client calls server with "request()"
  • 2. server calls server with "validate()"
  • 3. server calls server with "process()"
  • 4. server replies to client with "response"

18. Lost and Found Messages

Detailed description

UML sequence diagram with 2 participants (Client, Server). Messages: o calls client with "networkEvent"; client calls server with "request()"; server calls o with "timeout"; server replies to client with "response"; client calls o with "logEntry".

Participants

  • Client
  • Server

Messages

  • 1. o calls client with "networkEvent"
  • 2. client calls server with "request()"
  • 3. server calls o with "timeout"
  • 4. server replies to client with "response"
  • 5. client calls o with "logEntry"

19. Stacked Execution Specifications (Observer Pattern)

Detailed description

UML sequence diagram with 2 participants (Observer, Subject). Messages: Observer calls Subject with "register(self)"; Observer calls Subject with "notify(someEvent)"; Subject calls Observer with "update()"; Observer calls Subject with "getData()"; Subject replies to Observer with "data".

Participants

  • Observer
  • Subject

Messages

  • 1. Observer calls Subject with "register(self)"
  • 2. Observer calls Subject with "notify(someEvent)"
  • 3. Subject calls Observer with "update()"
  • 4. Observer calls Subject with "getData()"
  • 5. Subject replies to Observer with "data"

19b. Stacked Bars — Deep Nesting

Detailed description

UML sequence diagram with 3 participants (Client, Server, Database). Messages: client calls server with "login()"; server calls db with "checkCredentials()"; server calls db with "loadProfile()"; db replies to server with "profile"; db replies to server with "valid"; server replies to client with "session".

Participants

  • Client
  • Server
  • Database

Messages

  • 1. client calls server with "login()"
  • 2. server calls db with "checkCredentials()"
  • 3. server calls db with "loadProfile()"
  • 4. db replies to server with "profile"
  • 5. db replies to server with "valid"
  • 6. server replies to client with "session"

20. Nested Fragments (Loop containing Alt)

Detailed description

UML sequence diagram with 3 participants (Client, Server, Database). Messages: c calls s with "fetchAll()"; in loop [for each record], within alt branch [found], s calls db with "query(id)"; db replies to s with "record"; s calls s with "transform()"; in loop [for each record], within alt branch [not found], s calls db with "query(id)"; db replies to s with "null"; s calls s with "logMissing()"; s replies to c with "results".

Participants

  • Client
  • Server
  • Database

Combined fragments

  • loop [for each record]
  • alt branch [found]
  • alt branch [not found]

Messages

  • 1. c calls s with "fetchAll()"
  • 2. in loop [for each record], within alt branch [found], s calls db with "query(id)"
  • 3. db replies to s with "record"
  • 4. s calls s with "transform()"
  • 5. in loop [for each record], within alt branch [not found], s calls db with "query(id)"
  • 6. db replies to s with "null"
  • 7. s calls s with "logMissing()"
  • 8. s replies to c with "results"

21. Destroy / Delete Message (Lifeline Termination)

Detailed description

UML sequence diagram with 3 participants (Client, Session, Database). Messages: c calls s with "connect()"; s calls db with "open()"; db replies to s with "connection"; s replies to c with "sessionId"; c calls s with "query(sql)"; s calls db with "execute(sql)"; db replies to s with "resultSet"; s replies to c with "results"; c calls s with "disconnect()"; s calls db with "close()"; s replies to c with "bye".

Participants

  • Client
  • Session
  • Database

Messages

  • 1. c calls s with "connect()"
  • 2. s calls db with "open()"
  • 3. db replies to s with "connection"
  • 4. s replies to c with "sessionId"
  • 5. c calls s with "query(sql)"
  • 6. s calls db with "execute(sql)"
  • 7. db replies to s with "resultSet"
  • 8. s replies to c with "results"
  • 9. c calls s with "disconnect()"
  • 10. s calls db with "close()"
  • 11. s replies to c with "bye"

22. Break Fragment (Early Exit from Loop)

Detailed description

UML sequence diagram with 3 participants (Client, Server, Cache). Messages: c calls s with "search(query)"; in loop [for each page], within break [cache hit], s calls cache with "lookup(page)"; cache replies to s with "cachedResult"; s replies to c with "cachedResult"; in loop [for each page], s calls cache with "lookup(page)"; cache replies to s with "miss"; s calls s with "computePage()"; s replies to c with "result".

Participants

  • Client
  • Server
  • Cache

Combined fragments

  • loop [for each page]
  • break [cache hit]

Messages

  • 1. c calls s with "search(query)"
  • 2. in loop [for each page], within break [cache hit], s calls cache with "lookup(page)"
  • 3. cache replies to s with "cachedResult"
  • 4. s replies to c with "cachedResult"
  • 5. in loop [for each page], s calls cache with "lookup(page)"
  • 6. cache replies to s with "miss"
  • 7. s calls s with "computePage()"
  • 8. s replies to c with "result"

23. Par (Parallel) Fragment

Detailed description

UML sequence diagram with 5 participants (UI, OrderService, Inventory, PaymentGateway, Notifications). Messages: ui calls svc with "placeOrder()"; in parallel branch [parallel processing], svc calls inv with "reserveItems()"; inv replies to svc with "reserved"; in parallel branch [payment], svc calls pay with "chargeCard()"; pay replies to svc with "charged"; in parallel branch [notification], svc calls notif with "sendConfirmation()"; notif replies to svc with "sent"; svc replies to ui with "orderComplete".

Participants

  • UI
  • OrderService
  • Inventory
  • PaymentGateway
  • Notifications

Combined fragments

  • parallel branch [parallel processing]
  • parallel branch [payment]
  • parallel branch [notification]

Messages

  • 1. ui calls svc with "placeOrder()"
  • 2. in parallel branch [parallel processing], svc calls inv with "reserveItems()"
  • 3. inv replies to svc with "reserved"
  • 4. in parallel branch [payment], svc calls pay with "chargeCard()"
  • 5. pay replies to svc with "charged"
  • 6. in parallel branch [notification], svc calls notif with "sendConfirmation()"
  • 7. notif replies to svc with "sent"
  • 8. svc replies to ui with "orderComplete"

24. Ref (Interaction Use) Fragment

Detailed description

UML sequence diagram with 4 participants (User, App, AuthService, API). Messages: user calls app with "login()"; app calls auth with "authenticate(credentials)"; auth replies to app with "token"; app calls api with "getData(token)"; api replies to app with "data"; app replies to user with "showDashboard".

Participants

  • User
  • App
  • AuthService
  • API

Messages

  • 1. user calls app with "login()"
  • 2. app calls auth with "authenticate(credentials)"
  • 3. auth replies to app with "token"
  • 4. app calls api with "getData(token)"
  • 5. api replies to app with "data"
  • 6. app replies to user with "showDashboard"

25. Critical Fragment

Detailed description

UML sequence diagram with 3 participants (ATM, BankServer, Account). Messages: atm calls bank with "withdraw(amount)"; in critical region [atomic transaction], bank calls acct with "debit(amount)"; acct replies to bank with "success"; bank calls acct with "updateBalance()"; acct replies to bank with "newBalance"; bank replies to atm with "dispenseCash".

Participants

  • ATM
  • BankServer
  • Account

Combined fragments

  • critical region [atomic transaction]

Messages

  • 1. atm calls bank with "withdraw(amount)"
  • 2. in critical region [atomic transaction], bank calls acct with "debit(amount)"
  • 3. acct replies to bank with "success"
  • 4. bank calls acct with "updateBalance()"
  • 5. acct replies to bank with "newBalance"
  • 6. bank replies to atm with "dispenseCash"

26. Multiple Else Clauses in Alt

Detailed description

UML sequence diagram with 2 participants (Client, Server). Messages: c calls s with "request(type)"; in alt branch [type == GET], s replies to c with "200 OK + data"; in alt branch [type == POST], s calls s with "validate()"; s replies to c with "201 Created"; in alt branch [type == DELETE], s calls s with "authorize()"; s replies to c with "204 No Content"; in alt branch [else], s replies to c with "405 Method Not Allowed".

Participants

  • Client
  • Server

Combined fragments

  • alt branch [type == GET]
  • alt branch [type == POST]
  • alt branch [type == DELETE]
  • alt branch [else]

Messages

  • 1. c calls s with "request(type)"
  • 2. in alt branch [type == GET], s replies to c with "200 OK + data"
  • 3. in alt branch [type == POST], s calls s with "validate()"
  • 4. s replies to c with "201 Created"
  • 5. in alt branch [type == DELETE], s calls s with "authorize()"
  • 6. s replies to c with "204 No Content"
  • 7. in alt branch [else], s replies to c with "405 Method Not Allowed"

27. Deeply Nested Fragments (3 Levels)

Detailed description

UML sequence diagram with 4 participants (Client, Gateway, Service, Database). Messages: c calls gw with "request()"; in optional fragment [authenticated], gw calls svc with "process()"; in optional fragment [authenticated], within loop [retry up to 3 times], within alt branch [success], svc calls db with "query()"; db replies to svc with "data"; in optional fragment [authenticated], within loop [retry up to 3 times], within alt branch [timeout], svc calls db with "query()"; svc calls svc with "wait()"; in optional fragment [authenticated], svc replies to gw with "result"; gw replies to c with "response".

Participants

  • Client
  • Gateway
  • Service
  • Database

Combined fragments

  • optional fragment [authenticated]
  • loop [retry up to 3 times]
  • alt branch [success]
  • alt branch [timeout]

Messages

  • 1. c calls gw with "request()"
  • 2. in optional fragment [authenticated], gw calls svc with "process()"
  • 3. in optional fragment [authenticated], within loop [retry up to 3 times], within alt branch [success], svc calls db with "query()"
  • 4. db replies to svc with "data"
  • 5. in optional fragment [authenticated], within loop [retry up to 3 times], within alt branch [timeout], svc calls db with "query()"
  • 6. svc calls svc with "wait()"
  • 7. in optional fragment [authenticated], svc replies to gw with "result"
  • 8. gw replies to c with "response"

28. Neg (Forbidden/Invalid) Fragment

Detailed description

UML sequence diagram with 3 participants (User, System, Database). Messages: user calls sys with "deleteAccount()"; sys calls db with "DROP TABLE users"; db replies to sys with "error"; sys replies to user with "maintenanceInProgress".

Participants

  • User
  • System
  • Database

Messages

  • 1. user calls sys with "deleteAccount()"
  • 2. sys calls db with "DROP TABLE users"
  • 3. db replies to sys with "error"
  • 4. sys replies to user with "maintenanceInProgress"

29. Async Messages and Create/Destroy Lifecycle

Detailed description

UML sequence diagram with 3 participants (Client, ThreadPool, Worker). Messages: client asynchronously messages pool with "submitTask()"; pool calls worker with "create()"; pool asynchronously messages worker with "execute(task)"; worker asynchronously messages pool with "taskComplete"; pool replies to client with "result".

Participants

  • Client
  • ThreadPool
  • Worker

Messages

  • 1. client asynchronously messages pool with "submitTask()"
  • 2. pool calls worker with "create()"
  • 3. pool asynchronously messages worker with "execute(task)"
  • 4. worker asynchronously messages pool with "taskComplete"
  • 5. pool replies to client with "result"

30. Sequence Diagram Notes

Detailed description

UML sequence diagram with 3 participants (Client, Server, Database). Messages: c calls s with "authenticate()"; s replies to c with "authResult".

Participants

  • Client
  • Server
  • Database

Messages

  • 1. c calls s with "authenticate()"
  • 2. s calls db with "findUser(token)"
  • 3. db replies to s with "userRecord"
  • 4. s replies to c with "authResult"

UML State Machine Diagram Tests

31. Exosuit State Machine (from SEBook)

Detailed description

UML state machine diagram with 3 states (Idle, CombatMode, EmergencyPower). Transitions: the initial pseudostate transitions to Idle on powerOn(); Idle transitions to CombatMode on threatDetected [sysCheckOK] / deployUI(); CombatMode transitions to Idle on threatNeutralized / retractWeapons(); CombatMode transitions to EmergencyPower on powerLevel < 5% / rerouteToLifeSupport(); EmergencyPower transitions to the final state on manualOverride().

States

  • Idle
  • CombatMode
  • EmergencyPower

Transitions

  • the initial pseudostate transitions to Idle on powerOn()
  • Idle transitions to CombatMode on threatDetected [sysCheckOK] / deployUI()
  • CombatMode transitions to Idle on threatNeutralized / retractWeapons()
  • CombatMode transitions to EmergencyPower on powerLevel < 5% / rerouteToLifeSupport()
  • EmergencyPower transitions to the final state on manualOverride()

20. Order Lifecycle

Detailed description

UML state machine diagram with 6 states (Created, Paid, Shipped, Delivered, Cancelled, Refunded). Transitions: the initial pseudostate transitions to Created on Order Placed; Created transitions to Paid on payment_received; Paid transitions to Shipped on ship_order; Shipped transitions to Delivered on delivery_confirmed; Delivered transitions to the final state; Created transitions to Cancelled on cancel_order [within 24hrs]; Paid transitions to Refunded on refund_requested / processRefund(); Cancelled transitions to the final state; Refunded transitions to the final state.

States

  • Created
  • Paid
  • Shipped
  • Delivered
  • Cancelled
  • Refunded

Transitions

  • the initial pseudostate transitions to Created on Order Placed
  • Created transitions to Paid on payment_received
  • Paid transitions to Shipped on ship_order
  • Shipped transitions to Delivered on delivery_confirmed
  • Delivered transitions to the final state
  • Created transitions to Cancelled on cancel_order [within 24hrs]
  • Paid transitions to Refunded on refund_requested / processRefund()
  • Cancelled transitions to the final state
  • Refunded transitions to the final state

21. Simple Turnstile

Detailed description

UML state machine diagram with 2 states (Locked, Unlocked). Transitions: the initial pseudostate transitions to Locked; Locked transitions to Unlocked on insertCoin; Unlocked transitions to Locked on push.

States

  • Locked
  • Unlocked

Transitions

  • the initial pseudostate transitions to Locked
  • Locked transitions to Unlocked on insertCoin
  • Unlocked transitions to Locked on push

22. Vending Machine with Internal Actions

Detailed description

UML state machine diagram with 3 states (Idle, AcceptingMoney, Dispensing). Transitions: the initial pseudostate transitions to Idle; Idle transitions to AcceptingMoney on selectProduct; AcceptingMoney transitions to Dispensing on [sufficientFunds] / startDispense(); AcceptingMoney transitions to Idle on cancel / returnMoney(); Dispensing transitions to Idle on complete / resetMachine().

States

  • Idle
  • AcceptingMoney
  • Dispensing

Transitions

  • the initial pseudostate transitions to Idle
  • Idle transitions to AcceptingMoney on selectProduct
  • AcceptingMoney transitions to Dispensing on [sufficientFunds] / startDispense()
  • AcceptingMoney transitions to Idle on cancel / returnMoney()
  • Dispensing transitions to Idle on complete / resetMachine()

35. State Diagram with Note

Detailed description

UML state machine diagram with 4 states (Idle, Processing, Done, Error). Transitions: the initial pseudostate transitions to Idle on init(); Idle transitions to Processing on startJob [queueNotEmpty]; Processing transitions to Done on complete; Done transitions to the final state; Processing transitions to Error on exception; Error transitions to Idle on retry.

States

  • Idle
  • Processing
  • Done
  • Error

Transitions

  • the initial pseudostate transitions to Idle on init()
  • Idle transitions to Processing on startJob [queueNotEmpty]
  • Processing transitions to Done on complete
  • Done transitions to the final state
  • Processing transitions to Error on exception
  • Error transitions to Idle on retry

UML Component Diagram Tests

36. Client-Server (from Lecture)

Detailed description

UML component diagram with 2 components (Client, LibraryServer). Connections: Client connects to LibraryServer labeled "GET Book"; Client connects to LibraryServer labeled "POST Book".

Components

  • Client
  • LibraryServer

Connections

  • Client connects to LibraryServer labeled "GET Book"
  • Client connects to LibraryServer labeled "POST Book"

24. Three-Tier Architecture

Detailed description

UML component diagram with 3 components (WebUI, AppServer, Database). Connections: WebUI connects to AppServer labeled "HTTP Requests"; AppServer connects to Database labeled "SQL Queries"; AppServer depends on Logger labeled "uses".

Components

  • WebUI
  • AppServer
  • Database

Connections

  • WebUI connects to AppServer labeled "HTTP Requests"
  • AppServer connects to Database labeled "SQL Queries"
  • AppServer depends on Logger labeled "uses"

25. Microservices

Detailed description

UML component diagram with 5 components (APIGateway, UserService, OrderService, PaymentService, NotificationService). Connections: APIGateway connects to UserService labeled "/api/users"; APIGateway connects to OrderService labeled "/api/orders"; OrderService connects to PaymentService labeled "processPayment"; OrderService depends on NotificationService labeled "sendConfirmation"; PaymentService depends on NotificationService labeled "sendReceipt".

Components

  • APIGateway
  • UserService
  • OrderService
  • PaymentService
  • NotificationService

Connections

  • APIGateway connects to UserService labeled "/api/users"
  • APIGateway connects to OrderService labeled "/api/orders"
  • OrderService connects to PaymentService labeled "processPayment"
  • OrderService depends on NotificationService labeled "sendConfirmation"
  • PaymentService depends on NotificationService labeled "sendReceipt"

26. Frontend-Backend-Database (directional ports)

Detailed description

UML component diagram with 4 components (Frontend, Backend, Database, EventBus). Frontend outgoing ports httpOut. Backend incoming ports httpIn, outgoing ports dbOut, eventOut. Database incoming ports dbIn. EventBus incoming ports eventIn. Connections: Frontend connects to Backend labeled "HTTP / JSON"; Backend connects to Database labeled "SQL"; Backend connects to EventBus labeled "publish".

Components

  • Frontend — outgoing ports httpOut
  • Backend — incoming ports httpIn; outgoing ports dbOut, eventOut
  • Database — incoming ports dbIn
  • EventBus — incoming ports eventIn

Connections

  • Frontend connects to Backend labeled "HTTP / JSON"
  • Backend connects to Database labeled "SQL"
  • Backend connects to EventBus labeled "publish"

27. Microservice API Gateway (Port-to-Port)

Detailed description

UML component diagram with 6 components (Gateway, Auth, Users, Clubs, Events, Notifications). Gateway outgoing ports out1, out2. Auth incoming ports in, outgoing ports out1, out2. Users incoming ports /users, /users, /users/unsubscribe/{userId}. Clubs incoming ports /clubs, /clubs/event-reference/{eventId}, /clubs/roles/{clubId}/{userId}, outgoing ports out1. Events incoming ports /events, /events/template-data/{templateId}, outgoing ports out1, out2. Notifications incoming ports /notifications/event-update, outgoing ports out1, out2. Connections: Gateway connects to Clubs labeled "POST"; Gateway connects to Users labeled "POST"; Auth connects to Users labeled "GET"; Auth connects to Clubs labeled "GET"; Clubs connects to Events labeled "GET"; Events connects to Clubs labeled "GET"; Events connects to Notifications labeled "POST"; Notifications connects to Events labeled "GET"; Notifications connects to Users labeled "POST".

Components

  • Gateway — outgoing ports out1, out2
  • Auth — incoming ports in; outgoing ports out1, out2
  • Users — incoming ports /users, /users, /users/unsubscribe/{userId}
  • Clubs — incoming ports /clubs, /clubs/event-reference/{eventId}, /clubs/roles/{clubId}/{userId}; outgoing ports out1
  • Events — incoming ports /events, /events/template-data/{templateId}; outgoing ports out1, out2
  • Notifications — incoming ports /notifications/event-update; outgoing ports out1, out2

Connections

  • Gateway connects to Clubs labeled "POST"
  • Gateway connects to Users labeled "POST"
  • Auth connects to Users labeled "GET"
  • Auth connects to Clubs labeled "GET"
  • Clubs connects to Events labeled "GET"
  • Events connects to Clubs labeled "GET"
  • Events connects to Notifications labeled "POST"
  • Notifications connects to Events labeled "GET"
  • Notifications connects to Users labeled "POST"

27b. Component API Back-Edges with Shared Ports

Detailed description

UML component diagram with 4 components (users, clubs, events, notifications). users incoming ports /users. clubs incoming ports /clubs. events incoming ports /events. notifications incoming ports /notifications. Connections: notifications connects to users labeled ""patch /users/unsubscribe/{userId}""; notifications connects to events labeled ""get /events/template-data/{templateId}""; auth connects to clubs labeled ""get /clubs/roles/{clubId}/{userId}""; auth connects to users labeled ""post /users""; gateway connects to users labeled ""get /users""; gateway connects to clubs labeled ""get /clubs""; clubs connects to events labeled ""post /events""; events connects to notifications labeled ""post /notifications/event-update""; events connects to clubs labeled ""delete /clubs/event-reference/{eventId}"".

Components

  • users — incoming ports /users
  • clubs — incoming ports /clubs
  • events — incoming ports /events
  • notifications — incoming ports /notifications

Connections

  • notifications connects to users labeled ""patch /users/unsubscribe/{userId}""
  • notifications connects to events labeled ""get /events/template-data/{templateId}""
  • auth connects to clubs labeled ""get /clubs/roles/{clubId}/{userId}""
  • auth connects to users labeled ""post /users""
  • gateway connects to users labeled ""get /users""
  • gateway connects to clubs labeled ""get /clubs""
  • clubs connects to events labeled ""post /events""
  • events connects to notifications labeled ""post /notifications/event-update""
  • events connects to clubs labeled ""delete /clubs/event-reference/{eventId}""

27c. Component Dashed Visual Style

Detailed description

UML component diagram with 3 components (Source, Worker, Monitor). Worker incoming ports jobs, outgoing ports status.

Components

  • Source
  • Worker — incoming ports jobs; outgoing ports status
  • Monitor

27d. Standalone Labelled Ports

Detailed description

UML component diagram with 2 components (Publisher, Subscriber). Publisher outgoing ports out. Subscriber incoming ports in.

Components

  • Publisher — outgoing ports out
  • Subscriber — incoming ports in

28. Joined Assembly Interfaces (Ball-and-Socket)

Detailed description

UML component diagram with 3 components (Order, Warehouse, CRM). Order provides OrderItems, CustomerInfo. Warehouse requires OrderItems. CRM requires CustomerInfo. Connections: Order connects to Warehouse; Order connects to CRM.

Components

  • Order — provides OrderItems, CustomerInfo
  • Warehouse — requires OrderItems
  • CRM — requires CustomerInfo

Connections

  • Order connects to Warehouse
  • Order connects to CRM

29. Disjoined Interfaces (Standalone Lollipop and Socket)

Detailed description

UML component diagram with 3 components (WebApp, Database, MobileApp). WebApp provides UserAPI, requires DataStore. Database provides DataStore. MobileApp requires UserAPI. Connections: WebApp depends on MobileApp labeled "REST"; Database depends on WebApp labeled "JDBC".

Components

  • WebApp — provides UserAPI; requires DataStore
  • Database — provides DataStore
  • MobileApp — requires UserAPI

Connections

  • WebApp depends on MobileApp labeled "REST"
  • Database depends on WebApp labeled "JDBC"

40. Component Diagram with Note

Detailed description

UML component diagram with 3 components (Frontend, API, Database). Connections: Frontend connects to API labeled "REST"; API connects to Database labeled "SQL".

Components

  • Frontend
  • API
  • Database

Connections

  • Frontend connects to API labeled "REST"
  • API connects to Database labeled "SQL"

UML Deployment Diagram Tests

41. Web Application Deployment

Detailed description

UML deployment diagram with 3 nodes (WebServer, DatabaseServer, ClientDevice).

Nodes

  • WebServer
  • DatabaseServer
  • ClientDevice

27. Ticket System (from UML Reference)

Detailed description

UML deployment diagram with 3 nodes (TicketServer, Kiosk, SalesTerminal).

Nodes

  • TicketServer
  • Kiosk
  • SalesTerminal

28. Microservices Deployment

Detailed description

UML deployment diagram with 4 nodes (LoadBalancer, AppNode1, AppNode2, DataNode).

Nodes

  • LoadBalancer
  • AppNode1
  • AppNode2
  • DataNode

30. Web App Deployment — Horizontal Layout

Detailed description

UML deployment diagram with 3 nodes (ClientDevice, WebServer, DatabaseServer).

Nodes

  • ClientDevice
  • WebServer
  • DatabaseServer

31. Microservices — Horizontal Layout

Detailed description

UML deployment diagram with 4 nodes (LoadBalancer, AppNode1, AppNode2, DataNode).

Nodes

  • LoadBalancer
  • AppNode1
  • AppNode2
  • DataNode

29. Node Instance Notation (name:Type underlined, per UML spec Fig 9-3)

Detailed description

UML deployment diagram with 2 nodes (server:BankServer, client:ATMKiosk).

Nodes

  • server:BankServer
  • client:ATMKiosk

50. Deployment Diagram with Note

Detailed description

UML deployment diagram with 3 nodes (LoadBalancer, AppServer, DBServer).

Nodes

  • LoadBalancer
  • AppServer
  • DBServer

Additional UML Regression Tests

51. Enumeration (Class Diagram)

Detailed description

UML class diagram with 1 class (Product). Product references Color. Product references Size.

Classes

  • Product — Attributes: private name: String; private color: Color; private size: Size — Operations: none declared

Relationships

  • Product references Color
  • Product references Size

52. Choice Pseudostate (State Machine)

Detailed description

UML state machine diagram with 4 states (Validating, Check, Approved, Rejected). Transitions: the initial pseudostate transitions to Validating on submit; Validating transitions to Check on validate(); Check transitions to Approved on [valid]; Check transitions to Rejected on [invalid]; Approved transitions to the final state; Rejected transitions to the final state.

States

  • Validating
  • Check
  • Approved
  • Rejected

Transitions

  • the initial pseudostate transitions to Validating on submit
  • Validating transitions to Check on validate()
  • Check transitions to Approved on [valid]
  • Check transitions to Rejected on [invalid]
  • Approved transitions to the final state
  • Rejected transitions to the final state

53. Actor Stick Figures (Sequence Diagram)

Detailed description

UML sequence diagram with 3 participants (User, Application, Database). Messages: user calls app with "login(credentials)"; app calls db with "findUser(name)"; db replies to app with "userRecord"; app replies to user with "welcome screen".

Participants

  • User
  • Application
  • Database

Messages

  • 1. user calls app with "login(credentials)"
  • 2. app calls db with "findUser(name)"
  • 3. db replies to app with "userRecord"
  • 4. app replies to user with "welcome screen"

54. Create Message (Sequence Diagram)

Detailed description

UML sequence diagram with 2 participants (Client, Server). Messages: client calls server with "request()"; server replies to Handler with "<<create>>"; Handler replies to server with "result"; server replies to client with "response".

Participants

  • Client
  • Server

Messages

  • 1. client calls server with "request()"
  • 2. server replies to Handler with "<<create>>"
  • 3. Handler replies to server with "result"
  • 4. server replies to client with "response"

55. Composite State (State Machine)

Detailed description

UML state machine diagram with 4 states (Active, Running, Paused, Idle). Transitions: the initial pseudostate transitions to Active; the initial pseudostate transitions to Running; Running transitions to Paused on pause(); Paused transitions to Running on resume(); Active transitions to Idle on deactivate(); Idle transitions to Active on activate(); Idle transitions to the final state on shutdown().

States

  • Active
  • Running
  • Paused
  • Idle

Transitions

  • the initial pseudostate transitions to Active
  • the initial pseudostate transitions to Running
  • Running transitions to Paused on pause()
  • Paused transitions to Running on resume()
  • Active transitions to Idle on deactivate()
  • Idle transitions to Active on activate()
  • Idle transitions to the final state on shutdown()

UML Use Case Diagram Tests

56. Login System (Use Case)

Detailed description

UML use case diagram with 2 actors (User, Admin) and 5 use cases (Log In, Register Account, Reset Password, Manage Users, Confirm Email). User associates with "Log In". User associates with "Register Account". User associates with "Reset Password". User associates with "Confirm Email". Admin associates with "Log In". Admin associates with "Manage Users". "Reset Password" extends "Log In". "Register Account" includes "Confirm Email".

Actors

  • User
  • Admin

Use cases

  • Log In
  • Register Account
  • Reset Password
  • Manage Users
  • Confirm Email

Relationships

  • User associates with "Log In"
  • User associates with "Register Account"
  • User associates with "Reset Password"
  • User associates with "Confirm Email"
  • Admin associates with "Log In"
  • Admin associates with "Manage Users"
  • "Reset Password" extends "Log In"
  • "Register Account" includes "Confirm Email"

57. Online Store (Use Case)

Detailed description

UML use case diagram with 2 actors (Customer, Payment Gateway) and 4 use cases (Browse Products, Add to Cart, Checkout, Pay for Order). Customer associates with "Browse Products". Customer associates with "Add to Cart". Customer associates with "Checkout". "Checkout" includes "Pay for Order". "Pay for Order" associates with PaymentGateway.

Actors

  • Customer
  • Payment Gateway

Use cases

  • Browse Products
  • Add to Cart
  • Checkout
  • Pay for Order

Relationships

  • Customer associates with "Browse Products"
  • Customer associates with "Add to Cart"
  • Customer associates with "Checkout"
  • "Checkout" includes "Pay for Order"
  • "Pay for Order" associates with PaymentGateway

Actor Inheritance — LMS with User Hierarchy

Detailed description

UML use case diagram with 3 actors (User, Student, Instructor) and 4 use cases (Login, View Course, Submit Assignment, Grade Submission). User associates with "Login". User associates with "View Course". Student specializes User. Instructor specializes User. Student associates with "Submit Assignment". Instructor associates with "Grade Submission".

Actors

  • User
  • Student
  • Instructor

Use cases

  • Login
  • View Course
  • Submit Assignment
  • Grade Submission

Relationships

  • User associates with "Login"
  • User associates with "View Course"
  • Student specializes User
  • Instructor specializes User
  • Student associates with "Submit Assignment"
  • Instructor associates with "Grade Submission"

Actor Inheritance — Hospital System

Detailed description

UML use case diagram with 4 actors (Medical Staff, Doctor, Nurse, Patient) and 5 use cases (View Patient Records, Prescribe Medication, Administer Treatment, Schedule Appointment, Authenticate). Staff associates with "View Patient Records". Doctor specializes Staff. Nurse specializes Staff. Doctor associates with "Prescribe Medication". Nurse associates with "Administer Treatment". Patient associates with "Schedule Appointment". "View Patient Records" includes "Authenticate".

Actors

  • Medical Staff
  • Doctor
  • Nurse
  • Patient

Use cases

  • View Patient Records
  • Prescribe Medication
  • Administer Treatment
  • Schedule Appointment
  • Authenticate

Relationships

  • Staff associates with "View Patient Records"
  • Doctor specializes Staff
  • Nurse specializes Staff
  • Doctor associates with "Prescribe Medication"
  • Nurse associates with "Administer Treatment"
  • Patient associates with "Schedule Appointment"
  • "View Patient Records" includes "Authenticate"

UML Activity Diagram Tests

58. Order Processing (Activity Diagram)

59. Login Flow (Activity Diagram)

60. Swimlanes (Activity Diagram)

61. Composition Crossing Test (Composite Pattern)

Detailed description

UML class diagram with 3 classes (Leaf, Composite, Client), 1 abstract class (Component). Leaf extends Component. Composite extends Component. Client references Component labeled "treats uniformly >".

Classes

  • Leaf — Attributes: none declared — Operations: public operation(): void
  • Composite — Attributes: private children: List<Component> — Operations: public operation(): void; public add(child: Component): void; public remove(child: Component): void
  • Client — Attributes: none declared — Operations: none declared

Abstract classes

  • Component — Attributes: none declared — Operations: public operation(): void; public add(child: Component): void; public remove(child: Component): void

Relationships

  • Leaf extends Component
  • Composite extends Component
  • Client references Component labeled "treats uniformly >"

61b. Association Label Direction Cues

Detailed description

UML class diagram with 3 classes (Source, Target, Observer). Source is associated with Target labeled "reads >". Observer is associated with Source labeled "< publishes".

Classes

  • Source — Attributes: none declared — Operations: none declared
  • Target — Attributes: none declared — Operations: none declared
  • Observer — Attributes: none declared — Operations: none declared

Relationships

  • Source is associated with Target labeled "reads >"
  • Observer is associated with Source labeled "< publishes"

61c. Label Direction Cues Across Diagram Types

Detailed description

UML sequence diagram with 2 participants (Client, Server). Messages: Client calls Server with "request <".

Participants

  • Client
  • Server

Messages

  • 1. Client calls Server with "request <"

Detailed description

UML state machine diagram with 2 states (Ready, Running). Transitions: Ready transitions to Running on start >.

States

  • Ready
  • Running

Transitions

  • Ready transitions to Running on start >

Detailed description

UML component diagram with 2 components (Client, Gateway). Connections: Client connects to Gateway labeled "call <".

Components

  • Client
  • Gateway

Connections

  • Client connects to Gateway labeled "call <"

Detailed description

UML deployment diagram with 2 nodes (Browser, Server).

Nodes

  • Browser
  • Server

Detailed description

UML use case diagram with 1 actor (User). User associates with Login.

Actors

  • User

Relationships

  • User associates with Login

62. Composition Behind Class Test (Order System)

Detailed description

UML class diagram with 6 classes (Customer, VIP, Guest, Order, LineItem, Product), 1 interface (Billable). VIP extends Customer. Guest extends Customer. Order implements Billable. Customer is associated with Order with multiplicity one to many. Order composes LineItem with multiplicity one to one or more. LineItem is associated with Product with multiplicity many to one.

Classes

  • Customer — Attributes: private id: int; private name: String — Operations: public placeOrder(): void
  • VIP — Attributes: none declared — Operations: none declared
  • Guest — Attributes: none declared — Operations: none declared
  • Order — Attributes: private date: Date; private status: String — Operations: public calcTotal(): float
  • LineItem — Attributes: private quantity: int — Operations: none declared
  • Product — Attributes: private price: float; private name: String — Operations: none declared

Interfaces

  • Billable — Attributes: none declared — Operations: public processPayment(): bool

Relationships

  • VIP extends Customer
  • Guest extends Customer
  • Order implements Billable
  • Customer is associated with Order with multiplicity one to many
  • Order composes LineItem with multiplicity one to one or more
  • LineItem is associated with Product with multiplicity many to one

63. Composition Detour Test (Shape/Color)

Detailed description

UML class diagram with 4 classes (Color, Canvas, Logger, Rectangle), 1 abstract class (Shape). Shape composes Color. Rectangle extends Shape. Canvas depends on Logger labeled "uses".

Classes

  • Color — Attributes: private r: int; private g: int; private b: int — Operations: none declared
  • Canvas — Attributes: none declared — Operations: public render()
  • Logger — Attributes: none declared — Operations: public log(msg: str)
  • Rectangle — Attributes: private width: int; private length: int — Operations: public setWidth(width: int); public setHeight(height: int)

Abstract classes

  • Shape — Attributes: private color: int — Operations: public area(): double (abstract); public setColor(r: int, g: int, b: int)

Relationships

  • Shape composes Color
  • Rectangle extends Shape
  • Canvas depends on Logger labeled "uses"

64. Component Port Crossing Test

Detailed description

UML component diagram with 2 components (Notifications, Templates). Notifications incoming ports /notifications/event-update, outgoing ports out1, out2. Templates incoming ports ts/template-data/{templateId}, outgoing ports out2. Connections: Notifications connects to Templates labeled "GET"; Templates connects to Notifications labeled "POST".

Components

  • Notifications — incoming ports /notifications/event-update; outgoing ports out1, out2
  • Templates — incoming ports ts/template-data/{templateId}; outgoing ports out2

Connections

  • Notifications connects to Templates labeled "GET"
  • Templates connects to Notifications labeled "POST"

65. Component Port Non-Crossing Test

Detailed description

UML component diagram with 3 components (Backend, Database, EventBus). Backend incoming ports httpIn, outgoing ports dbOut, eventOut. Database incoming ports dbIn. EventBus incoming ports eventIn. Connections: Backend connects to Database labeled "SQL"; Backend connects to EventBus labeled "publish".

Components

  • Backend — incoming ports httpIn; outgoing ports dbOut, eventOut
  • Database — incoming ports dbIn
  • EventBus — incoming ports eventIn

Connections

  • Backend connects to Database labeled "SQL"
  • Backend connects to EventBus labeled "publish"

66. Composition Behind Class (Circle/Drawing)

Detailed description

UML class diagram with 2 classes (Circle, Drawing), 1 abstract class (Shape), 1 interface (Serializable). Circle implements Serializable. Circle extends Shape. Circle composes Drawing.

Classes

  • Circle — Attributes: private radius: number — Operations: public constructor(radius: number); public area(): number; public serialize(): string; public deserialize(data: string)
  • Drawing — Attributes: none declared — Operations: none declared

Abstract classes

  • Shape — Attributes: protected color: string — Operations: public area(): number (abstract)

Interfaces

  • Serializable — Attributes: none declared — Operations: public serialize(): string; public deserialize(data: string)

Relationships

  • Circle implements Serializable
  • Circle extends Shape
  • Circle composes Drawing

67. Aggregation/Composition Vertical (UserService)

Detailed description

UML class diagram with 4 classes (UserService, UserRepository, Database, Cache). UserService aggregates UserRepository. UserRepository aggregates Database. UserRepository composes Cache.

Classes

  • UserService — Attributes: none declared — Operations: public constructor(repo: UserRepository); public getUser(id: string): string[]
  • UserRepository — Attributes: none declared — Operations: public constructor(db: Database); public findById(id: string): string[]
  • Database — Attributes: none declared — Operations: public query(sql: string): string[]
  • Cache — Attributes: none declared — Operations: public get(key: string): string | null; public set(key: string, value: string)

Relationships

  • UserService aggregates UserRepository
  • UserRepository aggregates Database
  • UserRepository composes Cache

68. Aggregation Detour (Priority/Task)

Detailed description

UML class diagram with 2 classes (Task, Epic), 2 interfaces (Identifiable, Assignable). Task implements Identifiable. Task implements Assignable. Epic extends Task. Task aggregates Priority.

Classes

  • Task — Attributes: private id: string; private assignee: string — Operations: public constructor(id: string, priority: Priority); public getId(): string; public assignTo(user: string)
  • Epic — Attributes: private subtasks: Task[] — Operations: public addSubtask(task: Task)

Interfaces

  • Identifiable — Attributes: none declared — Operations: public getId(): string
  • Assignable — Attributes: none declared — Operations: public assignTo(user: string)

Relationships

  • Task implements Identifiable
  • Task implements Assignable
  • Epic extends Task
  • Task aggregates Priority

69. Element Colors — Class Diagram

Detailed description

UML class diagram with 6 classes (Plain, Highlighted, Warning, Error, Success, Service). Plain references Highlighted. Highlighted references Warning. Warning references Error. Error references Success. Service references Plain.

Classes

  • Plain — Attributes: none declared — Operations: none declared

Relationships

  • Plain references Highlighted
  • Highlighted references Warning
  • Warning references Error
  • Error references Success
  • Service references Plain

70. Element Colors — State Machine

Detailed description

UML state machine diagram with 3 states (Idle, Failed, Done). Transitions: the initial pseudostate transitions to Idle; Failed transitions to Idle on reset; Done transitions to the final state.

States

  • Idle
  • Failed
  • Done

Transitions

  • the initial pseudostate transitions to Idle
  • Failed transitions to Idle on reset
  • Done transitions to the final state

71. Element Colors — Sequence Diagram

Detailed description

UML sequence diagram. Messages: Client calls Gateway with "request"; Gateway calls Service with "forward"; Service calls Database with "query"; Database replies to Service with "result"; Service replies to Gateway with "response"; Gateway replies to Client with "reply".

Messages

  • 1. Client calls Gateway with "request"
  • 2. Gateway calls Service with "forward"
  • 3. Service calls Database with "query"
  • 4. Database replies to Service with "result"
  • 5. Service replies to Gateway with "response"
  • 6. Gateway replies to Client with "reply"

72. Element Colors — Component Diagram

73. Texture Overlays — Class Diagram

Detailed description

UML class diagram with 7 classes (Plain, Colour, Hatched, Crosshatch, Dotted, Grid, Striped). Plain references Colour. Colour references Hatched. Hatched references Crosshatch. Crosshatch references Dotted. Dotted references Grid. Grid references Striped.

Classes

  • Plain — Attributes: none declared — Operations: none declared

Relationships

  • Plain references Colour
  • Colour references Hatched
  • Hatched references Crosshatch
  • Crosshatch references Dotted
  • Dotted references Grid
  • Grid references Striped

74. Texture Overlays — State Machine

Detailed description

UML state machine diagram with 2 states (Draft, Approved). Transitions: the initial pseudostate transitions to Draft; Approved transitions to the final state.

States

  • Draft
  • Approved

Transitions

  • the initial pseudostate transitions to Draft
  • Approved transitions to the final state

75. Texture Overlays — Component Diagram

76. Colors and Textures — Use Case Diagram

Detailed description

UML use case diagram with 2 actors (User #lightblue, Admin #lightcoral) and 4 use cases (Login, View Dashboard, Manage Users, Generate Report).

Actors

  • User #lightblue
  • Admin #lightcoral

Use cases

  • Login
  • View Dashboard
  • Manage Users
  • Generate Report

77. Colors and Textures — Deployment Diagram

Detailed description

UML deployment diagram with 5 nodes (WebServer #lightblue striped, AppServer #FFEB3B grid, StagingServer dotted, Primary #99FF99, Replica dotted).

Nodes

  • WebServer #lightblue striped
  • AppServer #FFEB3B grid
  • StagingServer dotted
  • Primary #99FF99
  • Replica dotted

78. Colors and Textures — Git Graph

Detailed description

Git commit graph with 8 commits across 3 branches (main with 4 commits: "Initial commit", "Add auth module", "Fix login bug", "Release v1.0"; feature with 3 commits, branched from B: "Start OAuth", "Implement flow", "Tests pass"; hotfix with 1 commit, branched from C: "Patch CVE"). HEAD on main.

Branches

  • main (4 commits)
  • feature (3 commits, branched from B)
  • hotfix (1 commit, branched from C)

Commits on main

  • A — Initial commit
  • B — Add auth module
  • C — Fix login bug
  • D — Release v1.0

Commits on feature

  • α — Start OAuth
  • β — Implement flow
  • γ — Tests pass

Commits on hotfix

  • h1 — Patch CVE

HEAD

  • HEAD points to main

79. Colors and Textures — Folder Tree

Detailed description

Folder tree rooted at project-root/ with 6 folders and 10 files. Top-level entries: src/, tests/, README.md, package.json.

Entries

  • @startuml (file)
  • project-root/ (folder)
  •  src/ (folder)
  •   components/ (folder)
  •    Button.tsx (file)
  •    Modal.tsx (file)
  •   utils/ (folder)
  •    auth.ts (file)
  •    helpers.ts (file)
  •   deprecated/ (folder)
  •    oldApi.ts (file)
  •    legacyAuth.ts (file)
  •  tests/ (folder)
  •   Button.test.tsx (file)
  •   auth.test.ts (file)
  •  README.md (file)
  •  package.json (file)
  • @enduml (file)

Venn Diagram Tests

80. Two-Set Venn (Default Palette)

81. Three-Set Venn (Classic Three-Circle)

82. Four-Set Venn (All 16 Regions)

83. Five-Set Venn (Grünbaum Ellipses)

84. Custom Colors — Contrast Detection

85. Custom Colors — CSS Named Colors (Light Fills)

86. Venn with Notes on Intersections

87. Venn with Stacked Notes and Outside-Targeted Note

88. Venn with Quoted Set Names (Spaces)

ER Diagram Tests (Chen Notation)

89. Basic ER — Library System

90. Weak Entity with Identifying Relationship

91. Ternary Relationship

92. Multiple Relationships Between Entities

93. Participation Constraints (Total vs Partial)