0% found this document useful (0 votes)
40 views21 pages

Uml Unit-3 Answers

Uploaded by

qwert14444333
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views21 pages

Uml Unit-3 Answers

Uploaded by

qwert14444333
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

UML UNIT-3

1) What are the Common Modelling Techniques for Activity diagram?


A)
Common Modeling Techniques
Modeling a Workflow:
To model a workflow:
1. Establish a focus for the workflow.
2. Select the objectsthat have the high-levelresponsibilities for parts of the overall workflow. Create a
swimlane for each of theseobjects.
3. Identify the pre-conditions of the workflow’s initial state and the post-conditions of the workflow’s final
state.
4. Starting at the workflow’s initial state layout the actions and activitiesthattake place and renderthem as
actions states or activity states.
5. For complex actions, or for sets of actions thatappear multiple times, collapse themintoactivity states and
provide a separateactivitydiagram for them.
6. Connect the action and activity states by transitions. Considerbranching and thenconsiderforking and
joining.
7. If there are important objectsthat are involved in the workflow, renderthem in the activitydiagram as well.

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

2) List the interaction diagrams and define each


A)UML Interaction Diagram
As the name suggests, the interaction diagram portrays the interactions between distinct entities present in the
model. It amalgamates both the activity and sequence diagrams. The communication is nothing but units of
the behavior of a classifier that provides context for interactions.

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.

Purpose of Interaction Diagrams


The purpose of interaction diagrams is to visualize the interactive behavior of the system. Visualizing the
interaction is a difficult task. Hence, the solution is to use different types of models to capture the different
aspects of the interaction.
Sequence and collaboration diagrams are used to capture the dynamic nature but from a different angle.
The purpose of interaction diagram is −

 To capture the dynamic behaviour of a system.


 To describe the message flow in the system.
 To describe the structural organization of the objects.
 To describe the interaction among objects.

The Sequence Diagram


The sequence diagram has four objects (Customer, Order, SpecialOrder and NormalOrder).
The following diagram shows the message sequence for SpecialOrder object and the same can be used in case
of NormalOrder object. It is important to understand the time sequence of message flows. The message flow
is nothing but a method call of an object.
The first call is sendOrder () which is a method of Order object. The next call is confirm () which is a method
of SpecialOrder object and the last call is Dispatch () which is a method of SpecialOrder object. The following
diagram mainly describes the method calls from one object to another, and this is also the actual scenario
when the system is running.
UML UNIT-3

The Collaboration Diagram


The second interaction diagram is the collaboration diagram. It shows the object organization as seen in the
following diagram. In the collaboration diagram, the method call sequence is indicated by some numbering
technique. The number indicates how the methods are called one after another. We have taken the same order
management system to describe the collaboration diagram.
Method calls are similar to that of a sequence diagram. However, difference being the sequence diagram does
not describe the object organization, whereas the collaboration diagram shows the object organization.
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.

3) What is Collaboration Diagram? list the drawbacks of it


A)UML Collaboration Diagram
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
UML UNIT-3
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.

Notations of a Collaboration Diagram


Following are the components of a component diagram that are enlisted below:
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:


 The object is represented by specifying their name and class.
 It is not mandatory for every class to appear.
 A class may constitute more than one object.
 In the collaboration diagram, firstly, the object is created, and then its class is specified.
 To differentiate one object from another object, it is necessary to name them.

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.

The drawback of a Collaboration Diagram


UML UNIT-3
Multiple objects residing in the system can make a complex collaboration diagram, as it becomes quite hard to
explore the objects.
It is a time-consuming diagram.
After the program terminates, the object is destroyed.
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.

4) List the elements in usecase diagram.


A) A Use Case Diagram is a type of Unified Modeling Language (UML) diagram that represents the
interaction between actors (users or external systems) and a system under consideration to accomplish specific
goals. It provides a high-level view of the system’s functionality by illustrating the various ways users can
interact with it.

Use Case Diagram Notations


UML notations provide a visual language that enables software developers, designers, and other stakeholders
to communicate and document system designs, architectures, and behaviors in a consistent and understandable
manner.

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.

Use Case Diagram Relationships


In a Use Case Diagram, relationships play a crucial role in depicting the interactions between actors and use
cases. These relationships provide a comprehensive view of the system’s functionality and its various
scenarios.

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.

Example: Online Banking System

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.

Example: Social Media Posting

Use Cases: Compose Post, Add Image


Include Relationship: The “Compose Post” use case includes the functionality of “Add Image.” Therefore,
composing a post includes the action of adding an image.
UML UNIT-3
3. Extend Relationship
The Extend Relationship illustrates that a use case can be extended by another use case under specific
conditions. It is represented by a dashed arrow with the keyword “extend.” This relationship is useful for
handling optional or exceptional behavior.

