Unit Ii
Unit Ii
Unit Ii
Software
Requirement
Engineering and
Analysis
View product
<<extend>> Discount
order <<include>>
User Login
<<include>>
payment
<<include>>
Cancel order
registered Non
registered
Admin
Confirm/Cancel order
status
Bank report
Building the Requirements
Model
l
The intent of the analysis model is to provide a description of the
required informational, functional, and behavioral domains for a
computer-based system.
l
The model changes dynamically as you learn more about the system
to be built, and other stakeholders understand more about what they
really require.
Elements of the Analysis Model
l
There are many different ways to look at the requirements for a
computer-based system.
l
Different modes of representation force you to consider requirements
from different viewpoints—an approach that has a higher probability of
uncovering omissions, inconsistencies, and ambiguity.
l
1. Scenario-based elements.
l
2. Class-based elements.
l
3. Behavioral elements
UML activity diagrams for eliciting requirements
l
Scenario-based elements
l
The system is described from the user’s point of view using a scenario-
based approach.
l
For example, basic use cases and their corresponding use case
diagrams evolve into more elaborate template-based use cases.
l
Scenario-based elements of the requirements model are often the fi rst
part of the model that is developed.
l
As such, they serve as input for the creation of other modeling
elements.
l
Activity Diagram
l
Scenario-based elements
Activity Diagram
l
The activity diagram is used to demonstrate the flow of control within
the system rather than the implementation. It models the concurrent
and sequential activities.
l
The activity diagram helps in envisioning the workflow from one activity
to another.
l
It put emphasis on the condition of flow and the order in which it
occurs.
l
The flow can be sequential, branched, or concurrent, and to deal with
such kinds of flows, the activity diagram has come up with a fork, join,
etc.
l
It is also termed as an object-oriented flowchart. It encompasses
activities composed of a set of actions or operations that are applied to
model the behavioral diagram.
Components of an Activity
Diagram
l
Activities:
l
The categorization of behavior into one or more actions is termed as
an activity. In other words, it can be said that an activity is a network of
nodes that are connected by edges. The edges depict the flow of
execution. It may contain action nodes, control nodes, or object nodes.
Components of an Activity
Diagram
l
Activity partition /swimlane
l
The swimlane is used to cluster all the related activities in one column
or one row. It can be either vertical or horizontal. It used to add
modularity to the activity diagram. It is not necessary to incorporate
swimlane in the activity diagram. But it is used to add more
transparency to the activity diagram.
Components of an Activity
Diagram
l
Forks
l
Forks and join nodes generate the concurrent flow inside the activity. A
fork node consists of one inward edge and several outward edges. It is
the same as that of various decision parameters. Whenever a data is
received at an inward edge, it gets copied and split crossways various
outward edges. It split a single inward flow into multiple parallel flows.
Components of an Activity
Diagram
l
Join Nodes
l
Join nodes are the opposite of fork nodes. A Logical AND operation is
performed on all of the inward edges as it synchronizes the flow of
input across one single output (outward) edge.
Notation of an Activity diagram
l
Activity diagram constitutes following
notations:
l
Initial State: It depicts the initial stage
or beginning of the set of actions.
l
Final State: It is the stage where all
the control flows and object flows end.
l
Decision Box: It makes sure that the
control flow or object flow will follow
only one path.
l
Action Box: It represents the set of
actions that are to be performed.
Why use Activity Diagram?
l
An event is created as an activity diagram encompassing a group of
nodes associated with edges.
l
To model the behavior of activities, they can be attached to any
modeling element. It can model use cases, classes, interfaces,
components, and collaborations.
l
It mainly models processes and workflows. It envisions the dynamic
behavior of the system as well as constructs a runnable system that
incorporates forward and reverse engineering.
l
It does not include the message part, which means message flow is
not represented in an activity diagram.
l
It is the same as that of a flowchart but not exactly a flowchart itself. It
is used to depict the flow between several activities.
Components of an Activity
Diagram
l
Following are the rules that are to be followed for drawing an activity
diagram:
l
1. A meaningful name should be given to each and every activity.
l
2. Identify all of the constraints.
l
3. Acknowledge the activity associations.
When to use an Activity
Diagram?
l
An activity diagram can be used to portray business processes and
workflows. Also, it used for modeling business as well as the software.
An activity diagram is utilized for the followings:
l
To graphically model the workflow in an easier and understandable
way.
l
To model the execution flow among several activities.
l
To model comprehensive information of a function or an algorithm
employed within the system.
l
To model the business process and its workflow.
l
To envision the dynamic aspect of a system.
l
To generate the top-level flowcharts for representing the workflow of an
application.
l
To represent a high-level view of a distributed or an object-oriented
system.
Examples
Class Diagram
• The class diagram depicts a static view of an application. It
represents the types of objects residing in the system and
the relationships between them. A class consists of its
objects, and also it may inherit from other classes. A class
diagram is used to visualize, describe, document various
different aspects of the system, and also construct
executable software code.
• It shows the attributes, classes, functions, and relationships
to give an overview of the software system. It constitutes
class names, attributes, and functions in a separate
compartment that helps in software development. Since it is
a collection of classes, interfaces, associations,
collaborations, and constraints, it is termed as a structural
diagram.
Purpose of Class Diagrams
• The main purpose of class diagrams is to build a static view
of an application. It is the only diagram that is widely used
for construction, and it can be mapped with object-oriented
languages. It is one of the most popular UML diagrams.
Following are the purpose of class diagrams given below:
1.It analyses and designs a static view of an application.
2.It describes the major responsibilities of a system.
3.It is a base for component and deployment diagrams.
4.It incorporates forward and reverse engineering.
Benefits of Class Diagrams
• It can represent the object model for complex systems.
• It reduces the maintenance time by providing an overview of
how an application is structured before coding.
• It provides a general schematic of an application for better
understanding.
• It represents a detailed chart by highlighting the desired
code, which is to be programmed.
• It is helpful for the stakeholders and the developers.
Vital components of a Class
Diagram
• The class diagram is made up of three sections:
• Upper Section: The upper section encompasses the name of the class. A
class is a representation of similar objects that shares the same
relationships, attributes, operations, and semantics. Some of the following
rules that should be taken into account while representing a class are given
below:
– Capitalize the initial letter of the class name.
– Place the class name in the center of the upper section.
– A class name must be written in bold format.
– The name of the abstract class should be written in italics format.
• Middle Section: The middle section constitutes the attributes, which
describe the quality of the class. The attributes have the following
characteristics:
– The attributes are written along with its visibility factors, which are public
(+), private (-), protected (#), and package (~).
– The accessibility of an attribute class is illustrated by the visibility factors.
– A meaningful name should be assigned to the attribute, which will explain
its usage inside the class.
Continue…
• Lower Section: The lower section contain methods or
operations. The methods are represented in the form of a
list, where each method is written in a single line. It
demonstrates how a class interacts with data.
1) Exactly one - 1
2) Zero or one - 0..1
3) Many - 0..* or *
4) One or more - 1..*
5) Exact Number - e.g. 3..4 or 6
6) Or a complex relationship - e.g. 0..1, 3..4, 6.*
7)would mean any number of
8)objects other than 2 or 5
Relationships
Aggregation: An aggregation is a subset of association,
which represents has a relationship. It is more specific then
association. It defines a part-whole or part-of relationship. In
this kind of relationship, the child class can exist
independently of its parent class.
The company encompasses a number of employees, and even
if one employee resigns, the company still exists.
Relationships
Composition: The composition is a subset of aggregation. It
portrays the dependency between the parent and its child,
which means if one part is deleted, then the other part also
gets discarded. It represents a whole-part relationship.
A contact book consists of multiple contacts, and if you delete
the contact book, all the contacts will be lost.
How to draw a Class
Diagram?
• The class diagram is used most widely to construct software applications. It not
only represents a static view of the system but also all the major aspects of an
application. A collection of class diagrams as a whole represents a system.
• Some key points that are needed to keep in mind while drawing a class diagram
are given below:
1. To describe a complete aspect of the system, it is suggested to give a meaningful
name to the class diagram.
2. The objects and their relationships should be acknowledged in advance.
3. The attributes and methods (responsibilities) of each class must be known.
4. A minimum number of desired properties should be specified as more number of
the unwanted property will lead to a complex diagram.
5. Notes can be used as and when required by the developer to describe the
aspects of a diagram.
6. The diagrams should be redrawn and reworked as many times to make it correct
before producing its final version.
Class Diagram Example
• A class diagram describing the sales order system is given below.
ATM System
Behavioral elements
l
The behavior of a computer-based system can have a profound effect
on the design that is chosen and the implementation approach that
Therefore, the requirements model must provide modeling elements
that depict behavior.
l
The state diagram is one method for representing the behavior of a
system by depicting its states and the events that cause the system to
change state. A state is any observable mode of behavior. In addition,
the state diagram indicates what actions (e.g., process activation) are
taken as a consequence of a particular event.
State Diagram
l
A state diagram is used to represent the condition of the system or part
of the system at finite instances of time. It’s a behavioral diagram and it
represents the behavior using finite state transitions.
l
State diagrams are also referred to as State machines and State-chart
Diagrams. These terms are often used interchangeably. So simply, a
state diagram is used to model the dynamic behavior of a class in
response to time and changing external stimuli.
l
We can say that each and every class has a state but we don’t model
every class using State diagrams. We prefer to model the states with
three or more states.
Uses of statechart diagram
l
We use it to state the events responsible for change in state (we do not
show what processes cause those events).
l
We use it to model the dynamic behavior of the system .
l
To understand the reaction of objects/classes to internal or external
stimuli.
l
Difference between state diagram and flowchart –
l
The basic purpose of a state diagram is to portray various changes in
state of the class and not the processes or commands causing the
changes. However, a flowchart on the other hand portrays the
processes or commands that on execution change the state of class or
an object of the class.
Basic components of a
statechart diagram
l
Initial state – We use a black filled circle represent the initial state of a
System or a class.
l
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.
l
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.
l
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.
l
Join – We use a rounded solid rectangular bar to represent a Join
notation with incoming arrows from the joining states and outgoing
arrow towards the common goal state. We use the join notation when
two or more states concurrently converge into one on the occurrence
of an event or events.
l
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.
l
Final state – We use a filled circle within a circle notation to represent
the final state in a state machine diagram.
Basic components of a
statechart diagram
l
Steps to draw a state diagram
l
Identify the initial state and the final terminating states.
l
Identify the possible states in which the object can exist (boundary
values corresponding to different attributes guide us in identifying
different states).
l
Label the events which trigger these transitions.
Example – state diagram for an
online order
Negotiating Requirements
l
The best negotiations strive for a “win-win” result. 21 That is,
stakeholders win by getting the system or product that satisfi es the
majority of their needs and you (as a member of the software team)
win by working to realistic and achievable budgets and deadlines.
l
Rather than a single customer communication activity, the following
activities are defi ned:
l
1. Identifi cation of the system or subsystem’s key stakeholders.
l
2. Determination of the stakeholders’ “win conditions.”
l
3. Negotiation of the stakeholders’ win conditions to reconcile them into
a set of win-win conditions for all concerned (including the software
team).
Negotiating Requirements
l
In handshaking, the software team proposes solutions to requirements,
describes their impact, and communicates their intentions to customer
representatives.
l
The customer representatives review the proposed solutions, focusing
on missing features and seeking clarifi cation of novel requirements.
Requirements are determined to be good enough if the customers
accept the proposed solution.
l
Handshaking allows detailed requirements to be delegated to software
teams. The teams need to elicit requirements from customers (e.g.,
product users and domain experts), thereby improving product
acceptance. Handshaking tends to improve identifi cation, analysis,
and selection of variants and promotes win-win negotiation.
Validating Requirements
l
As each element of the requirements model is created, it is examined
for inconsistency, omissions, and ambiguity. The requirements
represented by the model are prioritized by stakeholders and grouped
within requirements packages that will be implemented as software
increments. A review of the requirements model addresses the
following questions:
l
1. Is each requirement consistent with the overall objectives for the
system or product?
l
2. Have all requirements been specifi ed at the proper level of
abstraction? That is, do some requirements provide a level of technical
detail that is inappropriate at this stage?
l
3. Is the requirement really necessary or does it represent an add-on
feature that may not be essential to the objective of the system?
Validating Requirements
5. Is each requirement bounded and unambiguous?
6. Does each requirement have attribution? That is, is a source
(generally, a specifi c individual) noted for each requirement?
7. Do any requirements confl ict with other requirements?
8. Is each requirement achievable in the technical environment that will
house the system or product?
8. Is each requirement testable, once implemented?
9.Does the requirements model properly refl ect the information,
function, and behavior of the system to be built?
l
These and other questions should be asked and answered to ensure
that the requirements model is an accurate refl ection of stakeholder
needs and that it provides a solid foundation for design.