You are on page 1of 40

Ch-7 Diagrams

 The static parts of a system using one of the four


following diagrams.
1. Class diagram
2. Object diagram
3. Component diagram
4. Deployment diagram
 Five additional diagrams to view the dynamic parts of a
system.
1. Use case diagram
2. Sequence diagram
3. Collaboration diagram
4. Statechart diagram
5. Activity diagram

 The UML defines these nine kinds of diagrams


Structural Diagrams
 The UML's four structural diagrams exist to visualize,
specify, construct, and document the static aspects of a
system.

 The static aspects of a system represents stable


skeleton.
 The UML's structural diagrams are roughly organized
around the major groups of things you'll find when
modeling a system.

1. Class diagram--- Classes, interfaces, and collaborations


2. Object diagram--- Objects
3. Component diagram---Components
4. Deployment diagram---Nodes
1.Class Diagram
 A class diagram shows a set of classes, interfaces,
and collaborations and their relationships.

 Class diagrams are the most common diagram found in


modeling object-oriented systems.

 Class diagrams are used to illustrate the static design


view of a system.

 Class diagrams that include active classes are used to


address the static process view of a system.
 Now the following diagram is an example of an Order
System of an application. So it describes a particular
aspect of the entire application.
 First of all Order and Customer are identified as the two
elements of the system and they have a one to
many relationship because a customer can have multiple
orders.
 We would keep Order class is an abstract class and it
has two concrete classes (inheritance
relationship) SpecialOrder and NormalOrder.
 The two inherited classes have all the properties as
the Order class. In addition they have additional
functions like dispatch () and receive ().
2. Object Diagram

 An object diagram shows a set of objects and their


relationships.

 Object diagrams address the static design view or static


process view of a system just as do class diagrams.
 Now the customer object (C) is associated
with three order objects (O1, O2 and O3).
These order objects are associated with
special order and normal order objects
(S1, S2 and N1). The customer is having
the following three orders with different
numbers (12, 32 and 40) for the particular
time considered.
3. Component Diagram

 A component diagram shows a set of components


and their relationships.

 Component diagrams are used to illustrate the static


implementation view of a system.

 Component diagrams are related to class diagrams in


that a component typically maps to one or more classes,
interfaces, or collaborations.
 component diagram
Basic Component Diagram Symbols and Notations
 Component
 A component is a logical unit block of the system, a
slightly higher abstraction than classes. It is represented
as a rectangle with a smaller rectangle in the upper right
corner with tabs or the word <component> written above
the name of the component to help distinguish it from a
class.
 Interface
 An interface (small circle or semi-circle on a stick) describes a group
of operations used (required) or created (provided) by components.
A full circle represents an interface created or provided by the
component. A semi-circle represents a required interface, like a
person's input
 Dependencies
 Draw dependencies among components
using dashed arrows.
 Port
 Ports are represented using a square along the edge of the system or
a component. A port is often used to help expose required and
provided interfaces of a component.
4. Deployment Diagram
 A deployment diagram shows a set of nodes and
their relationships.

 Deployment diagrams are used to illustrate the static


deployment view of an architecture.

 Deployment diagrams are related to component


diagrams in that a node typically encloses one or more
components.
 Deployment diagram represents the deployment view of a system. It
is related to the component diagram. Because the components are
deployed using the deployment diagrams. A deployment diagram
consists of nodes. Nodes are nothing but physical hardwares used
to deploy the application.
 Deployment diagrams are useful for system engineers. An efficient
deployment diagram is very important because it controls the
following parameters
 Performance
 Scalability
 Maintainability
 Portability
 So before drawing a deployment diagram the following
artifacts should be identified:
 Nodes
 Relationships among nodes
The following deployment diagram is a sample to give an
idea of the deployment view of order management
system. Here we have shown nodes as:
 Monitor
 Modem
 Caching server
 Server
 deployment diagram
 The application is assumed to be a web based
application which is deployed in a clustered environment
using server 1, server 2 and server 3. The user is
connecting to the application using internet. The control
is flowing from the caching server to the clustered
environment.
 So the following deployment diagram has been drawn
considering all the points mentioned above:
Behavioral Diagrams
 The UML's five behavioral diagrams are used to
visualize, specify, construct, and document the dynamic
aspects of a system.

 You can think of the dynamic aspects of a system as


representing its changing parts.

 The dynamic aspects of a software system encompass


things as the flow of messages over time and the
physical movement of components across a network.
 The UML's behavioral diagrams are roughly organized around the
major ways you can model the dynamics of a system.

1. Use case diagram--- Organizes the behaviors of the system.

2. Sequence diagram ---Focused on the time ordering of messages.

3. Collaboration diagram---Focused on the structural organization of


objects that send and receive messages.

4. Statechart diagram---Focused on the changing state of a system


driven by events.

5. Activity diagram---Focused on the flow of control from activity to


activity.
Use Case Diagram

 A use case diagram shows a set of use cases and


actors (a special kind of class) and their
relationships.

 Apply use case diagrams to illustrate the static use case


view of a system.

 Use case diagrams are especially important in


organizing and modeling the behaviors of a system.
Interaction diagram

 Interaction diagram is the collective name given to


sequence diagrams and collaboration diagrams.
Sequence Diagram
 A sequence diagram is an interaction diagram that
emphasizes the time ordering of messages.

 A sequence diagram shows a set of objects and the


messages sent and received by those objects.

 Use sequence diagrams to illustrate the dynamic view


of a system.
 sequence diagram
Collaboration Diagram
 A collaboration diagram is an interaction diagram that
emphasizes the structural organization of the objects
that send and receive messages.

 A collaboration diagram shows a set of objects, links


among those objects, and messages sent and
received by those objects.

 Use collaboration diagrams to illustrate the dynamic


view of a system.
Statechart Diagram
 A statechart diagram shows a state machine,
consisting of states, transitions, events, and
activities.

 Use statechart diagrams to illustrate the dynamic view


of a system.

 Statechart diagrams emphasize the event-ordered


behavior of an object, which is especially useful in
modeling reactive systems.
 statechart diagram
Activity Diagram
 An activity diagram shows the flow from activity to
activity within a system.

 An activity shows a set of activities, the sequential or


branching flow from activity to activity.

 Use activity diagrams to illustrate the dynamic view of a


system.

 Activity diagrams emphasize the flow of control among


objects.
 So before drawing an activity diagram we should identify
the following elements:
 Activities
 Association
 Conditions
 Constraints
 Once the above mentioned parameters are identified we
need to make a mental layout of the entire flow. This
mental layout is then transformed into an activity
diagram.
The following is an example of an activity diagram for order
management system. In the diagram four activities are
identified which are associated with conditions. One
important point should be clearly understood that an
activity diagram cannot be exactly matched with the
code. The activity diagram is made to understand the
flow of activities and mainly used by the business users.
The following diagram is drawn with the four main activities:
 Send order by the customer
 Receipt of the order
 Confirm order
 Dispatch order
After receiving the order request condition checks are performed to
check if it is normal or special order. After the type of order is identified
dispatch activity is performed and that is marked as the termination of
the process.