- Forward


UML Class Diagrams
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

UML Class Diagrams
Back SMYC Forward
  • Purpose:
    • Illustrate the specifications for the structure of classes
  • Contents:
    • Classes
    • Attributes
    • Methods
    • Relationships
The Basics
Back SMYC Forward
class_uml
Visibility
Back SMYC Forward
  • public:
    • +
  • private:
    • -
An Example
Back SMYC Forward
PictureFrame_start
Static Members, Final Attributes, and Constants
Back SMYC Forward
  • Static Members:
    • Underline the member
  • Final Attributes:
    • {readOnly} appears after the type
  • Constants:
    • Use normal style conventions
An Example (cont.)
Back SMYC Forward
PictureFrame_staticattributes
Associations
Back SMYC Forward
  • Definition:
    • Class A is said to be associated with class B if an object in class A can send a message to an object of class B or if an object in class A can create, receive or return objects of class B.
  • Components:
    • Name and/or Role
    • Multiplicity
Associations (cont.)
Back SMYC Forward
association-university
Dependencies
Back SMYC Forward
  • Definition:
    • Class A is said to depend on class B if a method in an object of class A is passed an object of class B.
  • Dependency or Association?
    • A dependency is a special types of association
Dependencies (cont.)
Back SMYC Forward
dependency-student
Aggregations
Back SMYC Forward
  • Definition:
    • An object of class A is an aggregate of ("has") objects of class B if an object of class B is a part of an object of class A.
  • Obvious Applications to Collections:
    • aggregation-collection
  • Less Obvious Applications:
    • aggregation-university
There's Always More to Learn
Back -