Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Practical exam for Software Engineering IT301

Date – 4 December 2020

Submitted by - Anshul Bhardwaj

A2305318042

B.Tech 5IT1

Aim: To design a State Diagram for Online Shopping

Theory:
Every company having customers maintains customer accounts and supports a complete
life cycle of the account from its creation until it is closed. There are differences in what
the stages (states) are in the account’s life cycle, and what are conditions or events
causing account to change its state. Here we provide an example of user account life
cycle in the context of online shopping, shown as UML protocol state machine diagram.
For the user account to be created, it must meet some initial requirements. For example,
user id (used as a login name) must be unique, at least for the existing accounts. After
account was created, it might need to be verified. Verification depends on the company
and could include e-mail, phone, and/or address verification. If account was not verified
during some predefined period of time, that account could be moved to the suspended
accounts.
New, active, or suspended accounts could be cancelled at any time by client’s request.
Note, the precondition for this usually includes payment of any outstanding balances
and might require some separate account state or substrate to handle this case.
User account might be suspended for security reasons, manually or automatically. For
example, website intrusion detection system locks user account for predefined period, if
there were several unsuccessful login attempts using incorrect account password. After
account lock times out, account is activated back automatically.
Some user accounts could be inactive for a long period of time. Company policy or
business rules could require moving such dormant for a year or two accounts to the
suspended state.
Once we listed user account states and specified all possible transitions from one state
to another, we can review the diagram with other subject matter experts to see if
anything is missing or needs further clarifications.

State diagram:

A State Machine diagram (also known as statechart, state diagram or state transition
diagram), developed by David Harel, is one of the seven diagrams used for 1odelling
the dynamic nature of a system. These diagrams are used to model the entire life cycle
of an object. The activity diagram is a special kind of Statechart diagram. Purpose of
State diagrams:

To model the dynamic aspect of a system.


To model the life time of a reactive system.
To describe different states of an object during its life time.
A state diagrams include the following:
States
Transition
Initial state
Final state
Synchronization and Splitting of Control

State Diagram Relationships and its notations:

A state may be involved in one or more relationships with other states. A relationship
can be one of the following types:

Relationship Type Graphical Representation


Initial state
We use a black filled circle represent the initial state of a
System or a class.
Transition
We use a solid arrow to represent the transition or change of
control from one state to another. The arrow is labelled with
the event which causes the change in state.
State
We use a rounded rectangle to represent a state. A state
represents the conditions or circumstances of an object of a
class at an instant of time.
Fork
We use a rounded solid rectangular bar to represent a Fork
notation with incoming arrow from the parent state and
outgoing arrows towards the newly created states. We use
the fork notation to represent a state splitting into two or
more concurrent states.
Self-transition
We use a solid arrow pointing back to the state itself to
represent a self-transition. There might be scenarios when the
state of the object does not change upon the occurrence of an
event. We use self-transitions to represent such cases.
Composite state
We use a rounded rectangle to represent a composite state
also. We represent a state with internal activities using a
composite state.
Final state
We use a filled circle within a circle notation to represent the
final state in a state machine diagram.

Output:

You might also like