Professional Documents
Culture Documents
(SDA)
Lecture # 5 & 6
3
UML diagrams
4
Dependency Relationships
5
Structural diagram: object diagram 1/2
Derived from class diagrams
Similar to a class diagram except it shows the instances of the classes
in the system and the relationship that exists between them
Represent the static view of a system but this static view is a
snapshot of the system at a particular moment
Help to understand functional requirements of a system
Example: snapshot of moving train
6
Structural diagram: object diagram 2/2
7
Structural diagram: package diagram
A package is represented by a tabbed folder that indicates where all included
classes and subpackages reside.
Packages play a similar role as a directory for grouping files in a file system;
they allow the organization of all closely related classes in one “container.”
Example: java packages as java, lang, awt, javax, swing, etc.
This diagram shows the dependency relationship between packages in which
a change of one package may result in changes in other packages.
8
Behavioral Diagrams Activity Diagram
Workflow-oriented diagram describing the steps in a single process.
Can be used :
To model a human task (a business process, for instance).
To describe a system function that is represented by a use case.
In operation specifications, to describe the logic of an operation.
Involves complex workflow, decision making, concurrent executions,
exception handling, process termination, etc.
One starting point and one or more finishing points.
Identify the following elements before drawing an activity diagram:
Activities
Association
Conditions
9
10
Behavioral Diagrams Activity Diagram in UML
Fork notation
Join Notation
11
Behavioral Diagrams State Machine Diagram
Also called state chart and state transition diagram
Mostly drawn for a single class to show the lifetime behavior
(different states ) of a single object or entire system
event-oriented diagram objects change their states in response to
external or internal events
a state is a rounded rectangle with three subdivisions: state name,
state variables, and state activities.
A complex composite state may have a subordinate state diagram.
One starting point in a solid black circle and has one or more
endpoints
12
13
Behavioral Diagrams State Machine Diagram
State machine diagram of ‘Order Processing System’ login use case ??
14
Activity diagram vs state machine diagram 1/2
Capture high level aspects of the whole Mostly drawn for a single class to show the
system activities. lifetime behavior (different states ) of a single
object or entire system
15
Activity diagram vs state machine diagram 2/2
16
Behavioral Diagrams Interaction Diagrams
17
Behavioral Diagrams Sequence Diagram
One of the most important and widely used UML diagram
Is a time oriented interaction diagram
Usually, one sequence diagram corresponds to one use case.
Activations represent the object-activated state in which it receives
or sends out messages.
Synchronous message represented by a line with full arrow head
Asynchronous message represented by a line with half arrowhead
Can branch or fork many separate lifelines for the if-selection
scenario conditions; eventually all forked lines will join together.
18
19
Behavioral Diagrams Sequence Diagram
20
Communication or collaboration diagrams
Here method call sequence is indicated by some numbering technique.
The number indicates how the methods are called one after another.
shows the object organization.
21
Sequence diagram vs collaboration diagrams
To choose between these two diagrams, emphasis is placed on the type
of requirement. If the time sequence is important, then the sequence
diagram is used. If organization is required, then collaboration diagram is
used.
22
Case Study
Assume that you are going to construct an Order Processing System (OPS) that is
an important part of an online store.
The online store has the following subsystems:
An online product catalog
Order processing system for user orders
Financial department
Shipping department,
OPS must interact with other components and provide the following services to
customers:
Each customer has an online shopping cart to add and remove items
A customer is able to check out using a credit card.
Before the transaction is completed, a customer should be able to learn
about his order's estimated arrival date
A customer can choose to cancel the transaction by clearing all items in the
shopping cart.
OPS must be available as a web accessible system.
23
OO Development process
OO
OO program
Development
24
OO Analysis Analysis class diagram of OPS
26
OO development process OO Design
OO Analysis use-case diagram and analysis class diagrams are
very useful in the OO design process
27
OO Design
28
OO Design:
1) Identify Classes: Class-Responsibility-Collaborator (CRC) Card
CRC card modeling is a team-based approach consists of three
sections: class name, responsibility, and collaborator.
30
CRC card for Register Use case registrationController
31
CRC card for Register Use case CustomerInfoDB
32
CRC card for SessionController class
33
OO Design: 2. Construct an Interaction Diagram
UML provides two popular forms of interaction diagrams:
i. Sequence diagrams
ii. Communication or collaboration diagrams.
34
Sequence Diagram of registration use case
35
OO Design 3) Build a State Machine Diagram
Detailed level design begins after completion of analysis class
diagram, CRC card designs and interaction diagrams for each use
case
36
State Machine Diagram
A state machine diagram consists of two types of basic elements:
(1) state
(2) Transition
37
Composite sate
38
OO Design 4) Class Specification
40
Class Specification of SessionController class
41
Intent of 4+1 view model
The views are used to describe the system from the viewpoint of
different stakeholders, such as end-users, developers and project
managers.
Scenarios
Viewer
: All users of other views and Evaluators.
Considers : System consistency, validity
(Object-oriented Decomposition)
This view shows the components (objects) of the system as well as their
interactions / relationships.
The use case view has a special significance. When all other views are
finished, it's effectively redundant.
all other views would not be possible without use case view .
It details the high levels requirements of the system.
The other views detail how those requirements are realized.
Is it important?
It makes modeling easier.
https://www.cs.ubc.ca/~gregor/teaching/papers/4+1view-architecture.pdf
https://www.visual-paradigm.com/guide/uml-unified-modeling-language/what-i
s-sequence-diagram/
https://www.uml-diagrams.org/sequence-diagrams-combined-fragment.html
https://www.geeksforgeeks.org/association-composition-aggregation-java/
https://www.c-sharpcorner.com/UploadFile/3614a6/accessors-and-mutators-i
n-java/#:~:text=A%20Mutator%20method%20is%20commonly,in%20other%2
0words%20change%20things.&text=Mutator%20methods%20do%20not%20
have,depending%20on%20their%20private%20field
.
55
56