0% found this document useful (0 votes)
15 views

Software Engineering File

Uploaded by

Pradeep gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Software Engineering File

Uploaded by

Pradeep gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Q.1) What is DFD?

Draw a detail First Level DFD for QUIZ


APPLICATION

What is DFD?

Data flow diagram is graphical representation of flow of data in an information system. It is


capable of depicting incoming data flow, outgoing data flow and stored data. The DFD does
not mention anything about how data flows through the system. There is a prominent
difference between DFD and Flowchart.

Components:

 Entities: Entities include source and destination of the data. Entities are represented by
rectangle with their corresponding names.
 Process: The tasks performed on the data is known as process. Process is represented by
circle. Somewhere round edge rectangles are also used to represent process.
 Data Storage: Data storage includes the database of the system. It is represented by
rectangle with both smaller sides missing or in other words within two parallel lines.
 Data Flow: The movement of data in the system is known as data flow. It is represented
with the help of arrow. The tail of the arrow is source and the head of the arrow is
destination.

DFD Rules:

 Each process should have at least one input and an output.


 Each data store should have at least one data flow in and one data flow out.
 Data stored in a system must go through a process.
 All processes in a DFD go to another process or a data store.

(1)
DFD Levels:

A data flow diagram can dive into progressively more detail by using levels and layers, zeroing
in on a particular piece. DFD levels are numbered 0, 1 or 2, and occasionally go to even
Level 3 or beyond.

DFD Level 0 is also called a Context Diagram. It’s a basic overview of the whole system or
process being analyzed or modeled. It’s designed to be an at-a- glance view, showing the
system as a single high-level process, with its relationship to external entities. It should be
easily understood by a wide audience, including stakeholders, business analysts, data
analysts and developers.

DFD Level 1 provides a more detailed breakout of pieces of the Context Level Diagram. You
will highlight the main functions carried out by the system, as you break down the high-level
process of the Context Diagram into its sub-processes.

(2)
These procedures require information such as record of customers, deposits, balance inquiry,
credits and withdrawals from which served as the bases for ATM machines and bank admin
to manage the ATM system. This type of data is represented by a data store.

With being knowledgeable about the DFD level 1 of the ATM (Automated Teller Machine)
System, you will know then it’s broaden context terms.

In addition to that, this may also serve as your reference on how the inputs or data fed on the
system. Then you will be also informed about the outputs that the system gives.

These processes shown in the DFD were all based on the concept of ATM (Automated Teller
Machine) System.

(3)
Q.2) What is SRS? Prepare a SRS document of “QUIZ APLLICATION”, in line
with the IEEE recommended standards.

What is SRS?

SRS is a document that completely describes what the proposed s/w should do without describing
how the software will do it.

The basic goal of the requirements phase of SDLC is to produce the SRS, which describe the complete
external behavior of the proposed system.

 First, the SRS could be written by the customer.


 Second, the SRS could be written by the developer.
First, define the need and expectation of users second, it serve as a contract document between
customer and developer.

SRS Document

1. Introduction

1.1 Purpose
The purpose of this document is to define the requirements for the Quiz Application, which enables users
to create, take, and manage quizzes for educational or entertainment purposes.

1.2 Scope
The Quiz Application allows users to:
 Register and log in as participants or administrators.
 Create and manage quizzes (administrators).
 Participate in quizzes (participants).
 View results and performance statistics. The application will support web and mobile platforms.

1.3 Definitions and Acronyms


 Admin: A user who manages quizzes.
 Participant: A user who takes quizzes.
 UI: User Interface.
 MCQ: Multiple Choice Question.

(4)
1.4 References

 IEEE 830-1998: Software Requirements Specification.


 API documentation and other relevant materials.

2. Overall Description

2.1 Product Perspective


The Quiz Application will be standalone and will integrate with email and notification systems for
updates and alerts.

2.2 Product Features


 User registration and login.
 Quiz creation and management by admins.
 Quiz participation by users.
 Score calculation and performance statistics.

2.3 User Classes


