5.unit 3
5.unit 3
UNIT III
. The UML includes interaction diagrams to illustrate how objects interact via messages. They
are used for dynamic object modeling. An interaction diagram is a type of UML diagram that is
used to capture the interactive behavior of a system. Interaction diagrams focus on describing the
flow of messages within a system, providing context for one or more lifelines within a system. In
addition, interaction diagrams can be used to represent the ordered sequences within a system
and act as a means of visualizing real-time data via UML. There are two common types:
   1. Sequence diagrams.
   2. communication diagrams.
       Sequence diagrams illustrate interactions in a kind of fence format, in which each new
object is added to the right. A sequence diagram shows object interactions arranged in time
sequence. It depicts the objects and classes involved in the scenario and the sequence of
messages exchanged between the objects needed to carry out the functionality of the scenario.
Sequence diagrams are typically associated with use case realizations in the Logical View of the
system under development. Sequence diagrams are sometimes called event diagrams or event
scenarios.
3.2.2.Communication diagrams
3.2.6.Singleton Objects
       In s singleton pattern there is only one instance of a class instantiated. Singleton object
is marked with a '1' in the upper right corner of the lifeline box.
3.3.1Messages
       Sequence diagrams may also show the focus of control using an execution specification
bar. The bar is optional.
3.3.3.Reply or Returns
There are two ways to show the return result from a message:
Message being sent from an object to itself by using a nested activation bar.
Object creation notation is shown in dashed line with filled arrow ( synchronous message), or
open (stick arrow) if an asynchronous call.
3.3.6.Object Destruction
The explicit destruction of an object can be shown with <<destroy>>sterotype message with
larger X.
3.3.7. Frames
Frames are regions or fragments of the diagrams; they have an operator or label (such as loop)
and a guard .The [boolean test] guard should be placed over the lifeline to which it belongs.
An OPT frame is placed around one or more messages. Notice that the guard is placed over the
related lifeline.
A common algorithm is to iterate over all members of a collection (such as a list or map),
sending the same message to each.
A system sequence diagram (SSD) is a fast and easily created artifact that illustrates input and
output events related to the systems under discussion. They are input to operation contracts and
most importantly object design.
    The UML includes sequence diagrams as a notation that can illustrate actor interactions
      and the operations initiated by them.
    A system sequence diagram is a picture that shows, for one particular scenario of a use
      case, the events that external actors generate, their order, and inter-system events.
    All systems are treated as a black box; the emphasis of the diagram is events that cross
      the system boundary from actors to systems.
    A UML state machine diagram, , illustrates the interesting events and states of an object,
      and the behavior of an object in reaction to an event.
    Transitions are shown as arrows, labeled with their event.
    States are shown in rounded rectangles.
    It is common to include an initial pseudo-state, which automatically transitions to another
      state when the instance is created.
    A state machine diagram shows the lifecycle of an object: what events it experiences, its
      transitions, and the states it is in between these events.
    It need not illustrate every possible event; if an event arises that is not represented in the
      diagram, the event is ignored as far as the state machine diagram is concerned.
    Therefore, we can create a state machine diagram that describes the lifecycle of an object
        at arbitrarily simple or complex levels of detail, depending on our needs.
    If an object always responds the same way to an event, then it is considered state-
        independent (or modeless) with respect to that event.
    For example, if an object receives a message, and the responding method always does the
        same thing. The object is state-independent with respect to that message.
    If, for all events of interest, an object always reacts the same way, it is a state-
        independent object. By contrast, state-dependent objects react differently to events
        depending on their state or mode.
Guideline
    Consider state machines for state-dependent objects with complex behavior, not for state-
        independent objects .For example, a telephone is very state-dependent.
    The phone's reaction to pushing a particular button (generating an event) depends on the
        current mode of the phone off hook, engaged, in a configuration subsystem, and so forth.
The following is a list of common objects which are often state-dependent, and for which it may
be useful to create a state machine diagram:
   a) Communication Protocols TCP, and new protocols, can be easily and clearly
       understood with a state machine diagram. The diagram illustrates when operations are
       legal. For example, a TCP "close" request should be ignored if the protocol handler is
       already in the "closed" state.
    Transition Actions and Guards - A transition can cause an action to fire. In a software
