Uml Unit-3 Answers
Uml Unit-3 Answers
Modeling an operation:
To model an operation:
1. Collect the abstractions involved in an operation like: parameters, attributes of the enclosing class and the
neighboring class.
2. Identify the operation’s pre-conditions and the operation’s post-conditions.
3. Beginning at the operation’s initial state, define the actions and activities and renderthem as action states
and activity states respectively.
4. Use branching as necessary to specifyconditionalpaths and iteration.
5. If thisoperationisowned by an active class, use forking and joining as necessary to specifyparallel flows of
control.
UML UNIT-3
A set of messages that are interchanged between the entities to achieve certain specified tasks in the system is
termed as interaction. It may incorporate any feature of the classifier of which it has access. In the interaction
diagram, the critical component is the messages and the lifeline.
Actors: In the collaboration diagram, the actor plays the main role as it invokes the interaction. Each actor has
its respective role and name. In this, one actor initiates the use case.
Links: The link is an instance of association, which associates the objects and actors. It portrays a relationship
between the objects through which the messages are sent. It is represented by a solid line. The link helps an
object to connect with or navigate to another object, such that the message flows are attached to links.
Messages: It is a communication between objects which carries information and includes a sequence number,
so that the activity may take place. It is represented by a labeled arrow, which is placed near a link. The
messages are sent from the sender to the receiver, and the direction must be navigable in that particular
direction. The receiver must understand the message.
1. Actors
Actors are external entities that interact with the system. These can include users, other systems, or hardware
devices. In the context of a Use Case Diagram, actors initiate use cases and receive the outcomes. Proper
identification and understanding of actors are crucial for accurately modeling system behavior.
2. Use Cases
Use cases are like scenes in the play. They represent specific things your system can do. In the online
shopping system, examples of use cases could be “Place Order,” “Track Delivery,” or “Update Product
Information”. Use cases are represented by ovals.
UML UNIT-3
Use-Case-
3. System Boundary
The system boundary is a visual representation of the scope or limits of the system you are modeling. It
defines what is inside the system and what is outside. The boundary helps to establish a clear distinction
between the elements that are part of the system and those that are external to it. The system boundary is
typically represented by a rectangular box that surrounds all the use cases of the system.
1. Association Relationship
The Association Relationship represents a communication or interaction between an actor and a use case. It is
depicted by a line connecting the actor to the use case. This relationship signifies that the actor is involved in
the functionality described by the use case.
2. Include Relationship
The Include Relationship indicates that a use case includes the functionality of another use case. It is denoted
by a dashed arrow pointing from the including use case to the included use case. This relationship promotes
modular and reusable design.
4. Generalization Relationship
The Generalization Relationship establishes an “is-a” connection between two use cases, indicating that one
use case is a specialized version of another. It is represented by an arrow pointing from the specialized use
case to the general use case.
This use case diagram is a visual representation of the process required to write and publish a book. Whether
you’re an author, an agent, or a bookseller, inserting this diagram into your use case scenario can help your
team publish the next big hit. Try this demo template to get started on your own.
UML UNIT-3
6) What is sequence diagram? Explain the common modelling techniques of sequence diagram.
A)Sequence Diagram
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.
Lifeline
An individual participant in the sequence diagram is represented by a lifeline. It is positioned at the top of the
diagram.
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.
UML UNIT-3
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.
o Call Message: It defines a particular communication between the lifelines of an interaction, which
represents that the target lifeline has invoked an operation.
o Return Message: It defines a particular communication between the lifelines of interaction that
represent the flow of information from the receiver of the corresponding caller message.
UML UNIT-3
o Self Message: It describes a communication, particularly between the lifelines of an interaction that
represents a message of the same lifeline, has been invoked.
o Recursive Message: A self message sent for recursive purpose is called a recursive message. In other
words, it can be said that the recursive message is a special case of the self message as it represents
the recursive calls.
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.
Any online customer can search for a book catalog, view a description of a particular book, add a book to its
shopping cart, and do checkout.
UML UNIT-3
Benefits of a Sequence Diagram
1. In the case of too many lifelines, the sequence diagram can get more complex.
2. The incorrect result may be produced, if the order of the flow of messages changes.
3. Since each sequence needs distinct notations for its representation, it may make the diagram more
complex.
4. The type of sequence is decided by the type of message.
7) What are the components of collaboration diagrams? Explain the common modelling techniques
of collaboration
The collaboration diagram is used to show the relationship between the objects in a system. Both the sequence
and the collaboration diagrams represent the same information but differently. Instead of showing the flow of
messages, it depicts the architecture of the object residing in the system as it is based on object-oriented
programming. An object consists of several features. Multiple objects present in the system are connected to
each other. The collaboration diagram, which is also known as a communication diagram, is used to portray
the object's architecture in the system.
Following are the components of a component diagram that are enlisted below:
1. Objects: The representation of an object is done by an object symbol with its name and class
underlined, separated by a colon.
In the collaboration diagram, objects are utilized in the following ways:
1. The object is represented by specifying their name and class.
2. It is not mandatory for every class to appear.
3. A class may constitute more than one object.
4. In the collaboration diagram, firstly, the object is created, and then its class is specified.
5. To differentiate one object from another object, it is necessary to name them.
2. Actors: In the collaboration diagram, the actor plays the main role as it invokes the interaction. Each
actor has its respective role and name. In this, one actor initiates the use case.
3. Links: The link is an instance of association, which associates the objects and actors. It portrays a
relationship between the objects through which the messages are sent. It is represented by a solid line.
The link helps an object to connect with or navigate to another object, such that the message flows are
attached to links.
4. Messages: It is a communication between objects which carries information and includes a sequence
number, so that the activity may take place. It is represented by a labeled arrow, which is placed near
a link. The messages are sent from the sender to the receiver, and the direction must be navigable in
that particular direction. The receiver must understand the message.
UML UNIT-3
1. Determine the behavior for which the realization and implementation are specified.
2. Discover the structural elements that are class roles, objects, and subsystems for performing the
functionality of collaboration.
1. Choose the context of an interaction: system, subsystem, use case, and operation.
1. Multiple objects residing in the system can make a complex collaboration diagram, as it becomes
quite hard to explore the objects.
2. It is a time-consuming diagram.
3. After the program terminates, the object is destroyed.
4. As the object state changes momentarily, it becomes difficult to keep an eye on every single that has
occurred inside the object of a system.
UML behavioral diagrams visualize, specify, construct, and document the dynamic aspects of a
system. The behavioral diagrams are categorized as follows: use case diagrams, interaction diagrams,
state–chart diagrams, and activity diagrams.
Use case
A use case describes the sequence of actions a system performs yielding visible results. It shows the
interaction of things outside the system with the system itself. Use cases may be applied to the whole
system as well as a part of the system.
Actor
An actor represents the roles that the users of the use cases play. An actor may be a person (e.g.
student, customer), a device (e.g. workstation), or another system (e.g. bank, institution).
UML UNIT-3
The following figure shows the notations of an actor named Student and a use case called Generate
Performance Report.
Use case diagrams present an outside view of the manner the elements in a system behave and how
they can be used in the context.
Use cases
Actors
Relationships like dependency, generalization, and association
To model the context of a system by enclosing all the activities of a system within a rectangle
and focusing on the actors outside the system by interacting with it.
To model the requirements of a system from the outside point of view.
Example
Let us consider an Automated Trading House System. We assume the following features of the
system −
The trading house has transactions with two types of customers, individual customers and
corporate customers.
Once the customer places an order, it is processed by the sales department and the customer is
given the bill.
The system allows the manager to manage customer accounts and answer any queries posted by
the customer.
UML UNIT-3
Interaction Diagrams
Interaction diagrams depict interactions of objects and their relationships. They also include the
messages passed between them. There are two types of interaction diagrams −
Sequence Diagrams
Collaboration Diagrams
the control flow by time ordering using sequence diagrams.
the control flow of organization using collaboration diagrams.
A)Sequence Diagrams
Sequence diagrams are interaction diagrams that illustrate the ordering of messages according to
time.
Notations − These diagrams are in the form of two-dimensional charts. The objects that initiate the
interaction are placed on the x–axis. The messages that these objects send and receive are placed
along the y–axis, in the order of increasing time from top to bottom.
Example − A sequence diagram for the Automated Trading House System is shown in the following
figure.
UML UNIT-3
B)Collaboration Diagrams
Collaboration diagrams are interaction diagrams that illustrate the structure of the objects that send
and receive messages.
Notations − In these diagrams, the objects that participate in the interaction are shown using vertices.
The links that connect the objects are used to send and receive messages. The message is shown as a
labeled arrow.
Example − Collaboration diagram for the Automated Trading House System is illustrated in the
figure below.
State–Chart Diagrams
UML UNIT-3
A state–chart diagram shows a state machine that depicts the control flow of an object from one state
to another. A state machine portrays the sequences of states which an object undergoes due to events
and their responses to events.
State-chart diagrams are used for modeling objects which are reactive in nature.
Example
In the Automated Trading House System, let us model Order as an object and trace its sequence. The
following figure shows the corresponding state–chart diagram.
Activity Diagrams
An activity diagram depicts the flow of activities which are ongoing non-atomic operations in a state
machine. Activities result in actions which are atomic operations.
Example
The following figure shows an activity diagram of a portion of the Automated Trading House
System.
UML UNIT-3