1. Admins: Manage quizzes and view participant performance.
2. Participants: Take quizzes and view their results.

2.4 Operating Environment


 Web browsers (Chrome, Firefox, etc.)
 Mobile platforms (Android, iOS)

2.5 Constraints

 Requires internet connection for online usage.


 Supports up to 10,000 concurrent users.

2.6 Assumptions
 Users will have basic internet access.
 Relies on third-party email services for notifications.

3. Specific Requirements

3.1 Functional Requirements

1. User Management:
o Registration, login, and password reset.
2. Quiz Management:
o Admins can create, edit, and delete quizzes.
3. Quiz Participation:
o Users can take quizzes within a set timeframe.
4. Results and Analysis:
o Display scores and detailed performance statistics.
(5)
3.2 Non-Functional Requirements

1. Performance: Supports up to 10,000 concurrent users.


2. Usability: Intuitive and responsive design.
3. Security: Encrypt user data and ensure secure login.
4. Availability: 99.9% uptime.

3.3 Interface Requirements

 UI: Simple and user-friendly design.


 API: RESTful APIs for external integration.

3.4 Data Requirements


 Store user and quiz data securely.
 Archive inactive quiz data after six months.

4. Appendices
 A. Glossary of Terms
 B. Future Enhancements: AI-based question generation

Approval: This SRS document is approved by [Stakeholder Name] on [Approval Date].

(6)
Q.3) What is ER Diagram? Create an ER Diagram of “QUIZ APPLICATION”.

What is ER Diagram?

Entity Relationship Diagram (ERD) or ER-modeling is a data modeling method used in software
engineering to produce a conceptual data model of an information system. Diagrams created using
this ER-modeling method are called Entity-Relationship Diagrams or ER diagrams or ERDs.

Purpose of ERD:

The database analyst gains a better understanding of the data to be contained in the database through the
step of constructing the ERD. The ERD serves as a documentation tool. Finally, the ERD is used to
connect the logical structure of the database to users. In particular, the ERD effectively communicates
the logic of the database to users.

Components of an ER Diagram:

1. Entity: An entity can be a real-world object, either animate or inanimate, that can be merely
identifiable. An entity is denoted as a rectangle in an ER diagram. For example, in a school database,
students, teachers, classes, and courses offered can be treated as entities. All these entities have some
attributes or properties that give them their identity.

2. Entity Set: An entity set is a collection of related types of entities. An entity set may include
entities with attribute sharing similar values. For example, a Student set may contain all the students
of a school; likewise, a Teacher set may include all the teachers of a school from all faculties. Entity
set need not be disjoint.

(7)
3. Attributes: Entities are denoted utilizing their properties, known
as attributes. All attributes have values. For example, a student
entity may have name, class, and age as attributes. There exists a
domain or range of values that can be assigned to attributes. For
example, a
student's name cannot be a numeric value. It has to be alphabetic. A student's age cannot be negative,
etc.

There are four types of Attributes:

 Key attribute
 Composite attribute
 Single-valued attribute
 Multi-valued attribute
 Derived attribute
Key attribute: Key is an attribute or collection of attributes that uniquely identifies an entity among
the entity set. For example, the roll_number of a student makes him identifiable among students.

There are mainly three types of keys:

 Super key: A set of attributes that collectively identifies an entity in the entity set.
 Candidate key: A minimal super key is known as a candidate key. An entity set may have more
than one candidate key.
 Primary key: A primary key is one of the candidate keys chosen by the database designer to
uniquely identify the entity set.
 Composite attribute: An attribute that is a combination of other attributes is called a composite
attribute. For example, In student entity, the student address is a composite attribute as an address
is composed of other characteristics such as pin code, state, country.

Single-valued attribute: Single-valued attribute contain a single value. For example, Social, Security
Number.

(8)
Multi-valued Attribute: If an attribute can have more than one value, it is known as a multi-valued
attribute. Multi-valued attributes are depicted by the double ellipse. For example, a person can have
more than one phone number, email-address, etc.