Example: Flight Booking System

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.

Example: Vehicle Rental System

5) Explain different elements in use case diagram with an example.


A) REFER 4TH ANSWER

Book publishing use case diagram example

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.

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.

Notations of a Sequence Diagram

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.

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.

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.

o Create Message: It describes a communication, particularly between the lifelines of an interaction


describing that the target (lifeline) has been instantiated.

o Destroy Message: It describes a communication, particularly between the lifelines of an interaction


that depicts a request to destroy the lifecycle of the target.

o Duration Message: It describes a communication particularly between the lifelines of an interaction,


which portrays the time passage of the message while modeling a system.
UML UNIT-3
Note

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.

]Example of a Sequence Diagram

An example of a high-level sequence diagram for online bookshop is given below.

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. It explores the real-time application.


2. It depicts the message flow between the different objects.
3. It has easy maintenance.
4. It is easy to generate.
5. Implement both forward and reverse engineering.
6. It can easily update as per the new change in the system.

The drawback 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

A)UML Collaboration Diagram

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.

Notations of a Collaboration Diagram

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

Steps for creating a Collaboration Diagram

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.

3. Think through alternative situations that may be involved.

1. Implementation of a collaboration diagram at an instance level, if needed.


2. A specification level diagram may be made in the instance level sequence diagram for
summarizing alternative situations.

Example of a Collaboration Diagram


UML UNIT-3
Benefits of a Collaboration Diagram

1. The collaboration diagram is also known as Communication Diagram.


2. It mainly puts emphasis on the structural aspect of an interaction diagram, i.e., how lifelines are
connected.
3. The syntax of a collaboration diagram is similar to the sequence diagram; just the difference is that the
lifeline does not consist of tails.
4. The messages transmitted over sequencing is represented by numbering each individual message.
5. The collaboration diagram is semantically weak in comparison to the sequence diagram.
6. The special case of a collaboration diagram is the object diagram.
7. It focuses on the elements and not the message flow, like sequence diagrams.
8. Since the collaboration diagrams are not that expensive, the sequence diagram can be directly
converted to the collaboration diagram.
9. There may be a chance of losing some amount of information while implementing a collaboration
diagram with respect to the sequence diagram.

The drawback of a Collaboration Diagram

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.

8) Explain the common modelling techniques of use case diagram


A)Use-case diagrams describe the high-level functions and scope of a system. These diagrams also
identify the interactions between the system and its actors.
Modeling the context of a system:
All the things (actors) that live outside the system and interact with the system constitute the
system’s context. This context defines the environment in which the system lives.
To model the context of a system:
1. Identify the actors that surround the system.
2. Organize actors that are similar to one another in a generalization-specialization hierarchy.
3. For better semantics, provide a stereotype for each actor.
4. Create a use case diagram with these actors and specify the paths of communication for each actor
to the system’s uses cases using association relationships.
UML UNIT-3
Modeling the requirements of a system:
A system’s functional requirements can be expressed as use cases, and the UML’s use case
diagrams are essential for managing these requirements.
To model the requirements of a system:
1. Establish the context of the system by identifying the actors that surround (use) the system.
2. For each actor, identify the behavior that the actor expects from the system or requires the system
to provide.
3. Name these common behaviors as use cases.
4. Use include and extend relationships to factor common behavior and optional behavior.
5. Model these use cases, actors and their relationships in a use case diagram.
6. Use notes to provide details about the use cases and other non-functional requirements.

9) Describe about the Basic Behavioral Modeling diagrams with an example?


A)UML Behavioural Diagrams

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 Model

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

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 case diagrams comprise of −

 Use cases
 Actors
 Relationships like dependency, generalization, and association

Use case diagrams are used −

 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

Interaction diagrams are used for modeling −


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 comprise of −

 States: Simple or Composite


 Transitions between states
 Events causing transitions
 Actions due to the 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.

Activity diagrams comprise of −

 Activity states and action states


 Transitions
 Objects

Activity diagrams are used for modeling −

 workflows as viewed by actors, interacting with the system.


 details of operations or computations using flowcharts.

Example

The following figure shows an activity diagram of a portion of the Automated Trading House
System.
UML UNIT-3

10)Design and explain Activity Diagram for Library Management System?


A)
UML UNIT-3

11)Design and explain Interaction Diagram for Banking System?


A) Refer notes
12)Draw the Activity Diagram for JVD Registration.
A) Refer notes

You might also like