Professional Documents
Culture Documents
Software Requirements
Engineering
Topic 8:
Requirements Analysis II
Contents
• Use Case Modelling
• Sequence Modelling
• Class Diagram
• Entity-Relationship
RECAP
Requirements Engineering Process
R equirements
Feasibility
elicitation and
study
analysis
R equirements
specification
Feasibility R equirements
r eport validation
System
models
R equirements
document
What is a Scenario?
….A scenario is a short story about people, their activities and the
contexts in which those activities take place that are relevant to
the technology in question…
[Alexander & Maiden, 2004]
7
2. Write Use Case Specification(s)
8
What is a Use Case Diagram?
• Use case diagrams are used to specify the system
from a user’s perspective in a way that is clear and
easy to read.
– Illustrate the system behaviour particularly the
functional requirements.
<<actor>>
Customer
Customer
• If the actors are system, stereotype <<system>> is usually used.
<<system>>
InventorySystem
Time
Find Use Cases
• A use case is a specification of sequences of actions
(including variants and errors) that a system can perform by
interacting with outside actors.
• It is something an actor wants the system to do (user goal) .
– How does each actor use the system? What does the system do for
each actor?
PlaceOrder GetStatusOnOrder
The Use Case Diagram
System name
System boundary
Communication
relationship
PlaceOrder
ShippingCompany
ShipProduct
CancelOrder
Customer
CheckOrderStatus Use case
Actor
Dispatcher
The Use Case Diagram
17
The Use Case Specification
• Brief - Terse/short one-paragraph summary. Usually illustrate the main
success scenario. E.g.:
Process Sale: A customer arrives at a checkout with items to purchase. The cashier uses the Point-of-Sale
system to record each purchased item. The system presents a running total and line-item details. The cashier
enters payment information, which the system validates and records. The system updates inventory. The
system produces a receipt. The customer receives the receipt from the cashier and then leaves with the items.
A customer arrives at a checkout with items to return. The cashier uses the Point-of-Sale system to record each returned
item …
Alternate Scenarios:
– If the credit authorization is rejected, inform the customer and ask for an alternate payment method.
– If the item identifier is not found in the system, notify the Cashier and suggest manual entry of the identifier
code.
The Use Case Specification
• The comprehensive use case description is called fully
dressed use case.
Brief description
Brief description:
The Customer changes the quantity of an item in the basket.
Primary actors:
Actors involved Customer
Secondary actors:
None
System state before the Preconditions:
use case can begin 1. The shopping basket contents are visible.
Main flow:
1.The use case starts when the Customer selects an item in the basket.
Actual steps of the
2.If the Customer selects “Delete”
use case 2.1 The system removes the item from the basket.
3.If the Customer types in a new quantity
3.1 The system updates the quantity of the item in the basket.
System state when the Postconditions:
use case has finished None
Alternative flows Alternative flows:
to the main flow None
Exception flows to Exception flows:
the main flow None
The Use Case Specification
• Use case name
– Normally the words are run together and each word starts with an
uppercase letter.
– Should always be a verb, as the use case describes system behaviour.
– Choose a name that is short yet descriptive and unique.
• Use case ID
– Unique identifier in a form of numbers. May use hierarchical
numbering system (e.g. 3.1, 3.2)
• Brief description
– A single paragraph that summarises the goal of the use case (i.e. the
business benefit that it delivers to its actors).
The Use Case Specification
• Actors
– Primary actors => these actors actually trigger the use case.
– Secondary actors => these actors interact with the use case after it has
been triggered.
– Each use case is always triggered by a single actor. However, the same
use case may be triggered by different actors at different points in time.
• Preconditions and Postconditions
– Preconditions constrain the state of the system before the use case can
start (i.e. what must be true before).
– Postconditions constrain the state of the system after the use case has
executed (i.e. what will be true after).
– Boolean conditions (i.e True or False).
The Use Case Specification
• Main Flow
– Describes ‘perfect world’ steps in a use case, where everything goes as
expected and desired and there are no errors, deviations, interrupts or
branches.
– Sometimes known as the ‘primary scenario’.
– Always begins by the primary actor doing something to trigger the use case.
A good way to start is: The use case starts when an <actor> <function>.
– Consists of a sequence of short steps that are declarative, numbered and
time ordered. Each step should be: <number> The <something> <some
action>.
– Active sentences. E.g.
1. The use case starts when the customer selects ‘Place Order’.
2. The customer enters his or her name and address into the form.
The Use Case Specification
Use Case: xxx
• Main Flow ID: X
Brief description:
– May use ‘If’ to indicate xxx
branches (has Primary actors:
alternatives). xxx
Secondary actors:
xxx
Preconditions:
xxx
Main flow:
1.The use case starts when the Customer selects an item in the
basket.
2.If the Customer selects “Delete”
2.1 The system removes the item from the basket.
3.If the Customer types in a new quantity
3.1 The system updates the quantity of the item in the basket.
Postconditions:
xxx
Alternative flows:
xxx
The Use Case Specification
Use Case: xxx
ID: X
• Main Flow Brief description:
xxx
– May use ‘For’ to
Primary actors:
indicate repetition. xxx
Postconditions:
xxx
Alternative flows:
xxx
The Use Case Specification
• Use cases can integrate related scenarios:
– Main scenario
– Alternative scenarios (optional)
– Exception scenarios (unintended)
The Use Case Specification
• Alternative Flow
– Each use case has one main flow and may have many alternative
flows.
– These are alternative paths through the use case that capture errors,
complex branches and interrupts to the main flow.
– They frequently do not return to the main flow, as they often deal
with errors and exceptions and tend to have different postconditions.
34
Use Case Constructs
• A use case may have generalization.
– Two or more use cases that have commonalities in behavior,
structure and purpose.
Actor Generalization
Representing inheritance relationship between actors in use
case diagram
Library System
Example:
Search Book
Don’t need this association to indicate
X VIP Member can Search Book
Reserve Book
Record
Book Loan
Record
Book Return
Record
Fine
Payment 39
Use Case Constructs
• A use case may have two dependencies: Include and Extend
• Include dependency between use cases (i.e. common
behaviour).
– Indicates the base use case will include/call the inclusion use case.
Base use case is dependent on the included use case(s); without
it/them the base use case is incomplete.
– E.g. Activities of project manager, resource managers and system
administrators are logged when they use project management
system.
Use Case Constructs
• Extend dependency between use cases (i.e. optional
behaviour).
– Indicates the extension use case will extend/be inserted into the
base use case. Extending use case is dependent on the base use case;
base use case is a fully functional on its own.
– E.g., Project manager may manage projects by maintaining the
project itself, its activities, or its tasks.
Use Case Constructs
Extend Relationships
Include Relationships
Use Case Constructs
Example:
Benefits of Use Case
• It is task-centric and user-centric perspective.
• Between actors
52
Sequence Diagram
[invalid destination]
Sequence Diagram
UML Notation: ref
• "ref" fragment refers to parts specified in another sequence
diagram.
• To avoid duplication.
Reference to another SD
55
Class Diagram
• Used when developing an object-oriented system model to
show the classes in a system and the relationships between
these classes.
Attributes
Methods/
operations/
behaviours
Object-Oriented Class Relationships
1. Association
2. Aggregation
3. Composition
4. Inheritance
Association in Concept
Super class
Subclass
Class Diagram
Example: UML class diagram (Generalization)
Superclass
Subclasses
Class Diagram
Route Vehicle
Navigation device 1 1
* *
Travel Duration < Shows < Has Velocity interstate
Identification
Distance Velocity highway
1..*
Employs
Assigned-to Assigned-to
Person Flight Plane
Stocks
Store Item
1 *
Association multiplicity
70
71
A Student can take up to five Courses.
Student has to be enrolled in at least one course.
Up to 300 students can enroll in a course.
A class should have at least 10 students.
Student Course
10..300 takes 1..5
72
Class Diagram
Entity-Relationship
Diagram
Identification
Distance
Navigation
Route calculates
N M device
Duration
M 1
Road N
Traffic jam queries
Average velocity highway
Start information
Length 1 Vehicle
belongs to
Cardinality
Average velocity interstate
Entity-Relationship Diagram
THANK YOU
• Question?
• Tutorial (this week):
– Conduct analysis (group project)
• Draw a goal diagram
• Draw a context diagram
– Phase 2
• Lecture (next topic):
– Requirements Analysis III
RECAP - Group Project (Phase 1):
Requirements Elicitation
Based on the chosen project title:
•Identify and classify your stakeholders – Who are they? Why are they selected?
•Determine the sources of requirements – From where you get the requirements?
•Select the suitable requirements elicitation techniques and justify your selection –
How do you elicit the requirements? Why do you choose that way?
•Recognise the activities involved in the elicitation process – What are the steps that
you take to accomplish the task?
•Execute the requirements elicitation process – Go to the field and run the show!
Describe and elaborate the above in the report. Submit at the end of the semester
(Phase 1 + 2 + 3).
Group Project (Phase 2):
Requirements Analysis & Modelling
Based on the requirements that you elicited in Phase 1:
•Draw a Goal Diagram
— To illustrate the goals of stakeholders.
Include the above in the report. Submit at the end of the semester
(Phase 1 + 2 + 3).
Goal Diagram
(How to start) ULS – University
Example: Learning System
Goal Diagram
Example: (How to start)
Goal Diagram
(How to start)
Example:
L- Lecturer; S - Student
Goal Diagram
(How to start)
Example: