pptx

CMPT 275
Software Engineering
Requirements Analysis activity
(use case diagrams, Class activity)
Janice Regan, 2008-2014
1
Validation & Verification
 Validation
 Are we building the right product?
 To facilitate validation we number our
functional requirements and propagate these
numbers throughout our models and source
code, validating that all functional
requirements are parts of the system.
 Verification:
 Are we building the product right?
Janice Regan, 2008-2014
2
Class exercise
 Read the requirements for the "Matrix
Math Demonstrator" (hand out)
 Work in your project groups
 You will have 2-3 minutes to identify the
actors in the "Matrix Math Demonstrator“
(MMD)
 Then we will work through, requirement
by requirement, to identify the list of use
cases needed to implement the "Matrix
Math Demonstrator“, and the
relationships between those use cases
Janice Regan, 2008-2014
3
Class exercise
 Read the requirements for the "Matrix
Math Demonstrator" (hand out)
 Work in your project groups
 You will have 2-3 minutes to identify the
actors in the "Matrix Math Demonstrator“
(MMD)
 Then we will work through, requirement
by requirement, to identify the list of use
cases needed to implement the "Matrix
Math Demonstrator“, and the
relationships between those use cases
Janice Regan, 2008-2014
4
Use cases for MMD
 Primary actors for the system:
 User
 Secondary actors for the system:
 Matrix Database?
 But the Matrix database is a custom
application and is part of the MMD. It is not
an external system with which the system
interacts, so it is not an actor at all.
(Requirement 12)
Janice Regan, 2008-2014
5
Requirement 1
The “Matrix Math demonstrator” must have a
graphical user interface (GUI) with 2 main
windows.
 The problem window occupies the leftmost
2/3 of the GUI
 The solution window occupies the rightmost
1/3 of the GUI
 Buttons to perform matrix operations will
appear at the to of the GUI
 A status bar to contain error messages will
appear at the bottom of the GUI
Janice Regan, 2008-2014
6
Use cases for MMD
 Consider Requirement 1, who are the
initiating actors, what use case or cases do
we need?
 Requirement 1 specifies layout of the GUI not
function of the system. It is a non-functional
requirement (how something is done not what
is done) and thus does not generate any use
cases.
Janice Regan, 2008-2014
7
Requirement 2
The “Matrix Math demonstrator” creates matrices
of dimension M rows by N columns.

Elements of created matrices are random floating point
numbers between 1.0 and 10.0.

M and N must be <= 20

To create a symmetric matrix the user enters the
number of rows (and columns) M and then presses to
“SYM” GUI button

To create a matrix that is not symmetric the user inputs
the number of rows, M, as the first operand presses the
”BY” operator button and then enters the number of
columns, N, as the second operand.
Janice Regan, 2008-2014
8
Use Cases for MMD
 Identify each action the user expects from
the system. What actions are needed to
satisfy requirement 2
 Create matrices
 What use cases do we need?
 Identify use cases
 CreateMatrix
 CreateSymmetricMatrix
Janice Regan, 2008-2014
9
Use Cases for MMD
 Do any of our actors initiate these use
cases?
 Not directly.
 Read ahead to requirement 7
 Both these use cases are initiated when the
user presses the “Results” button.
 Pressing the “Results” button should initiate
a separate use case
Janice Regan, 2008-2014
10
Use Cases for MMD
 Analyze the use cases and determine if
any common actions are repeated within
multiple use cases.
 For requirement 2 both use cases
require that we generate random
numbers
 Identify one new use case
 GenerateRandomNumbers
Janice Regan, 2008-2014
11
Use Cases for MMD
 Analyze the use cases and determine if
any actions within a use case are done
only in some unusual situations.
 Error conditions?
 Return to these later, as they are discussed
in later requirements
 Any Others?
 none
Janice Regan, 2008-2014
12
Use case diagram: 1
CreateSymmetricMatri
x
GenerateRandomNumbers
user
CreateMatrix
13
Janice Regan, 2008-2014
Use Cases for MMD
 Identify each action the user expects from
