0% found this document useful (0 votes)
13 views9 pages

SE Practical-5

Java file

Uploaded by

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

SE Practical-5

Java file

Uploaded by

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

EXPERIMENT NO.

05

AIM: Create Use Case Diagram, Class Diagram and Sequence


Diagram using any example.

Objective:

The objective is to create Use Case Diagrams, Class Diagrams, and Sequence Diagrams to
visually represent the system’s functionality, structure, and behavior. A Use Case Diagram
highlights interactions between users (actors) and system functions. A Class Diagram models
the system's classes, attributes, and relationships. A Sequence Diagram illustrates the flow of
messages between objects over time, showing the sequence of interactions in a process.
Together, these diagrams provide a comprehensive view of the system.

Introduction:

In software engineering, a UML diagram (Unified Modeling Language diagram) is a


standardized visual representation used to model the structure, behavior, and architecture of a
software system. UML helps software developers, architects, and designers communicate and
understand the design of a system.

There are several types of UML diagrams, and each one serves a different purpose. Here are
some of the main categories and common diagram types within UML:
1. Structural Diagrams

These focus on the static structure of a system, such as its classes, components, and objects.

 Class Diagram: Represents the static structure of a system by showing its classes, attributes,
methods, and the relationships between them (like inheritance, associations, etc.).
 Component Diagram: Shows the components of a system and their dependencies, useful for
high-level design.
 Object Diagram: Depicts instances of classes at a particular point in time, showing the
relationships between objects.
 Package Diagram: Illustrates how different components or classes are grouped together into
packages.

2. Behavioral Diagrams

These focus on the dynamic behavior of a system over time.

 Use Case Diagram: Represents the functionality of a system from the user's perspective. It shows
the system’s use cases (functions or processes) and actors (users or external systems).
 Sequence Diagram: Models the sequence of interactions between objects or components in a
system, showing the order in which messages are sent.
 Activity Diagram: Describes the flow of control or data through a system, often used for
modeling business processes or workflows.
 State Diagram: Depicts the states of an object and how it transitions from one state to another
based on events.

3. Interaction Diagrams

These focus on the interaction between objects or components.

 Collaboration Diagram: Similar to a sequence diagram, but focuses on the relationships


between objects rather than the order of interactions.
 Communication Diagram: Shows how objects communicate with each other via messages,
emphasizing the interactions and relationships between the objects.

4. Implementation Diagrams

These focus on the physical aspects of the system.

 Deployment Diagram: Shows how the system is physically deployed on hardware, depicting
nodes and their relationships.
 Component Diagram: While already listed in structural diagrams, it's also used to represent the
system at a more abstract, implementation level.
USE CASE DIAGRAM

A Use Case Diagram is a type of UML (Unified Modeling Language) diagram that illustrates the
functional requirements of a system from the perspective of its users (called actors). It shows the
interactions between the system and the external entities (users or other systems) that interact with it.

Use case diagrams are primarily used during the requirements gathering phase of system development
to:

 Identify the system's functional requirements.


 Visualize the interaction between users (or other systems) and the system.
 Provide a high-level view of the system’s behavior.

Components of a Use Case Diagram:

1. Actors:
o Represent external entities (users, other systems, or hardware) that interact with the
system.
o Actors can be human (e.g., customer, admin) or non-human (e.g., external systems).
o Actors are typically represented by stick figures.

2. Use Cases:
o Represent the functional requirements or actions that the system performs in response to
an actor’s interaction.
o Use cases are depicted as ovals with a name inside that describes the function (e.g.,
"Place Order," "Login").
o A use case can represent a single function or a collection of related functions.
3. System Boundary:
o Represents the boundary of the system that is being modeled, often depicted as a
rectangle surrounding the use cases.
o Everything inside the boundary is part of the system, and anything outside is external to
it.

4. Relationships:
o Association: A line connecting an actor to a use case, representing the interaction
between the actor and the use case.
o Include: Represents that a use case always includes another use case. It's like a
subroutine that must happen as part of the main use case.
o Extend: Represents optional functionality that can extend the behavior of a use case
under certain conditions.
o Generalization: Represents a specialized version of an actor or use case. For example, a
"Guest" user might be a specialized version of a "Customer" actor.
CLASS DIAGRAM

A Class Diagram is a UML diagram that shows the structure of a system by modelling its
classes, their attributes (data), and methods (functions), as well as the relationships between
them.

Key Components:

 Classes: Represented as rectangles, divided into three sections (name, attributes,


methods).
 Attributes: Data fields in a class (e.g., name: String).
 Methods: Functions that define the behaviour of the class (e.g., placeOrder()).
 Relationships: Connections between classes, such as:
o Association: One class is related to another (e.g., a Customer places an Order).
o Inheritance: One class inherits properties from another (e.g., Manager inherits
from Employee).
o Aggregation/Composition: "Whole-Part" relationships (e.g., a Library contains
Books).
o Composition: A strong "whole-part" relationship where the part cannot exist
without the whole (e.g., House contains Room).
o Realization: A class implements an interface, fulfilling its contract (e.g., Car
implements Vehicle interface).
o Generalization: A relationship where one class is a specialized version of another
(e.g., Manager is a specialized Employee).
o Directed Association: A one-way relationship where one class knows about
another and may interact with it (e.g., Customer places an Order).
Purpose:

 To represent how the system’s data is structured and how different objects (classes)
interact with each other.
 It’s used in object-oriented design to plan the architecture before coding.

Example:

For an Online Shopping System, you might have:

 Customer: with attributes like name and methods like placeOrder().


 Order: with attributes like orderNumber and methods like addProduct().

A class diagram helps visualize how these entities relate and interact.
SEQUENCE DIAGRAM

A Sequence Diagram is a UML diagram that shows how objects interact with each other in a
specific sequence over time. It models the flow of messages between objects, illustrating the
order of interactions.

Key Components:

 Actors: External entities (e.g., users or systems) that interact with the system.
 Lifelines: Vertical dashed lines that represent the timeline of an object during the
interaction.
 Objects: Instances of classes involved in the interaction.
 Messages: Arrows representing communication between objects (calls, responses).

Purpose:

 To visualize the flow of logic or actions over time in a specific scenario (e.g., user login,
order placement).
 Helps in understanding the sequence of events and interactions in a process.

Example:

For a Login process:

1. User sends a Login request to the System.


2. The System validates the User's credentials and returns a response.

The diagram would show the sequence of interactions, with messages ordered vertically to
represent the time progression.

Conclusion
In conclusion, Use Case Diagrams, Class Diagrams, and Sequence Diagrams are essential tools in
system design and documentation. They provide a clear and structured way to visualize user interactions,
system components, and the flow of messages within a system. Together, these diagrams help ensure a
better understanding of system functionality, structure, and behavior, facilitating effective development
and communication.

You might also like