implementation, this may represent the invocation of a method of the class of the state machine
diagram.A transition may also have a conditional guardor boolean test. The transition only
occurs if the test passes.
3.4.8.Nested States
A state allows nesting to contain sub states; a sub state inherits the transitions of its super state
(the enclosing state). Sub states may be graphically shown by nesting them in a super state box.
For example, when a transition to the Active state occurs, creation and transition into the
PlayingDialTone substate occurs.
There are no really interesting complex reactive objects in the case studies, a state machine
diagram to show legal sequencing of use case operation.
Figure 3.16 sample state machine for legal sequence of use case operations.
3.5.ACTIVITY DIAGRAMS
A UML activity diagram shows sequential and parallel activities in a process. They are useful for
modeling business processes, workflows, data flows, and complex algorithms. Activity
diagrams are graphical representations of workflows of stepwise activities and actions with
support for choice, iteration and concurrency. In the Unified Modeling Language, activity
diagrams are intended to model both computational and organizational processes (i.e.,
workflows), as well as the data flows intersecting with the related activities. Although activity
diagrams primarily show the overall flow of control, they can also include elements showing the
flow of data between activities through one or more data stores
3.5.2. Signals:
   Signals are useful when you need to model events such as time triggering an action or a
   cancellation request.
3.5.3.Rake symbols:
       Rake symbol indicates an activity is expanded in another activity diagram also it is called
as action symbol indicates that the activity being invoked is described on another diagram. For
example, to transform light into video signals, the Operate Camera activity invokes other
activities that perform various subtasks using call behavior actions.
Guidelines
    This technique proves most valuable for very complex processes, usually involving many
       parties.
Department of CSE                                                                    Page 93
                                       CS8592/OBJECT ORIENTED ANALYSIS AND DESIGN
    If modeling a business process, take advantage of the "rake" notation and sub-activity
      diagrams.
    Strive to make the level of abstraction of action nodes roughly equal within a diagram.
Figure 3.20. Modeling the Process Sale use case with an activity diagram.
    Activity diagrams are espically applicable within the business Modelling discipline of the
      UP.
    The purpose of Business Modeling is to understand and communicate "the structure and
      the dynamics of the organization in which a system is to be deployed".
    A key artifact of the Business Modeling discipline is the Business Object Model .
    Business Object Model visualizes how a business works, using UML class, sequence,
      and activity diagrams.
    Thus, activity diagrams are especially applicable within the Business Modeling discipline
      of the UP.
    Activity Diagrams describe how activities are coordinated to provide a service which can
       be at different levels of abstraction.
    Typically, an event needs to be achieved by some operations, particularly where the
       operation is intended to achieve a number of different things that require coordination, or
       how the events in a single use case relate to one another, in particular, use cases where
       activities may overlap and require coordination.
    It is also suitable for modeling how a collection of use cases coordinate to represent
       business workflows
3.7.PACKAGE DIAGRAMS
    UML package diagrams are often used to illustrate the logical architecture of a system-
       the layers,subsystems,packages etc.,
    A layer can be modeled as a UML package.
    A UML package diagram provides a way to group elements. A UML package can group
       anything:classes,other packages, use cases etc.
Package: Package is a namespace used to group together elements that are semantically related
and might change together.
package:
   Use a tabbed folder to illustrate packages.Name of the package can be written on the tab or
   inside the folder.
   Visibility:Visibility markers signify who can access theInformation contained within the
   package.
   Dependency: Dependency defines a relationship in which changes to one package will affect
another package.
In addition to the standard UML Dependency relationship, there are two special types of
dependencies defined between packages:
        package import
        package merge
A package merge is a directed relationship between two packages, that indicates that the contents
of the two packages are to be combined. It is very similar to Generalization in the sense that the
source element conceptually adds the characteristics of the target element to its own
characteristics resulting in an element that combines the characteristics of both .In this
relationship, if an element exists within both the source package and the target package, then the
source element's definition will be expanded to include the target element's definition.
3.7.2. Example:
3.8.DEPLOYMENT DIAGRAMS
3.8.1.Example:
Figure3.22Deployment diagram
          1) device node (or device) A physical (e.g., digital electronic) computing resource
             with processing and memory services to execute software, such as a typical
             computer or a mobile phone.
Department of CSE                                                                      Page 98
                                         CS8592/OBJECT ORIENTED ANALYSIS AND DESIGN
3.9.COMPONENT DIAGRAMS
    A component represents a modular part of a system that encapsulates its contents and
       whose manifestation is replaceable within its environment.
    A component defines its behavior in terms of provided and required interfaces. As such,
       a component serves as a type, whose conformance is defined by these provided and
       required interfaces.
