Unit2 ST 2 Notes
Unit2 ST 2 Notes
The sequence diagram represents the flow of messages in the system and is also termed as
an event diagram. It helps in envisioning several dynamic scenarios. It portrays the
communication between any two lifelines as a time-ordered sequence of events, such that
these lifelines took part at the run time. In UML, the lifeline is represented by a vertical bar,
whereas the message flow is represented by a vertical dotted line that extends across the
bottom of the page. It incorporates the iterations as well as branching.
Purpose of a Sequence Diagram
1. To model high-level interaction among active objects within a system.
2. To model interaction among objects inside a collaboration realizing a use case.
3. It either models generic interactions or some certain instances of interaction.
Actor
A role played by an entity that interacts with the subject is called as an actor. It is out of the
scope of the system. It represents the role, which involves human users and external
hardware or subjects. An actor may or may not represent a physical entity, but it purely
depicts the role of an entity. Several distinct roles can be played by an actor or vice versa.
Activation
It is represented by a thin rectangle on the lifeline. It describes that time period in which an
operation is performed by an element, such that the top and the bottom of the rectangle is
associated with the initiation and the completion time, each respectively.
Messages
The messages depict the interaction between the objects and are represented by arrows.
They are in the sequential order on the lifeline. The core of the sequence diagram is formed
by messages and lifelines.
Following are types of messages enlisted below:
o Call Message: It defines a particular communication between the lifelines of
an interaction, which represents that the target lifeline has invoked an operation.
A note is the capability of attaching several remarks to the element. It basically carries useful
information for the modelers.
Sequence Fragments
1. Sequence fragments have been introduced by UML 2.0, which makes it quite
easy for the creation and maintenance of an accurate sequence diagram.
2. It is represented by a box called a combined fragment, encloses a part of
interaction inside a sequence diagram.
3. The type of fragment is shown by a fragment operator.
Types of fragments
Following are the types of fragments enlisted below:
Example of a Sequence Diagram
The View Items is further extended by several use cases such as; Search Items, Browse Items,
View Recommended Items, Add to Shopping Cart, Add to Wish list. All of these extended use
cases provide some functions to customers, which allows them to search for an item. The View
Items is further extended by several use cases such as; Search Items, Browse Items, View
Recommended Items, Add to Shopping Cart, Add to Wish list. All of these extended use cases
provide some functions to customers, which allows them to search for an item.
Both View Recommended Item and Add to Wish List include the Customer Authentication
use case, as they necessitate authenticated customers, and simultaneously item can be added to
the shopping cart without any user authentication.
Similarly, the Checkout use case also includes the following use cases, as shown below. It
requires an authenticated Web Customer, which can be done by login page, user authentication
cookie ("Remember me"), or Single Sign-On (SSO). SSO needs an external identity provider's
participation, while Web site authentication service is utilized in all these use cases.
UML Activity Diagram
In UML, the activity diagram is used to demonstrate the flow of control within the system
rather than the implementation. It models the concurrent and sequential activities.
The activity diagram helps in envisioning the workflow from one activity to another. It put
emphasis on the condition of flow and the order in which it occurs. The flow can be sequential,
branched, or concurrent, and to deal with such kinds of flows, the activity diagram has come
up with a fork, join, etc.
It is also termed as an object-oriented flowchart. It encompasses activities composed of a set
of actions or operations that are applied to model the behavioural diagram.
Components of an Activity Diagram
Following are the component of an activity diagram:
Activities
The categorization of behavior into one or more actions is termed as an activity. In other words,
it can be said that an activity is a network of nodes that are connected by edges. The edges
depict the flow of execution. It may contain action nodes, control nodes, or object nodes.
The control flow of activity is represented by control nodes and object nodes that illustrates the
objects used within an activity. The activities are initiated at the initial node and are terminated
at the final node.
Forks
Forks and join nodes generate the concurrent flow inside the activity. A fork node consists of
one inward edge and several outward edges. It is the same as that of various decision
parameters. Whenever a data is received at an inward edge, it gets copied and split crossways
various outward edges. It split a single inward flow into multiple parallel flows.
Join Nodes
Join nodes are the opposite of fork nodes. A Logical AND operation is performed on all of the
inward edges as it synchronizes the flow of input across one single output (outward) edge.
Pins
It is a small rectangle, which is attached to the action rectangle. It clears out all the messy and
complicated thing to manage the execution flow of activities. It is an object node that precisely
represents one input to or output from the action.
Notation of an Activity diagram
Activity diagram constitutes following notations:
Initial State: It depicts the initial stage or beginning of the set of actions.
Final State: It is the stage where all the control flows and object flows end.
Decision Box: It makes sure that the control flow or object flow will follow only one path.
Action Box: It represents the set of actions that are to be performed.
Figure 3: Synchronization
Process Views
• The process view of a system encompasses the threads and processes that form
the system’s concurrency and synchronization mechanisms.
• This view primarily addresses the performance, scalability, and throughput of
the system.
Modeling Multiple Flows of Control
To model multiple flows of control,
• Identify the opportunities for concurrent action and reify each flow as an active
class. Generalize common sets of active objects into an active class. Be careful not
to overengineer the process view of your system by introducing too much
concurrency.
• Consider a balanced distribution of responsibilities among these active classes,
then examine the other active and passive classes with which each collaborates
statically. Ensure that each active class is both tightly cohesive and loosely coupled
relative to these neighboring classes and that each has the right set of attributes,
operations, and signals.
• Capture these static decisions in class diagrams, explicitly highlighting each
active class.
• Consider how each group of classes collaborates with one another dynamically.
Capture those decisions in interaction diagrams. Explicitly show active objects as
the root of such flows. Identify each related sequence by identifying it with the
name of the active object.
• Pay close attention to communication among active objects. Apply synchronous
and asynchronous messaging, as appropriate.
• Pay close attention to synchronization among these active objects and the
passive objects with which they collaborate. Apply sequential, guarded, or
concurrent operation semantics, as appropriate.
Figure 4 shows part of the process view of a trading system.
In UML, each thing that happens is modeled as an event. An event is the specification of a
significant occurrence that has a location in time and space. A signal, passing of time and
change in state are asynchronous events. Calls are generally synchronous events, representing
invocation of an operation.
UML allows us to represent events graphically as shown below. Signals may be represented as
stereotyped classes and other events are represented as messages associated with transitions
which cause an object to move from one state to another.
Types of Events
Events may be external or internal. Events passed between the system and its actors are external
events. For example, in an ATM system, pushing a button or inserting a card are external
events. Internal events are those that are passed among objects living inside the system. For
example, a overflow exception generated by an object is an internal event.
In UML, we can model four kinds of events namely: signals, calls, passing of time and change
in state.
Signals
A signal is a named object that is sent asynchronously by one object and then received by
another. Exceptions are the famous examples for signals. A signal may be sent as the action of
a state in a state machine or as a message in an interaction. The execution of an operation can
also send signals.
In UML, we model the relationship between an operation and the events using a dependency
stereotyped with “send”, which indicates that an operation sends a particular signal.
Call Events
A call event represents the dispatch of an operation from one object to another. A call event
may trigger a state change in a state machine. A call event, in general, is synchronous.
This means that the sender object must wait until it gets an acknowledgment from the
receiver object which receives the call event. For example, consider the states of a customer
in an ATM application:
Timeline showing the change in the state of virus between dormant, Propagation,
Triggering, Execution
Duration Constraint
The duration constraint is a constraint of an interval, which refers to duration interval. It is used to
determine if the constraint is satisfied for a duration or not. The duration constraint semantics inherits
from the constraints.
The negative trace defines the violated constraints, which means the system is failed. A graphical
association between duration interval and the construct, which it constrains, may represent a duration
constraint.
Ice should melt into the water in 1 to 6 mins.
Time Constraint
It is an interval constraint, which refers to the time interval. Since it is a time expression, it
depicts if the constraint is satisfied or not. The constraints dispense its time constraints
semantics.
The negative trace defines the violated constraints, which means the system is failed. The time
constraint is represented by a graphical association between the time interval and the construct
which it constrains.
The graphical association is mainly represented by a small line in between a time interval and
an occurrence specification.
0
Purpose of a Component Diagram
Since it is a special kind of a UML diagram, it holds distinct purposes. It describes all the
individual components that are used to make the functionalities, but not the functionalities of
the system. It visualizes the physical components inside the system. The components can be a
library, packages, files, etc.
The component diagram also describes the static view of a system, which includes the
organization of components at a particular instant. The collection of component diagrams
represents a whole system.
The main purpose of the component diagram are enlisted below:
1. It envisions each component of a system.
2. It constructs the executable by incorporating forward and reverse engineering.
3. It depicts the relationships and organization of components.
When to use a Component Diagram?
It represents various physical components of a system at runtime. It is helpful in visualizing
the structure and the organization of a system. It describes how individual components can
together form a single system. Following are some reasons, which tells when to use component
diagram:
1. To divide a single system into multiple components according to the
functionality.
2. To represent the component organization of the system.
How to Draw a Component Diagram?
The component diagram is helpful in representing the physical aspects of a system, which are
files, executables, libraries, etc. The main purpose of a component diagram is different from
that of other diagrams. It is utilized in the implementation phase of any application.
Once the system is designed employing different UML diagrams, and the artifacts are prepared,
the component diagram is used to get an idea of implementation. It plays an essential role in
implementing applications efficiently.
Following are some artifacts that are needed to be identified before drawing a component
diagram:
1. What files are used inside the system?
2. What is the application of relevant libraries and artifacts?
3. What is the relationship between the artifacts?
Following are some points that are needed to be kept in mind after the artifacts are identified:
1. Using a meaningful name to ascertain the component for which the diagram is
about to be drawn.
2. Before producing the required tools, a mental layout is to be made.
3. To clarify the important points, notes can be incorporated.
Where to use Component Diagrams?
The component diagram is a special purpose diagram, which is used to visualize the static
implementation view of a system. It represents the physical components of a system, or we can
say it portrays the organization of the components inside a system. The components, such as
libraries, files, executables, etc. are first needed to be organized before the implementation.
The component diagram can be used for the followings:
1. To model the components of the system.
2. To model the schemas of a database.
3. To model the applications of an application.
4. To model the system's source code.
Basic Concepts of Component Diagram
A component represents a modular part of a system that encapsulates its contents and whose
manifestation is replaceable within its environment. In UML 2, a component is drawn as a
rectangle with optional compartments stacked vertically. A high-level, abstracted view of a
component in UML 2 can be modeled as:
1. A rectangle with the component's name
2. A rectangle with the component icon
3. A rectangle with the stereotype text and/or icon
Interface
In the example below shows two type of component interfaces:
Provided interface symbols with a complete circle at their end represent an interface that the
component provides - this "lollipop" symbol is shorthand for a realization relationship of an
interface classifier.
Required Interface symbols with only a half circle at their end (a.k.a. sockets) represent an
interface that the component requires (in both cases, the interface's name is placed near the
interface symbol itself).
Component Diagram Example - Using Interface (Order System)
Subsystems
The subsystem classifier is a specialized version of a component classifier. Because of this, the
subsystem notation element inherits all the same rules as the component notation element. The
only difference is that a subsystem notation element has the keyword of subsystem instead of
component.
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.
Relationships
Graphically, a component diagram is a collection of vertices and arcs and commonly contain
components, interfaces and dependency, aggregation, constraint, generalization, association,
and realization relationships. It may also contain notes and constraints.
Relationships Notation
Association:
• An association specifies a
semantic relationship that can occur
between typed instances.
• It has at least two ends
represented by properties, each of
which is connected to the type of
the end. More than one end of the
association may have the same
type.
Composition:
• Composite aggregation is a
strong form of aggregation that
requires a part instance be included
in at most one composite at a time.
• If a composite is deleted, all of
its parts are normally deleted with
it.
Aggregation
• A kind of association that has
one of its end marked shared as
kind of aggregation, meaning that it
has a shared aggregation.
Constraint
• A condition or restriction
expressed in natural language text
or in a machine readable language
for the purpose of declaring some of
the semantics of an element.
Dependency
• A dependency is a relationship
that signifies that a single or a set of
model elements requires other
model elements for their
specification or implementation.
• This means that the complete
semantics of the depending
elements is either semantically or
structurally dependent on the
definition of the supplier
element(s).
Links:
• A generalization is a taxonomic
relationship between a more
general classifier and a more
specific classifier.
• Each instance of the specific
classifier is also an indirect instance
of the general classifier.
• Thus, the specific classifier
inherits the features of the more
general classifier.
• Either by forward or reverse engineering, identify the set of source code files of
interest and model them as components stereotyped as files.
• For larger systems, use packages to show groups of source code files.
• Consider exposing a tagged value indicating such information as the version
number of the source code file, its author, and the date it was last changed. Use tools
to manage the value of this tag.
• Model the compilation dependencies among these files using dependencies.
Again, use tools to help generate and manage these dependencies.
When you are drafting a deployment planning for your company, you may find that you do
not know where to start or what you should focus on. The following checklist may give you
some ideas with planning for deployment:
How will your system be installed?
a. Who will install it? How long should it take to install?
b. Where the installation possibly fail?
c. How do you back out if the installation fails? How long does it take to
back out?
d. What is your installation window (during what time period can you
install your system)?
e. What backups do you need before installation?
f. Do you need to do a data conversion?
g. How do you know that the installation was successful?
I different versions of the system will be in production at the same time, how will you
resolve differences?