Derived attribute: Derived attributes are the attribute that does not exist in the physical database, but
their values are derived from other attributes present in the database. For example, age can be derived
from date_of_birth. In the ER diagram, Derived attributes are depicted by the dashed ellipse

4. Relationships:

The association among entities is known as relationship. Relationships are represented by the
diamond- shaped box. For example, an employee works at a department, a student enrolls in a course.
Here, Works at and Enrolls are called relationships.

5. Relationship set:

A set of relationships of a similar type is known as a relationship set. Like entities, a relationship too
can have attributes. These attributes are called descriptive attributes.

ER diagram of Quiz Application :

ER Diagram is known as Entity-Relationship Diagram, it is used to analyze to the structure of the


Database. It shows relationships between entities and their attributes. An ER Model provides a means
of communication.

Entities and Attributes in a Quiz Application:


1. User:
o Attributes: userID (PK), name, email, role, password

(9)
2. Quiz:
o Attributes: quizID (PK), title, description, totalMarks, duration
3. Question:
o Attributes: questionID (PK), questionText, questionType, options, correctAnswer, quizID
(FK)
4. Result:
o Attributes: resultID (PK), userID (FK), quizID (FK), score, date

Relationships:

1. A User can participate in multiple Quizzes (1:N).


2. A Quiz contains multiple Questions (1:N).
3. A Result links a User to a Quiz (1:1)

(10)
Q.4) Draw the use case diagram for “Quiz Application” and specify the roles of
each of the actors.

Use Case Diagram for Quiz Application:

A use case diagram visually represents the functionalities of a system and the interactions between users
(actors) and the system. Below is the textual description of the use case diagram for a Quiz
Application, followed by the roles of each actor.

Here, we will understand the designing use case diagram for the Quiz Application. Some scenarios of the
system are as follows:

(11)
Here is the use case diagram for the Quiz Application, illustrating the interactions between the actors and
the system's functionalities. Below are the roles of each actor:
Roles of the Actors:

1. Administrator:
o Creates quizzes.
o Manages existing quizzes (edit/delete, set rules, etc.).
2. Participant:
o Registers and logs into the system.
o Takes quizzes.
o Views results and performance analysis.
o

(12)
Q.5) Prepare state the precondition; post condition and function of each use case.

Use Case:

It can be useful to use the notion of precondition and post condition to clarify how the flow of events
starts and ends. However, only use it if it is perceived as adding value by the audience of the use case.

A precondition is the state of the system and its surroundings that is required before the use case can
be started. A post condition is the states the system can be in after the use case has ended.

Consider the following:

5.Precondition, Postcondition, and Function of Use Cases

5.1 Register/Login
 Precondition: The user has access to the application and an internet connection.
 Postcondition: The user is authenticated and granted access to their dashboard.
 Function: To ensure secure access to the system.

5.2 Create Quiz (Admin)


 Precondition: The admin is logged into the system.
 Postcondition: A new quiz is created and saved in the system.
 Function: To allow admins to create quizzes for participants.

(13)
5.3 Manage Quiz (Admin)
 Precondition: The admin is logged in and has at least one quiz created.
 Postcondition: Quiz details are updated or deleted.
 Function: To manage existing quizzes.

5.4 Take Quiz (Participant)


 Precondition: The participant is logged in and the quiz is available.
 Postcondition: The participant’s responses are submitted and saved.
 Function: To allow participants to take quizzes within the set timeframe.

5.5 View Results (Participant)


 Precondition: The participant has completed at least one quiz.
 Postcondition: Results and performance data are displayed.
 Function: To provide feedback and performance metrics to participants.

(14)
Q.6) What is class diagram? Identify the classes in “QUIZ APPLICATION” and
draw the class diagram?
A class diagram is a static UML diagram that describes the structure of a system. It shows the system's
classes, attributes, methods, and relationships between the classes. Class diagrams help in understanding
and designing the blueprint of the system.

Classes in a Quiz Application:

1. QuizApplication:
o Attributes: app Name, version, supported Languages
o Methods: launch(), terminate()

2. User:
o Attributes: user ID, name, email, role, password
o Methods: login(), logout(), register()

