Visual Modeling Techniques

Report
UML - Part 3
UML, page 1
Building Blocks of the UML
1. Modeling Element
1.
2.
3.
4.
Structural things
Behavioral things
Grouping things
Annotational things
2. Relationships
1.
2.
3.
4.
Dependency
Association
Generalization
Realization
3. Diagram
1.
2.
3.
4.
5.
6.
7.
8.
9.
Class diagram
Object diagram
Use case diagram
Sequence diagram
Collaboration
diagram
Statechart diagram
Activity diagram
Component diagram
Deployment diagram
UML, page 2
3 Diagrams
• A diagram is typically a view of a part of the
model, showing modeling elements and some of
the relationships between them.
• A diagram do not have to be complete, some
elements may be missing or presented in a
simplified fashion.
• UML: ”A well-formed model is one that is
semantically self-consistent and in harmony with
all related models.”
UML, page 3
There are 9 types of diagrams in UML
Dynamic views
Sequence
Diagrams
Collaboration
Diagrams
Activity
Diagrams
Statechart
Diagrams
Static views
Use Case
Diagrams
Some part of
the model might
not be visible on
any diagram
Class
Diagrams
Object
Diagrams
Model
Component
Diagrams
Deployment
Diagrams
UML, page 4
3.1 Use case diagram
actor
register a person
edit a registration/
delete a registration
User
association
use case
”include”
navigate/view
the register
include relationship
”include”
view next
person
”include”
view previous
person
system boundary
UML, page 5
Use Case Diagram - One More Example
”A use case is a specific way of using
the system by performing some
part of the functionality.
Each use case constitutes a complete
course of events initiated by an actor,
and it specifies the interaction that
takes place between an actor and
the system....”
I. Jacobson
Register as student
Person
<<become>>
Student
Register for course
Adm
<<become>>
Register for exam
CourseParticipant
Working with course
Instructor
Make/edit course
Lecturer
UML, page 6
3.2 Class Diagram
Person
name
: String
email
: String
homePage : String
1
responsible for
1 tech. responsible for
*
Course
: String
* name
description : String
CourseModule
*
1..* name
: String
description : String
1
1
Student
1
*
* StudentCourseProfile *
finished : boolean
When a student register for
course a StudentCourseProfile object
will be made!
UML, page 7
A Class Diagram
With Navigation
1
Person
responsible for
name
: String 1 tech. responsible for
imail
: String
homePage : String
*
Course
: String
* name
description : String
CourseModule
: String
* 1..* name
description : String
1
1
*
Student
1
* StudentCourseProfile *
finished : boolean
UML, page 8
A Class Diagram - Mapping to Java
1
Person
responsible for
name
: String 1 tech. responsible for
imail
: String
homePage : String
*
Course
: String
* name
description : String
1
*
Student
* StudentCourseProfile
1
finished : boolean
public class Person {
protected String name;
protected String imail;
protected String homePage;
//
// Navigation
protected Course[] responsibleFor;
protected Course[] techResponsibleFor;
public Person() {
}
}
public class Student extends Person {
//
// Navigation
public StudentCourseProfile[]
studentCourseProfile;
public Student() {
}
}
UML, page 9
A Class Diagram - Example With Interface
<<Interface>>
IStorable
Register
-reg
0..*
relization
public void read(){
terminal.print("Name: ");
name = terminal.readLine();
...
}
edit()
write()
read()
Person
edit()
write()
read()
relization/implements
Two different representation
of nearly the same
dependency
UML, page 10
A Class Diagram One More Example With Interface
UML, page 11
3.3 Object Diagram Capture Instances and Links
Class
Object
Company
noOfEmploees : int
HiA: Company
noOfEmploees=600
Possible object
name
object class
attribute
with value
UML, page 12
Object Diagram with Links
Class Diagram
Company
Object Diagram
Language:
:LocatedAt
Department
Gimlemoen:
Office
1
1..*
LocatedAt
Department
Office
*
1..*
HiA: Company
Possible
object diagram
Engineering :
Department
:LocatedAt
Grooseveien:
Office
Link - A link is an instance of an association,
analogous to an object being an instance of a class.
UML, page 13
Object diagram and Rational Rose 2000
Rational Rose 2000 does not have object diagrams,
but you can achieve much the same with a collobartion diagram
noOfEmploees = 600
HiA:Comany
Gimlemoen:Office
You can not specify attributes inside object;
One solution to this short-coming is to use a comment!
UML, page 14
3.4 Sequence diagram
user
controllerViewer
register
<command r>
<name,e-mail,..>
”create”
person
setData(name, ..)
insert(person)
UML, page 15
3.5 Collaboration diagram
1.2: ”create”
1.3: setDate(data)
1: register()
user
controllerViewer
person
1.1: data := getData()
1.4: insert(person)
register
UML, page 16
3.6 Statechart diagram
Waiting
do/ display("Off")
exit/ display("Time?")
StateChart for microwave
oven "control unit"
Power turned on
Set time
do/ get number
exit/ ^timer.setTime(timeRead)
[ Door closed ]
[ Door open ]
Disabled
Door closed
do/ display("Close Door")
Door open
Operating
do/ display ("time left")
exit/ ^heattingElement.powerOff()
entry/ ^heatingElement.powerOn()
Time out
Simple microwave oven:
- Power can be on or off
- Time can be set after the power has been turned on
End
UML, page 17
Statechart for Applet
Not
Loaded
init/init()
Running
Loaded start
stop/
stop()
/start()
destroy/destroy()
start/start()
Stopped
UML, page 18
3.7 Activity diagram Capture Dynamic Behaviour (Activity-oriented)
UML, page 19
Activity diagram One More Example
activity
product of activity
UML, page 20
Activity diagram - One More Example
user
controller
person
register
request registration
create person (object)
supply person-data
forward person-data
process person-data
insert person
UML, page 21
3.8 Component diagram Captures the Physical Structure of the Implementation
Demo.html
applet1.class
applet1.java
applet2.class
applet2.java
logo.gif
UML, page 22
Component diagram One More Example
Person.class
Register.class
ISortable
UML, page 23
3.9 Deployment diagram
Extended
VLAN
”Server”
”network” LAN
”PC”
”PC”
UML, page 24
Multi-tier
Architecture
client:
browser:
Internet
- MVC -
server1:
view:
browser/jsp/servlet
controller:
jsp/servlet
model:
businessObjects
:WebServer
:html
:html
:ServletContainer
s1:Servlet
s2:Servlet
b1:BusinessObject
j1:Jsp
j2:Jsp
Intranet
b3:BusinessObject
b2:BusinessObject
b4:BusinessObject
server2:
:DB
UML, page 25
References
•
[1] Grady Booch, James Rumbaugh and Ivar Jacobson:
The Unified Modeling Language User Guide.
Addison-Wesley, 1999
•
James Rumbaugh, Michael Blaha, William Premerlani, Frederick Eddy
and William Lorenzen:
Object-Oriented Modeling and Design.
Prentice Hall, 1991
•
Martin Fowler with Kendall Scott:
UML Distilled.
Addison-Wesley, 1997
•
Terry Quatrani:
Visual Modeling with Rational Rose and UML.
Addison-Wesley, 1998
•
Ari Jaaksi:
A Method for Your First Object-Oriented Project.
JOOP - The Journal of Object-Oriented Programming, Januar 1998
•
Rational software:
http://www.rational.com/uml/documentation.html
UML, page 26

similar documents