CSE2305 - Object-Oriented Software Engineering
Week 9

Topic 17: UML Notation


What is UML?

Graphical Components of UML

Use Cases

Get a Drink from the Drink Machine

  1. Customer selects type of drink (e.g. "Krap Cola")
  2. Customer presses button corresponding to selection
  3. System displays amount of $ to insert
  4. Users inserts money into slot
  5. When user has inserted enough money system issues drink
  6. User enjoys drink

Alternative: No drinks of selected type available
At step 2, system displays message "None Available, make another selection"
Allow customer to select new drink type

Alternative: Not enough change
User does not have enough change at step 4
System allows user to press "Cancel" button while waiting for correct change. Any coins already inserted are returned.
Return to step 1.

Representing classes¤

        [Diagram showing a cloud with a dashed outline, labelled with
         the underlined word "Vehicle" and with a list of attributes
         and operations beneath it]

class diagram

Class Diagrams from different perspectives:

Representing inheritance ¤

class Car Inherits from class Vehicle

Representing association

        Class diagram showing class Owner with a 1 to many association with class Vehicle


Same as previous diagram, but with arrows on each end of the association


Representing aggregation¤

Reference and Value Objects¤


Putting it together:

        [Diagram showing three class clouds, labelled "StudRec", "istream"
         and "ostream", with a line from the StudRec cloud to each of the other
         clouds. Each line has a circle at the StudRec end.]

Interfaces and Abstract Classes

class Window // abstract base class { public: virtual void toFront() = 0; virtual void toBack() = 0; }; class WindowsWindow : public Window { public: void toFront(); void toBack(); }; class X11Window : public Window { public: void toFront(); void toBack(); }; class MacWindow : public Window { public: void toFront(); void toBack(); };

        [Diagram showing two class clouds, labelled "BSTree",
         and "Node", with the Node cloud inside the BSTree cloud.]

Qualified Associations

class Order { private: Map <OrderLine, Product> lineItems; public: OrderLine getLineItem(Product aProduct); void addLineItem(Number amount, Product forProduct) }; class OrderLine { private: Number amount; }; class Product { public: . . . };

Representing other class¤-like entities

Putting it all together

        [Diagram showing a simple design illustrating most of the
         features described above.]

Representing objects

         [Diagram showing a cloud shape with a solid outline,
          labelled with the name of the object and its attributes.

Representing object interactions: the Sequence Diagram

         [Diagram showing a series of vertical dashed lines, each
          labelled with an object name. Arrows between the lines
          indicate member function calls, as time increased down
          the diagram.]

         [Previous diagram with swollen object lines whilst active.]


This material is part of the CSE2305 - Object-Oriented Software Engineering course.
Copyright © Jon McCormack & Damian Conway, 1998–2005. All rights reserved.