3. Quiz:
o Attributes: quiz ID, title, description, total Marks, duration
o Methods: create Quiz(), delete Quiz(), start Quiz()

4. Question:
o Attributes: question ID, question Text, question Type, options, correct Answer
o Methods: add Question(), update Question(), delete Question()

5. Result:
o Attributes: result ID, user ID, quiz ID, score, date
o Methods: calculate Score(), display Result()

Relationships Between Classes:

1. User can take multiple Quizzes.


2. Quiz contains multiple Questions.
3. Result is associated with both User and Quiz.

(15)
(16)
Q.7) Draw the sequence diagram for issue book and return book scenarios.

What is Sequence Diagram?

Sequence Diagrams are interaction diagrams that detail how operations are carried out. They capture
the interaction between objects in the context of a collaboration. Sequence Diagrams are time focus
and they show the order of the interaction visually by using the vertical axis of the diagram to
represent time what messages are sent and when.

Uses of sequence diagram:

 Used to model and visualize the logic behind a sophisticated function, operation or procedure.
 They are also used to show details of UML use case diagrams.
 Used to understand the detailed functionality of current or future systems.
 Visualize how messages and tasks move between objects or components in a system.

Sequence Diagrams at a Glance

Sequence Diagrams show elements as they interact over time and they are organized according to
object (horizontally) and time (vertically). The horizontal axis shows the elements that are involved in
the interaction. The vertical axis represents time proceedings (or progressing) down the page.

Note that: Time in a sequence diagram is all a about ordering, not duration. The vertical space in an
interaction diagram is not relevant for the duration of the interaction.

(17)
Sequence Diagram Notation:

A) Actor :

A type of role played by an entity that interacts with the subject (e.g., by exchanging
signals and data). It represent roles played by human users, external hardware, or other
subjects. An actor does not necessarily represent a specific physical entity but merely a
particular role of some entity.

B) Lifeline :

A lifeline represents an individual participant in the Interaction.

C) Activations :

A thin rectangle on a lifeline) represents the period during which an element is performing
an operation. The top and the bottom of the of the rectangle are aligned with the initiation
and the completion time respectively

D) Call Message :

A message defines a particular communication between Lifelines of an Interaction. Call message is a


kind of message that represents an invocation of operation of target lifeline.

E) Return Message :

Return message is a kind of message that represents the pass of information


back to the caller of a corresponded former message.

(18)
F) Self-Message :

Self-message is a kind of message that represents the invocation of message of the same lifeline.

G) Recursive Message :

Recursive message is a kind of message that represents the invocation of message


of the same lifeline. It's target points to an activation on top of the activation
where the message was invoked from.

H) Create Message :

Create message is a kind of message that represents the


instantiation of (target) lifeline.

I) Destroy Message :

Destroy message is a kind of message that represents the request of


destroying the lifecycle of target lifeline.

J) Duration Message:

Duration message shows the distance between two time


instants for a message invocation.

K) Event and Focus of Control :

An Event is any point in an interaction where something occurs. Focus of control also called
execution occurrence, an execution occurrence. It shows as tall, thin rectangle on a lifeline. It
represents the period during which an element is performing an operation. The top and the bottom of
the rectangle are aligned with the initiation and the completion time respectively.

(19)
A sequence diagram for Issue and Return Book Scenarios:

A sequence diagram represent the sequence and interactions of a given use case or scenario. Sequence
diagram capture most of the information about the system. It is also represent in order by which they
occur and have the object in the system send message to one another. Here the sequence starts with
interaction between user and the system followed by database. Once the book have been selected the
next half of sequence starts between librarian and user followed by database.

Issue Book Sequence Diagram

Return Book Sequence Diagram

(20)
Here, we will understand the designing use case diagram for the library management system. Some
scenarios of the system are as follows:

 User who registers himself as a new user initially is regarded as staff or student for the library
system. For the user to get registered as a new user, registration forms are available that is needed
to be fulfilled by the user.
 After registration, a library card is issued to the user by the librarian. On the library card, an ID is