the system to satisfy requirements 3-5
14
Janice Regan, 2008-2014
Requirement 3
The “Matrix Math demonstrator” adds or
subtracts any two matrices with the same
dimensions.
 The add operator is represented by the “+”
GUI button
 The subtract operator is represented by the “-
” GUI button
15
Janice Regan, 2008-2014
Requirements 4 and 5
4 The “Matrix Math demonstrator” multiplies
any M by N matrix by any N by L matrix
 The multiply operator is represented by the
“X” GUI button
5 The “Matrix Math demonstrator”
calculates the transpose of any matrix
 The transpose operator is .represented by the
“TRANSPOSE” GUI button.
16
Janice Regan, 2008-2014
Use Cases for MMD
 Identify each action the user expects from
the system to satisfy requirements 3-5
 Need to add, subtract, multiply pairs of
matrices and transpose single matrices
 Define four new use cases
 Add2Matrices (#3)
 Subtract2Matrices (#3)
 Multiply2Matrices (#4)
 TransposeMatrix. (#5)
 Are any of these use cases is initiated directly
by the primary actor ?
Janice Regan, 2008-2014
NO
17
Use case diagram: 2
CreateSymmetricMatri
x
GenerateRandomNumbers
user
CreateMatrix
#3
#3
Subtract2Matrice
s
#5
#4
Janice Regan, 2008-2014
Add2Matrices
TransposeMatrix
Multiply2Matrice
s
18
Use Cases for MMD
 Identify each action the user expects from
the system to satisfy requirement 6
 The operand(s) and operator(s) must be
entered into the system in the following
order:
 For binary operators: operand, operator,
operand (e.g. operand1 + operand2 ) or
 For unary operators: operand, operator (e.g.
operand1 TRANSPOSE).
Janice Regan, 2008-2014
19
Use Cases for MMD
 Identify each action the user expects from
the system to satisfy requirement 6
 For requirement 6 we need to input operators
and operands.
 Define two new use cases

InputOperator

InputOperand.
 Are these use cases are initiated by the user
(primary actor)?

YES
Janice Regan, 2008-2014
20
Use Cases for MMD
 Identify each action the user expects from
the system to satisfy requirement 7
 To obtain the result, for any problem
entered as outlined in 2-6, the user
must press on the “RESULT” button
on the GUI.
Janice Regan, 2008-2014
21
Use Cases for MMD
 Identify each action the user expects from
the system to satisfy requirement 7
 Initiate and execute the calculation that
has been requested (by pressing result)
 Define new use case
 DoCalculation.
 Is this use cases is initiated by the user
(primary actor)?
 YES
Janice Regan, 2008-2014
22
Use Cases for MMD
 Identify each action the user expects from
the system to satisfy requirement 8
The operand(s) and operator(s), must be
displayed in the “problem window” of the
GUI, the result must be displayed in the
“solution window” of the GUI.
 Display occurs when the “RESULT” GUI button
is pressed.
Janice Regan, 2008-2014
23
Use Cases for MMD
 Identify each action the user expects from
the system to satisfy requirement 8
 Display operators and matrices (operands)

Any single number can be represented as a 1x1
matrix to display single number operands.
 Define two new use cases
 DisplayMatrix
 DisplayOperator.
 Are these use cases are not initiated by the
user (primary actor)?
NO
Janice Regan, 2008-2014
24
Use case diagram: 2
CreateSymmetricMatri
x
DisplayOperator
#8
GenerateRandomNumbers
user
DisplayMatrix
#8
#7
BeginCalculation
CreateMatrix
#3
#3
Subtract2Matrice
s
#5
#6
InputOperand
#6
InputOperator
Janice Regan, 2008-2014
Add2Matrices
#4
TransposeMatrix
Multiply2Matrice
s
25
Use Cases for MMD
 Analyze the use cases and determine if
any common actions are repeated within
multiple use cases.

Use cases for requirements 2-5 all require
 display of the resulting matrix (answer) to
the "results window" of the GUI
 display of operands to the "problem
window“
 display operators to the "problem window"
Janice Regan, 2008-2014
26
Use Cases for MMD
 Does the user directly request display of the
operators, operands and results?

NO

Calculating the results, by executing the DoCalculation
use case, triggers these displays.
 DisplayMatrix and DisplayOperator are common
to Add2Matrices, Subtract2Matrices,
Multiply2Matrices, TransposeMatrix,
CreateMatrix and CreateSymmetricMatrix (all of
which are initiated by pressing "RESULT" and
initiating the Do Calculation use case).
Janice Regan, 2008-2014
27
Use case diagram: 3
CreateSymmetricMatri
x
GenerateRandom
Numbers
DisplayOperator
<<include>> #8
<<include>> #8
user
DisplayMatrix
#7
DoCalculation
#2
CreateMatrix
Add2Matrices
Subtract2Matrice
s
TransposeMatrix
#6
InputOperand
#6
InputOperator
Janice Regan, 2008-2014
Multiply2Matrice
s
28
Use Cases for MMD
 Analyze the use cases and determine if any actions
within a use case are done only in some situations.
 Use case DoCalculation, actually initiates and
performs several kinds of calculation.
 Each of the calculations is a special case that is
only performed in some situations.
 The use cases Add2Matrices, Subtract2Matrices,
Multiply2Matrices, TransposeMatrix,
CreateMatrix and CreateSymmetricMatrix can
therefore be considered as extensions of the
DoCalculation Use Case
Janice Regan, 2008-2014
29
Use case diagram: 3
CreateSymmetricMatri
x
GenerateRandom
Numbers
DisplayOperator
<<include>> #8
<<include>> #8
user
DisplayMatrix
#7
DoCalculation
#2
CreateMatrix
Add2Matrices
Subtract2Matrice
s
TransposeMatrix
#6
InputOperand
#6
InputOperator
Janice Regan, 2008-2014
Multiply2Matrice
s
30
Use Cases for MMD
 Identify each function the user expects from the
system. Consider requirements 9-12
Janice Regan, 2008-2014
31
Requirement 9

A matrix, once created or obtained as a result of a matrix
operation, can be stored in the matrix database for later
use as an operand.

To store a matrix in the matrix database use the “SAVE
RESULT” operator button on the GUI.

When the matrix has been successfully saved to the database
the message “SAVED” should appear in the status bar.

To remove a saved matrix from the database select the
matrix (see requirement 10) then press the “REMOVE” GUI
button.

When the matrix has been successfully removed from the
database the message “REMOVED” should appear in the
status bar.
Janice Regan, 2008-2014
32
Requirement 10
 If the user does not remember the name of the
matrix operand, the user can access a list of all
matrices in the matrix database.

Pressing the ”SELECT” GUI button will cause a list of all
existing matrices, their dimensions and types to be
displayed in the solution window. The desired matrix
can then be selected from the list by clicking on the
desired matrix

The list of matrices should not vanish until the
“RESULT” GUI button is pressed.

The “SELECT” GUI button should not affect the
problem window.
Janice Regan, 2008-2014
33
Requirements 11-12
 If the user wishes to start a new calculation
pressing the “CLEAR” GUI button will clear all
presently entered information from the system and
all displayed information from the GUI, it will
prepare the Matrix Math demonstrator for its next
series of calculations.
 The matrix database is a custom solution that is
part of the “Matrix Math Demonstrator”. No
database interface is required.
Janice Regan, 2008-2014
34
Use Cases for MMD
 Identify each function the user expects from the
system. Consider requirements 9-12
 For requirement 9 we will need to save matrices to,
and remove matrices from the matrix database.
 Define two new use cases SaveMatrix,
RemoveMatrix. Each of these use cases is initiated
by the primary actor (the user).
 Requirement 10 specifies that the user should be
able to select from a list of the matrices in the
matrix database
 Define an additional use case SelectMatrix. This use
case is initiated by the primary actor (the user)
Janice Regan, 2008-2014
35
Use Cases for MMD
 Identify each function the user expects from the
system. Continue considering requirements 9-12
 For requirement 11 we will need to clear the
display and in preparation for a new system.
 Define a new use case ClearDisplay. This use
cases is initiated by the primary actor (the
user).
 Requirement 12 indicates that the matrix
database is part of the system. This
requirement does not specify a function of the
system (non-functional).
Janice Regan, 2008-2014
36
Use case diagram: 6
CreateSymmetricMatri
x
ClearDisplay
#11
GenerateRandom
Numbers
DisplayOperator
user
<<include>> #8
DisplayMatrix
#7
DoCalculation
#2
<<include>> #8
CreateMatrix
#10
SelectMatrix
#9
RemoveMatrix
#9
SaveMatrix
#6
InputOperand
#6
InputOperator
Janice Regan, 2008-2014
Add2Matrices
Subtract2Matrice
s
TransposeMatrix
Multiply2Matrice
s
37
Use Cases for MMD
 Analyze the use cases and determine if any
common actions are repeated within multiple
use cases.
 Saving, Accessing, and Removing matrices from
the database requires accessing of the database
 Create a use case AccessDatabase to take care of
this common action
 Saving and Removing matrices requires a status
be displayed on completion
 Create a use case DisplayStatus to take care of
this common action
Janice Regan, 2008-2014
38
Use case diagram: 7
CreateSymmetricMatri
x
ClearDisplay
#11
GenerateRandom
Numbers
user
DisplayOperator
<<include>> #8
DisplayMatrix
<<include>> #8
DoCalculation
#7
#10
CreateMatrix
SelectMatrix
#9
RemoveMatrix
Add2Matrices
Subtract2Matrice
s
DisplayStatus
#9
SaveMatrix
TransposeMatrix
#6
InputOperand
#6
InputOperator
Janice Regan, 2008-2014
Access
Database
Multiply2Matrice
s
39
Use Cases for MMD
 Identify each function the user expects
from the system. Consider requirements
13-15
13
If the matrix operands have inconsistent
or incorrect dimensions when the
“RESULT” GUI button is pressed the
“Matrix Math demonstrator” must
display the message “ERROR – problem
with matrix dimensions” in the status
bar at the bottom of the GUI
Janice Regan, 2008-2014
40
Requirement 14
 If the matrix cannot be created due to
lack of memory when the “RESULT” or
“SYM” GUI button is pressed the “Matrix
Math demonstrator” must display the
message
“ERROR – insufficient
memory” in the status bar at the bottom
of the GUI.
Janice Regan, 2008-2014
41
Requirement 15
 If errors of any other kinds occur, the
software system must display the
message
"ERROR occurred but no
clue why!" in a status bar at the bottom
of the GUI. (Note that you may have a
reason for the error specified in one of
your exception flow of events sections
and still generate this error if the reason
for failure is not given in requirements 13
or 14)
Janice Regan, 2008-2014
42
Use Cases for MMD
 Identify each function the user expects
from the system. Consider requirements
13-15
 For requirement 13-15 we will deal with some
exceptional conditions in use cases 2-5. The
exceptional conditions deal with error
conditions within these use cases
 Define a use case Display Error. This use case
is not initiated by the primary actor but by the
ocurrence of an error in use case
DoCalculation.
Janice Regan, 2008-2014
43
Use Cases for MMD
 Analyze the use cases and determine if any actions are
done within multiple use cases.
 Each matrix calculation or creation will produce a
result matrix unless an error occurs in the calculation
or creation of the matrix.
 Errors are discussed in requirements 13 to 15
 In extraordinary circumstances an error of any of the
types mentioned in requirements 13-15 may occur in
any of the use cases for requirements 2-5,
CreateMatrix, CreateSymmetricMatrix, Add2Matrices,
Subtract2Matrices, Multiply2Matrices, Transpose
Matrix.
Janice Regan, 2008-2014
44
Use case diagram: 8
CreateSymmetricMatri
x
ClearDisplay
#11
GenerateRandom
Numbers
user
DisplayOperator
<<include>> #8
<<include>> #8
DisplayMatrix
DisplayError
DoCalculation
#7
#10
<<include>> #13 #14 #15
CreateMatrix
SelectMatrix
#9
RemoveMatrix
Add2Matrices
Subtract2Matrice
s
DisplayStatus
#9
SaveMatrix
TransposeMatrix
#6
InputOperand
#6
InputOperator
Janice Regan, 2008-2014
Access
Database
Multiply2Matrice
s
45