The second point implies that a component tends to have little or no dependency on other
external elements (except perhaps standard core libraries); it is a relatively stand-alone module.
A good analogy for software component modeling is a home entertainment system; we expect to
be able to easily replace the DVD player or speakers. They are modular, self-contained,
replaceable, and work via standard interfaces.
    Component diagrams are special type of UML diagrams used for different purposes.
    These diagrams show the physical components of a system. To clarify it, we can say that
       component diagrams describe the organization of the components in a system.
    Organization can be further described as the location of the components in a system.
       These components are organized in a special way to meet the system requirements.
    Before implementing the application, these components are to be organized. This
       component organization is also designed separately as a part of project execution.
    Component diagrams are very important from implementation perspective.
    Thus, the implementation team of an application should have a proper knowledge of the
       component details
    Component diagrams can be used to –
           1) Model the components of a system.
           2) Model the database schema.
           3) Model the executables of an application.
           4) Model the system's source code
A UML activity diagram shows sequential and parallel activities in a process. They are useful for
modeling business processes, workflows, data flows, and complex algorithms. Basic UML
activity diagram notation illustrates an action, partition, fork, join, and object node. In essence,
this diagram shows a sequence of actions, some of which may be parallel. Most of the notation is
self-explanatory;
A system sequence diagram (SSD) is a picture that shows, for a particular scenario of a use case,
the events that external actors generate their order, and inter-system events. All systems are
treated as a black box; the emphasis of the diagram is events that cross the system boundary from
actors to systems.
System behavior is a description of what a system does, without explaining how it does it. One
Part of that description is a system sequence diagram. Other parts include the Use cases, and
system contracts(tobediscussedlater).
SSDs can also be used to illustrate collaborations between systems, such as between the Next
Gen POS and the external credit payment authorizer. However, this is deferred until a later
iteration in the case study, since this iteration does not include remote systems collaboration. 4.
Define System Events and the System Boundary.
System events (and their associated system operations) should be expressed at the level of intent
rather than in terms of the physical input medium or interface widget level.
It also improves clarity to start the name of a system event with a verb Thus "enter item" is better
than "scan" (that is, laser scan) because it captures the intent of the operation while remaining
abstract and noncommittal with respect to design choices about what interface is used to capture
the system event.
The term interaction diagram is a generalization of two more specialized UML diagram types;
both can be used to express similar message interactions: . Collaboration diagrams . Sequence
diagrams
A link is a connection path between two objects; it indicates some form of navigation And
visibility between the objects is possible . More formally, a link is an instance of an association.
For example, there is a link or path of navigation from a Register to a Sale, along which
messages may flow, such as the make 2 Payment message.
Each message between objects is represented with a message expression and small arrow
indicating the direction of the message. Many messages may flow along this link. A sequence
number is added to show the sequential order of messages in the current thread of control.
Any message can be used to create an instance, but there is a convention in the UML to use a
message named create for this purpose. If another (perhaps less obvious) message name is used,
the message may be annotated with a special feature called a UML stereotype, like so: «create».
The create message may include parameters, indicating the passing of initial values. This
indicates, for example, a constructor call with parameters in Java.
• A telephone is in the state of being "idle" after the receiver is placed on the hook and until it Is
taken off the hook. A transition is a relationship between two states that indicates that when an
event occurs, the Object moves from the prior state to the subsequent state. For example: •
When the event "off hook" occurs, transition the telephone from the "idle" to "active" state.
A UML state chart diagram, illustrates the interesting events and states of an object, and the
behavior of an object in reaction to an event. Transitions are shown as arrows, labeled with their
event. States are shown in rounded rectangles. It is common to include an initial pseudo-state,
which automatically transitions to another state when the instance is created.
There is not one model in the UP called the "state model." Rather, any element in any model
(Design Model, Domain Model, and so forth) may have a state chart to better understand or
communicate its dynamic behavior in response to events. For example, a state chart associated
with the Sale design class of the Design Model is itself part of the Design Model.
- Hard-coded conditional tests for out-of-order events - Use of the State pattern (discussed in a
subsequent chapter) - disabling widgets in active windows to disallow illegal events (a desirable
approach) - A state machine interpreter that runs a state table representing a use case State chart
diagram.
External event—also known as a system event, is caused by something (for example, an actor)
outside our system boundary. SSDs illustrate external events. Noteworthy external events
precipitate the invocation of system operations to respond to them.
- When a cashier presses the "enter item" button on a POS terminal, an external event has
occurred.
Temporal event—caused by the occurrence of a specific date and time or passage of time. In
terms of software, a temporal event is driven by a real time or simulated-time clock.
-Suppose that after an end Sale operation occurs, a make Payment operation must occur within
five minutes, otherwise the current sale is automatically purged.
PART B QUESTIONS
1.What is the purpose of state chart diagrams?How to draw state chart diagram?Explain
2.Discuss about UML deployment and component diagrams.Draw the diagrams for banking
application?
PART C
a)ATM system