assigned to cardholder or user.
 After getting the library card, a new book is requested by the user as per there requirement.
 After, requesting, the desired book or the requested book is reserved by the user that means no
other user can request for that book.

Now, the user can renew a book that means the user can get a new due date for the desired book if the
user has renewed them. If the user somehow forgets to return the book before the due date, then the
user pays fine. Or if the user forgets to renew the book till the due date, then the book will be overdue
and the user pays fine.

Librarian has a key role in this system. Librarian adds the records in the library database about each
student or user every time issuing the book or returning the book, or paying fine. Librarian also
deletes the record of a particular student if the student leaves the college or passed out from the
college. If the book no longer exists in the library, then the record of the particular book is also
deleted. Updating database is the important role of Librarian.

(21)
Q.8) What is Activity diagram? Draw the activity diagram for cash withdrawal
process from ATM.

What is an Activity Diagram?

Activity Diagram is basically a flowchart to represent the flow from one activity to another activity.
The activity can be described as an operation of the system. The basic purpose of activity diagrams is
to capture the dynamic behavior of the system. It is also called object-oriented flowchart. This UML
diagram focuses on the execution and flow of the behavior of a system instead of implementation.
Activity diagrams consist of activities that are made up of actions that apply to behavioral modeling
technology.

Components of Activity Diagram:

1) Activities :

It is a behavior that is divided into one or more actions. Activities are a network of nodes connected
by edges. There can be action nodes, control nodes, or object nodes. Action nodes represent some
action. Control nodes represent the control flow of an activity. Object nodes are used to describe
objects used inside an activity. Edges are used to show a path or a flow of execution. Activities start
at an initial node and terminate at a final node.

2) Activity partition/swim lane :

An activity partition or a swim lane is a high-level grouping of a set of related actions. A single
partition can refer to many things, such as classes, use cases, components, or interfaces. If a partition
cannot be shown clearly, then the name of a partition is written on top of the name of an activity.

3) Fork and Join nodes :

Using a fork and join nodes, concurrent flows within an activity can be generated. A fork node has
one incoming edge and numerous outgoing edges. It is similar to one too many decision parameters.
When data arrives at an incoming edge, it is duplicated and split across numerous outgoing edges
simultaneously. A single incoming flow is divided into multiple parallel flows.

(22)
A join node is opposite of a fork node as It has many incoming edges and a single outgoing edge. It
performs logical AND operation on all the incoming edges. This helps you to synchronize the input
flow across a single output edge.

4) Pins :

An activity diagram that has a lot of flows gets very complicated and messy. Pins are used to clearing
up the things. It provides a way to manage the execution flow of activity by sorting all the flows and
cleaning up messy thins. It is an object node that represents one input to or an output from an action.
Both input and output pins have precisely one edge.

Why use Activity Diagrams?

Activity diagram in UML allows you to create an event as an activity which contains a collection of
nodes joined by edges. An activity can be attached to any modeling element to model its behavior.
Activity diagrams are used to model,

 Use cases
 Classes
 Interfaces
 Components
 Collaborations

Activity diagrams are used to model processes and workflows. The essence of a useful activity
diagram is focused on communicating a specific aspect of a system’s dynamic behavior. Activity
diagrams capture the dynamic elements of a system.

Activity diagram is similar to a flowchart that visualizes flow from one activity to another activity.
Activity diagram is identical to the flowchart, but it is not a flowchart. The flow of activity can be
controlled using various control elements in the UML flow diagram. In simple words, an activity
diagram is used to activity diagrams that describe the flow of execution between multiple activities.

(23)
Activity Diagram Notation:

Activity diagrams symbols can be generated by using the following notations:

 Initial states: The starting stage before an activity takes place is depicted as the initial state
 Final states: The state which the system reaches when a specific process ends is known as a Final
State
 State or an activity box:
 Decision box: It is a diamond shape box which represents a decision with alternate paths. It
represents the flow of control.

Activity Diagram Notation and Symbol

(24)
The Activity diagram for cash withdrawal process from ATM:

