Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Unified Modeling

Language
(UML)
UML
• Graphical notation to support expressing Object-
Oriented Designs in a compact form
• Notation is quite expressive, includes many different
types of diagrams, and can be used to generate code

• We will use Class diagrams from UML


• Capture a high level description of a class as well as
the relationships with other classes.
Simple text notation
• The UML diagrams have a simple text notation to
indicate visibility.
• Consider a class with a member variable of type String
called “name”

Notation Meaning Example


- private - name : String
+ name : String or
+ public
name : String
# protected # name : String
Graphical Notations
• Class diagram
• Name on top, usually
bolded
• Attributes are member vars
• Operations are methods

• Interface diagram
• Adds the stereotype
designation <<interface>>
Inheritance
• Inheritance relates two
classes
• One class is defined as an
extension of the other
• Existing one is called: base
class, superclass
• New class called: subclass,
or derived class

• Connected in diagram with


arrow with white triangle
Aggregation
• One class is made up of
others (aggregation of
objects)

• BigClass is defined in terms


of other classes
• Some of member vars are
objects of another class
Association
• Relationship between objects
• Different from aggregation
because objects are
considered “complete”
whether the association is
in place or not.
• Example: student object
has an association with
several course sections, the
ones that she is registered
in.
• Can have cardinality
Association
• Sometimes the association is
an object by itself
• Often when the association
holds data
• Example: employment
associates Person with
Company, includes
information about
employment date, position
title, etc.

You might also like