Introduction To Unified Modelling Language Uml
Introduction To Unified Modelling Language Uml
Class Diagrams
+ indicates public
- indicates private
# indicates protected
Class Diagrams
+ indicates public
- indicates private
# indicates protected
Class Diagrams
+ indicates public
- indicates private
# indicates protected
interface
Drawable
+draw()
+fill()
Inheritance
Inheritance Hierarchy
Animal
Invertebrae
Amphibian
Vertebrae
Reptile
Mammal
Dog
Cat
A Package
java.animals
Animal
Invertebrae
Amphibian
Vertebrae
Mammal
Dog
Reptile
Cat
Implements
Associations
zero or more
1.. one or more
Association Example
Aggregation
Employees Example
Firm
+main(args:String[]): void
1
1
Staff
-staffList: StaffMember[]
+payday(): void
StaffMember
#name: String
#address: String
#phone: String
0..*
+toString(): String
1
+pay(): double
Volunteer
+pay(): double
Employee
#socialSecurityNumber: String
#payRate: double
+toString(): String
+pay(): double
Executive
Hourly
-bonus: double
-hoursWorked: int
+awardBonus(execBonus:double): void
+pay(): double
+addHours(moreHours:int): void
+pay(): double
+toString(): String
javax.swing.JApplet
ActionListener
+actionPerformed(event:ActionEvent): void
Clock
#seconds: int
#minutes: int
#hours: int
Uses
1
+getSeconds(): int
+getMinutes(): int
+getHours(): int
+draw(page:Graphics): void
+paint(page:Graphics): void
+actionPerformed(event:ActionEvent): void
actionPerformed(event)
1
The paint method calls
the draw method
javax.swing.Timer
+Timer(delay:int,listener:ActionListener)
DigitalClock
+draw(page:Graphics): void
AnalogClock
+draw(page:Graphics): void
CmdLineAddressBook
Comparable
-mycontacts: AddressBook
+compareTo(obj:Object): int
1
Uses
1
Contact
AddressBook
-name: Name
-address: Address
-phone: String
-email: String
-homePage: String
-birthDate: ContactDate
-lastMeeting: ContactDate
-relationship: String
-photo: Image
-note: String
1
-contacts: Contact[]
-size: int
-capacity: int
-dataFile: String
-DEBUG: boolean = false
-tags: String[]
-nextToken: String
1
Uses
Uses
Uses
Uses
Uses
Uses
Uses
Uses
Uses
Uses
Uses
Name
-first: String
-middle: String
-last: String
Address
-postOfficeBox: String
-streetAddr: String
-city: String
-state: String
-postalCode: String
-country: String
ContactDate
-date: Date
-df: DateFormat
Get
Object Diagrams
Objects are drawn the same way as classes with 1/2/3 partitions.
The difference is that names for objects are underlined and consist
of the name and type of the objects.
When depicting object interactions, an active object is shown in
bold face.
Objects send messages to each other (through method class and
return values). This are shown as labeled links with an arrow
denoting the direction.
[object1:RectangleUser]
calculateArea
[object2:Rectangle]
Object Interaction
app: CmdLineAddressBook
mycontacts:AddressBook
mycontacts: AddressBook
...
contacts: Contact[]
...
create
addContact()
running AddMenu()
sortContacts()
running printMenu()
getAllContacts()
Contact[]
findByName(fname, lname)
running findMenu()
Contact[]