Activity diagram are graphical representation of workflows of stepwise activities and actions with
support for choice, iteration and concurrency. Here in the activity diagram the user login to the
system and perform some main activity which is the main key element to the system.

Here is an Activity diagram example for ATM.

Withdraw money from an ATM Account - The three involved classes (people etc.) of the activity are
Customer, ATM, and Bank Represent swim lanes that determine which object is responsible for
which activity. The process begins at the black start circle at the top and ends at the concentric
white/black stop circles at the bottom. The activities are rounded rectangles.

A single transition comes out of each activity, connecting it to the next activity, which may branch
into two or more mutually exclusive transitions. Guard expressions (inside [ ]) label the transitions
coming out of a branch. A branch and its subsequent merge marking the end of the branch appear in
the diagram as hollow diamonds. A transition may fork into two or more parallel activities. The fork
and the subsequent join of the threads coming out of the fork appear in the diagram as solid bars.

(25)
Q.9) What is component diagram? Draw Railway Management System component
diagram.

What is component diagram?

Component diagrams are different in terms of Nature and Behavior. Component diagrams are used to
model the physical aspects of a system. Now the question is, what are these physical aspects?
Physical aspects are the elements such as executable libraries, files, documents, etc. which reside in a
node.

Component diagrams are used to visualize the organization and relationships among components in a
system. These diagrams are also used to make executable systems.

Purpose of Component Diagrams:

Component diagram is a special kind of diagram in UML. The purpose is also different from all other
diagrams discussed so far. It does not describe the functionality of the system but it describes the
components used to make those functionalities. Thus from that point of view, component diagrams
are used to visualize the physical components in a system. These components are libraries, packages,
files, etc.

Component diagrams can also be described as a static implementation view of a system. Static
implementation represents the organization of the components at a particular moment. A single
component diagram cannot represent the entire system but a collection of diagrams is used to
represent the whole.

The purpose of the component diagram can be summarized as,

 Visualize the components of a system.


 Construct executable by using forward and reverse engineering.
 Describe the organization and relationships of the components.

(26)
How to Draw a Component Diagram?

Component diagrams are used to describe the physical artifacts of a system. This artifact includes files,
executable libraries, etc. The purpose of this diagram is different. Component diagrams are used
during the implementation phase of an application. However, it is prepared well in advance to
visualize the implementation details.

Initially, the system is designed using different UML diagrams and then when the artifacts are ready,
component diagrams are used to get an idea of the implementation.

This diagram is very important as without it the application cannot be implemented efficiently. A well-
prepared component diagram is also important for other aspects such as application performance,
maintenance, etc.

Before drawing a component diagram, the following artifacts are to be identified clearly

 Files used in the system.


 Libraries and other artifacts relevant to the application.
 Relationships among the artifacts.
After identifying the artifacts, the following points need to be kept in mind.

 Use a meaningful name to identify the component for which the diagram is to be drawn.
 Prepare a mental layout before producing the using tools.
 Use notes for clarifying important points.
Following is a component diagram for order management system. Here, the artifacts are files. The
diagram shows the files in the application and their relationships. In actual, the component diagram
also contains dll, libraries, folders, etc.

In the following diagram, four files are identified and their relationships are produced. Component
diagram cannot be matched directly with other UML diagrams discussed so far as it is drawn for
completely different purpose.

(27)
Railway Management System component diagram:

Component diagrams are used to visualize the organization of system components and the
Dependency relationship between them. They provide a high-level view of the components within a
system.

You can use a component diagram when you want to represent your system as components and want
to show their interrelationships through interfaces. It helps you get an idea of the implementation of
the system. Following are the steps you can follow when drawing a component diagram.

Components of UML Component Diagram of Railway Reservation System:

The following components are used in Representation of Component Diagram of Railway Reservation
system:

 Train Schedule Component


 Ticket Component
 Booking Component
 Customer Component
 Payment Component

(28)
This is a Component diagram of Railway Reservation System which shows components, provided
and required interfaces, ports and relationships between the Train Schedule, Ticket Booking,
Customer and Payment. This type of diagrams is used in Component-Based Development (CBD) to
describe systems with Service Oriented Architecture (SOA). Railway Reservation System UML
component diagram, describes the organization and wiring of the physical components in a system.

