1. Slides material sources:
Lethbridge and Laganiere, Object-Oriented Software Engineering Practical Software
Development using UML and Java, 2005
Software Modeling – UML
www.cs.uoi.gr/~zarras/http://www.cs.uoi.gr/~zarras/se.htm
5. Branching in two ways
Branch
in
the
normal
process
Branch
that
can
happen
sometime
during
the
normal
process
–
could
be
exceptional
cases
…..
…..
No change in the internal state.
6. For and While within use cases
(rarely, however)
The system is up and running
The system is up and running
No change in the internal state of the system
No change in system state.
No change in the internal state of the system
8. Packages logically group other elements
(packages, classes, etc.)
A dependency from A to B means that
A is based on functionality provided by B.
I also means that changing B may affect A.
16. class Order {
private Address addr;
private ……
……..
public Order(Address a) {
addr = a;
}
…..
}
class Address {
…….
……
}
main() {
Address a = new Address();
// two orders with a shared address
Order o1 = new Order(a);
Order o2 = new Order(a);
}
18. class Building {
private Room livingRoom;
private ……
……..
public Building() {
// creates its own rooms
livingRoom = new Room();
}
// buildings cant share references to the same rooms via getters/setters
…..
}
class Room {
…….
……
}
main() {
// Buildings can not have common rooms
Building b1 = new Building ();
Building b2 = new Building ();
}
26. Alternative, optional interactions
Similarly can use an [alt] construct to show
alternative flows
http://www.tracemodeler.com/articles/a_quick_introduction_to_uml_sequence_diagrams/
30. Refines an abstract step of
Open File
Refines an abstract step of
Open File
Use case and Actor specializations
31. Use case: Open file
ID:UC1
Actors:
Ordinary User
Related use cases:
Generalization of:
• Open file by typing name
• Open file by browsing
Pre conditions: The application is up and running
Basic Flow:
1. The use case starts when the user chooses the “Open” command
2. The file open dialog appears.
3. The user specifies a file name
4. The user confirms the selection
5. The file open dialog disappears
Post conditions: The contents of the file are available to the user for further processing
32. Use case: Open file by typing name
ID:UC2
Actors:
Ordinary User
Related use cases: Specialization of: Open file
Pre conditions: The application is up and running
Basic Flow:
1. The use case starts when the user chooses the “Open” command
2. The file open dialog appears.
3. The user specifies a file name
1.The user selects the text field
2.The user types the file name
4. The user confirms the selection
5. The file open dialog disappears
Post conditions: The contents of the file are available to the user for further processing
Alternative flow:
1. A file not found exception is raised by the system
2. The application indicates the file the user specified does not exist
3. The user corrects the file name in the text field
Post conditions: The use case continues from step 4 of the main flow
33. Use case: Open file by browsing
ID:UC4
Actors:
Ordinary User
Related use cases: Specialization of: Open file
Pre conditions: The application is up and running
Basic Flow:
1. The use case starts when the user chooses the “Open” command
2. The file open dialog appears.
3. The user specifies a file name
1.While the desired file is not displayed in the files list of the file browser
1. The user selects a directory from the list
2.The application displays the contents of the directory in the files list
2.The user selects the desired file
4. The user confirms the selection
5. The file open dialog disappears
Post conditions: The contents of the file are available to the user for further processing
34. Refines an abstract step of
Open File
Refines an abstract step of
Open File
Describes a branching
flow that is complex OR
used in >1 use cases and
can stand as a separate
use case
Describes a part of
the normal flow
that is complex OR
used in >1 use cases
and can stand as a
separate use case
35. Use case: Open file by typing name
ID:UC2
Actors:
Ordinary User
Related use cases:
Specialization of: Open file
Extended by: Attempt to open file that does not exist
Pre conditions: The application is up and running
Basic Flow:
1. The use case starts when the user chooses the “Open” command
2. The file open dialog appears.
3. The user specifies a file name
1.The user selects the text field
2.The user types the file name
4. The user confirms the selection
5. The file open dialog disappears
Post conditions: The contents of the file are available to the user for further processing
Alternative flow:
Attempt to open file that does not exist
36. Use case: Attempt to open file that does not exist
ID:UC3
Actors:
Ordinary User
Related use cases:
Extension of: Open file by typing name
Pre conditions: The user executes UC2
Basic Flow:
1. A file not found exception is raised
2. The application indicates the file the user specified does not exist
3. The user corrects the file name in the text field
Post conditions: The main flow of UC2 continues at step 4
37. Use case: Open file by browsing
ID:UC4
Actors:
Ordinary User
Related use cases:
Specialization of: Open file
Includes: Browse for file
Pre conditions: The application is up and running
Basic Flow:
1. The use case starts when the user chooses the “Open” command
2. The file open dialog appears.
3. The user specifies a file name
1.Browse for file
4. The user confirms the selection
5. The file open dialog disappears
Post conditions: The contents of the file are available to the user for further processing
38. Use case: Browse for file
ID:UC5
Actors:
Ordinary User
Related use cases:
Included by: Open file by browsing
Pre conditions: The application is up and running
Basic Flow:
1. The use case starts at step 3 of UC4
2. While the desired file is not displayed in the files list of the file browser
1. The user selects a directory from the list
2.The application displays the contents of the directory in the files list
3.The user selects the desired file
Post conditions: UC 4 continues at step 4
42. Transitions, actions, activities
A transition represents a change of state in response to an event.
It is considered to occur instantaneously.
The transition may be labeled :
trigger is the cause of the transition, which could be a signal, an
event, a change in some condition, or the passage of time.
guard is a condition which must be true in order for the trigger to
cause the transition.
action is an action which will be invoked directly on the object that is
described by the state machine as a result of the transition.
[trigger] [guard] / [action]
43. Transitions, actions, activities
A state may have an associated entry behavior. This behavior, if defined, is
executed whenever the State is entered.
A state may also have an associated exit behavior, which, if defined, is
executed whenever the state is exited.
A State may also have an associated doActivity behavior. This behavior
commences execution when the state is entered (but only after the state
entry behavior has completed) and executes until it completes or the state
is exited.