Features of Railway Reservation System Component Diagram:

Component diagrams are used in Component-Based-Development to describe systems with Service-


Oriented-Architecture(SOA),Show the structure of the code itself, can be used to focus on the
relationship between components while hiding specification detail, help to communicate and explain
the functions of the system being built to stakeholders

You can show given various models in the components of Railway Reservation System.

 Model the database schema of Railway Reservation System


 Model the executable of an application of Railway Reservation System
 Model the system's source code of Railway Reservation System

(29)
Q.10) What is State Chart Diagram? Draw the State Chart Diagram for
ATM.

What is State Chart Diagram?

The name of the diagram itself clarifies the purpose of the diagram and other details. It
describes the different states of a component in a system. The states are specific to a
component/object of a system.

A State chart diagram describes a state machine. A state machine can be defined as a
machine that defines different states of an object and these states are controlled by
external or internal events.

The activity diagram explained in the next chapter, is a special kind of a State chart
diagram. As the State chart diagram defines the states, it is used to model the lifetime of
an object.

Purpose of State chart Diagrams

State chart diagram is one of the five UML diagrams used to model the dynamic nature of a
system. They define different states of an object during its lifetime and these states are
changed by events. State chart diagrams are useful to model reactive systems. Reactive
systems can be defined as a system that responds to external or internal events.

State chart diagram describes the flow of control from one state to another state. States are
defined as a condition in which an object exists and it changes when some event is
triggered. The most important purpose of the State chart diagram is to model the lifetime
of an object from creation to termination.

State chart diagrams are also used for forward and reverse engineering of a system.
However, the main purpose is to model the reactive system.

Following are the main purposes of using State chart diagrams −

 To model the dynamic aspect of a system.


(30)
 To model the lifetime of a reactive system.

 To describe different states of an object during its lifetime.

 Define a state machine to model the states of an object.

How to Draw a State chart Diagram?

A State chart diagram is used to describe the states of different objects in their life cycle.
Emphasis is placed on the state changes upon some internal or external events. These
states of objects are important to analyze and implement accurately.

State chart diagrams are very important for describing the states. States can be identified as
the condition of objects when a particular event occurs.

Before drawing a State chart diagram we should clarify the following points −

 Identify the important objects to be analyzed.

 Identify the states.

 Identify the events.

Where to Use State chart Diagrams?

From the above discussion, we can define the practical applications of a state chart diagram.
State chart diagrams are used to model the dynamic aspect of a system like the other four
diagrams discussed in this tutorial. However, it has some distinguishing characteristics
for modeling the dynamic nature.

State chart diagram defines the states of a component and these state changes are dynamic
in nature. Its specific purpose is to define the state changes triggered by events. Events
are internal or external factors influencing the system.

(31)
State chart diagrams are used to model the states and also the events operating on the
system. When implementing a system, it is very important to clarify different states of
an object during its lifetime and state chart diagrams are used for this purpose. When
these states and events are identified, they are used to model it and these models are used
during the implementation of the system.

If we look into the practical implementation of the state chart diagram, then it is mainly
used to analyze the object states influenced by events. This analysis is helpful to
understand the system's behavior during its execution.

The main usage can be described as −

 To model the object states of a system.

 To model the reactive system. The reactive system consists of reactive objects.

 To identify the events responsible for state changes.

 Forward and reverse engineering.

(32)
State Chart Diagram for ATM:-

When the customer inserts the bank or credit card in the ATM’s card reader, the entry action
i.e. read card is performed by the ATM. If the card is not valid then the machine will
perform exit action. After the card is being read successfully, the ATM will ask for Pin.
Then the customer enters the pin and the ATM then reads the pin. If the pin entered is not
valid then the machine will perform exit action. If the pin entered is valid, then the
machine further processes towards a transaction. After a successful transaction, the
machine undergoes the exit action i.e., eject card that discharges the customer’s card.

(33)

You might also like