8/12/2019 3b Re Tech Softeng 0203
1/35
Requirements Engineering
System modeling notations andtechniques
2
1: knowledge
2: request more knowledge
3: requirements models
4: validation results
5: models to be validated
RE process framework
Problem
domain
Elicitation ValidationSpecification
Userrequirements
User feedback
Domainknowledge
Domainknowledge
1 3
4
reqs
spec
2
5
User
8/12/2019 3b Re Tech Softeng 0203
2/35
3
Elicitation: Guidelines
Elicitation should identify
A representation of relevant information
A model of software behaviour
Elicitation should consider how the system
Will be structured (from the user perspective)
Will provide functionality
Complex systems must be partitionedhierarchically
Elicitation is then carried out separately ondifferent parts
4
System Modeling Techniques
Object-oriented model: Use Cases, Activitydiagrams, Class diagrams, CRC cards.
Functional model: SADT (Structured Analysis andDesign Technique), dataflow diagrams
Data-oriented model: Entity-Relationship diagrams
(akin to class diagrams) Dynamic model: state transition diagrams, Petri-
nets
8/12/2019 3b Re Tech Softeng 0203
3/35
5
Levels of formality
Informal specification
Based on natural language (ambiguous)
Formal specification
Based on mathematical language
Semi-formal specification
Made of both informal and formal parts
Use Case Diagram
8/12/2019 3b Re Tech Softeng 0203
4/35
7
Use Case Diagram
Semi-formal notation
Specifies the interactions between the system andthe external world
Useful to
Oblige the analyst to state well-defined boundariesbetween system and external world
Organize system functions into elements (usecases) on which attention is focused
Supply a first basis for the specification of system
structure from the user perspective
8
Elements of a Use Case Diagram Someone (user) or something (external system,
hardware) that
Exchanges information with the system
Supplies input to the system, or receivesoutput from the system
A functional unit (functionality) part of thesystem
Actor
Use Case
8/12/2019 3b Re Tech Softeng 0203
5/35
9
Relations among Use Cases
Usage. Models that a selectedfunctionality is used in the context ofanother functionality (one is a phase ofthe other)
Generalization. Defines a functionality
as extension of another already
existing functionality (special case)
Interaction. Models:
Which actors participate in a use case Where execution starts
Actor
Use Case
Actor
Use Case
Use Case B
Use Case B
Use Case A
Use Case A
10
Online Courses At the beginning of the semester, the students office has to
supply the students with the list of available coursesthrough a system of online registration.
Each student must select 4 available courses, and statetwo possible alternatives.
Each course must have from 3 to 20 students: courseswith less than 3 students are cancelled, and those withmore than 20 are split.
In the previous period, the professors access the systemonline to insert their courses in the list, while in the periodafter students selection they access to check current stateof enrolled students to their courses.
After the selection period, the system creates def. lists, bysolving all anomalies (courses with less than 3 or morethan 20 selections) and it sends them to administrativeoffice to state enrolment charges due by each student.
The students access the system for the list of their courses
All user interactions are authenticated
8/12/2019 3b Re Tech Softeng 0203
6/35
11
UCD for Online Courses
Administrative Office
Students
Request Course List
Course Selection Request Students List
User Authentication
Professor
Insert Course
12
Further example of relationsInclude/Generalize
Customer
Check availability
Hotel Booking
Acquire Customer data
Hotel Booking guaranteed by
Credit Card
Acquire Credit Card data
8/12/2019 3b Re Tech Softeng 0203
7/35
13
Domestic Security System Once installed, the system monitors all connected sensors
(of movement, entrance, smoke), and interacts with the
user though a keyboard and a display inside a dedicatedcontrol panel.
During installation, the control panel is used to configurethe system. Each sensor is assigned with a unique numericcode and the phone number of the monitoring service tocall in case of events related with a sensor. It also defines apassword for activate/deactivate the system.
In case of an event related with some sensors, the systemdisplays a message and produces an acoustic alarm. Aftera period (defined during user configuration) the system
calls the phone number associated with the sensor. Shouldthe number be busy, the system repeats the call every 20seconds.
14
UCD for Domestic Security System
Sensor
Monitoring Service
Acoustic Transmitter
Set password
Configuration
Configure sensor
Event management
User
8/12/2019 3b Re Tech Softeng 0203
8/35
Data Flow Diagram
16
Dataflow Diagram
Semi-formal notation
Popularized in the 70s and 80s by Yourdon andConstantine
Two step process: Structured Analysis (SA) andStructured Design (SD)
SA: dataflow diagrams SD: structure charts
8/12/2019 3b Re Tech Softeng 0203
9/35
17
Entities in a data flow diagram
external entities
processes
data flows
data storesData label
Data label
Entity name
Function
name
18
Context Diagram
Management
Front-Desk
Personnel
Guest
Room Service
Personnel
Catering
Personnel
reports
request for
information
reservationconfirmation
check-in/
check-out formorder
update billbill
order
update bill
Hotel
ReservationSystem
8/12/2019 3b Re Tech Softeng 0203
10/35
19
Dataflow Diagram (Fragment)
Check Out
client reservation
log
bill
Check out decomposition:calculate bill, generate bill, generate log info
20
Dataflow Diagrams
Dataflow diagrams can be further elaborated with
Data dictionaries: detailing data stores and flows
Mini-specs: detailing functional aspects
8/12/2019 3b Re Tech Softeng 0203
11/35
Activity diagram
22
Activity Diagram
Formal notation
In a conceptual model it represents the activities(sub-tasks) that needs to be done
Use cases and a hierarchical task decompositioncan be represented/visualized in activity diagrams
It can pinpoint the interactions between differentactivities (e.g. tasks and use cases)
8/12/2019 3b Re Tech Softeng 0203
12/35
23
Activity Diagram (cont.)
DoSomething
[condition]
Start Point
End Point
Synchronization Bar
Activity
Decision Activity
Guard
24
Activity Diagram (cont.)
Construct an activity diagram for order processing.
When an order arrives, payment must be authorizedand all ordered items must be in stock (otherwise theorder is suspended and items are reordered). Whenall items are present and payment took place, theorder is dispatched to the customer.
8/12/2019 3b Re Tech Softeng 0203
13/35
25
Activity Diagram (cont.)
DispatchOrder
ReorderItem
Receive order
Cancel orderAuthorizePayment
CheckLine Item
Assign toOrder
[failed]
[need toreorder]
[for each lineitem in stock]
[in stock]
[stock assigned to allline items and
payment authorized]
26
Activity Diagram (cont.)
What is not modeled with activity diagrams
Links between actions/responsibilities and objects(use CRC Cards)
Collaborations between objects (use interactiondiagrams)
Object life cycle (use state diagrams)
8/12/2019 3b Re Tech Softeng 0203
14/35
Class diagram
Type level
28
Classes and Class Instances
How to model a system able to open new Faculties(having a name and an athenaeum) and managingenrolment of new students (having a name and ID)?
8/12/2019 3b Re Tech Softeng 0203
15/35
29
Classes and Class Instances
association instances
(or links)
Student
ID
Name
matriculate()
Faculty
Name
Athenaeum
open()
11..n1..n 1
enrol
Class level
Instance level
association
Engineering
Architecture
Computer Science
Economics
X
X
Arts
X
Galileo Galilei
Albert Einstein
Martin L. King
30
What is a Class DiagramA Class Diagram describes
The types of objects in the system
The types of static relationships among them
We draw Class Diagrams under three perspectives
Conceptual Software independent
Language independent
Specification
Focus on the interfaces of the software
Implementation
Focus on the implementation of the software
8/12/2019 3b Re Tech Softeng 0203
16/35
31
Class
Window
- visible
- position
- size
+ resize()
+ display()
+ hide()
+ move()
Class Name
Attributes
Operations
private
public
32
Class Extensibility mechanisms to add new elements to UML
Stereotypes
A domain-specific or user-defined class level element
For classes
And associations
Tagged values
A pair describing a property of a model element
8/12/2019 3b Re Tech Softeng 0203
17/35
33
ClassName
publicState : UserDef = tested
privateAuthor : UserDef = pam
ProtectedOp(argname) : return
ClassInterface A
ClassInterface B
Math
Class ...
Attribute syntaxattrName : attrType = initialValue
Operation syntaxVisibility opName (argName:argType=DefaultValue,
):returnType
Interfaces
Utilities: no instances!
34
Associations
Structural relationships between classes ofobjects
Association multiplicity
Number of potential participating objects
1, 0..1, M..N, *, 0..*, 1..*
Class multiplicity
number of classes involved in the association
binary, ternary, N-ary
8/12/2019 3b Re Tech Softeng 0203
18/35
35
Association Multiplicity indicators
n Exactly n
*Zero o more
0..1Zero or one (optional)
m..nBetween m and n (included)
m..*From m above
36
Class Multiplicity: Binary Associations
Exam
-date
-subject
-studentsList
+print()
+enrolStudent()
+print()
-name
-surname
-code
ExamDate
+print()
-day
-month
-year
-time
Student Lesson
+print()
-subject
-teacherattends3..10 *
Name of
relationship
Takes-place-on* 1
Multiplicity
+attendee +attended
Roles
8/12/2019 3b Re Tech Softeng 0203
19/35
37
In other words Use
Two classes are in USE association (B uses A) ifinstances of B can send messages to instances of
A An object uses another object if able to send
messages to it
Company Personhiring
+Candidate+Employer
+apply() +interview()0..1 1..*
+seekJob()-planInterviews()
38
Associations (cont.)
Association naming and direction
To facilitate model understanding
Role naming
End of an association
When
Many associations connect two classes
One association connects the same class morethan once
8/12/2019 3b Re Tech Softeng 0203
20/35
39
Association Naming
Subscription
User Profile
Terminal
-Address+Type
Service Profile
+userPreferences
Service
+startService()1..*1..*
supportsdefault
1
0..*
1
0..*
constraints
User
1..*
0..*
1..*
registration
0..*
1
0..*
1
user service information
1
1
1
1
user
Information
0..*
0..*
0..*
0..*
subscription
40
Association Direction and RoleNaming
PersonPlanePassengers
Pilot
?
?
?
?
8/12/2019 3b Re Tech Softeng 0203
21/35
41
Associations (cont.)
Constraints on associations
Association classes
Grade
Student AssignmentDelivers
{time
8/12/2019 3b Re Tech Softeng 0203
22/35
43
Aggregation Composition as physical
containment
EngineCar
1 1
aggregate class
ComponentAggregate
0..1 *
Example
+start() #start()
44
Aggregation
Model the system allowing students to enroll inexams
Each exam date includes a date made of day,month. Year and time; it is associated with asubject.
On request, a student can enroll in a selectedexam.
The system further allows to
Move the date of an exam
Print out information about each object
8/12/2019 3b Re Tech Softeng 0203
23/35
45
Aggregation
Exam
+print()
+manageEnrollment()
+move()
+print()
+enroll()
-name
-surname
-code
ExamDate
+print()
+changeState()
-day-month
-year
-time
Student
Lesson
+print()
-subject
-teacher
* 1
*
*
1
*
- studentsList
- room
46
Generalization
Classification relationship between a generalelement and a more specific element
Inheritance in OO programming
Construct a class from another
Sharing attributes, operations and constraints
Visibility between superclass and subclass
Single (Java) or multiple (C++)
Inheritance and Delegation
8/12/2019 3b Re Tech Softeng 0203
24/35
47
Pure Specialization (Extension)
+refresh()
-image
Image Window
+resize()
+move()
+close()
-title-position
-size
Window
+replaceText()
+deleteText()
Text Window
Generalization
association
Base class(superclass)
Derived classes
(subclasses)
-text
inherits from
derives from
is a
48
Class HierarchyBuild the inheritance associations existing among thefollowing objects:
Living Being
Human Being
Flower
Animal
Vegetable
Merchant
Floweriest
Client
Suggestion
Group elements in classification sets, and then build thegeneralization hierarchy
8/12/2019 3b Re Tech Softeng 0203
25/35
49
Class Hierarchy
Animal
Merchant
Living Being
Vegetable
Flower
Human Being
Floweriest
Client
50
Impure Specialization
Sometimes we want to define exceptions to thespecialization mechanism
Overriding
To modify inherited properties
Usually for operation implementations (methods)
Never for interfaces
A subclass implements the interface of all itssuperclasses
8/12/2019 3b Re Tech Softeng 0203
26/35
51
Impure Specialization (Overriding)
+print()
-ID
Student
+print()
-name-surname
Person
+print()
-qualification
-salary
Employee
52
Multiple Inheritance
A class is derived from many superclasses
For its support, the language has to solve possibleconflicts
What happens if both superclasses support thesame message?
8/12/2019 3b Re Tech Softeng 0203
27/35
53
Properties of Inheritance
Transitivity
If B derives from A, then B derives from allsuperclasses of A
When multiple inheritance is not supported
The inheritance hierarchy becomes a tree
We can always transform inheritance in delegationassociations
54
Eliminating Multiple Inheritance
Displayable
Object
color
coordinates
filled
perimeter()
Polygon
vertices
translate()
rotate()
perimeter()
Displayable
Polygon
Displayable Object
color
coordinates
filled
perimeter()
Displayable Polygon
Polygon
vertices
translate()
rotate()
perimeter()
delegation
8/12/2019 3b Re Tech Softeng 0203
28/35
55
Abstract classes
Base for extensible systems
The set of general mechanisms is describedaccording to the specifications of the abstractclasses, without considering specific featuresgathered within concrete classes
Abstract property
Applicable to both classes and operations (themethod to be defined in subclasses)
An abstract class cannot be instantiated directly
It is allowed for types, packages and stereotypes
56
Abstract classes
Ast ratto
properties
operationOnly()
Abstract Class Name
(in italic)
No methods allowed!
8/12/2019 3b Re Tech Softeng 0203
29/35
57
When to use Class Diagrams
Do
Use it always!
Base for all OO methods
Base for tool-implemented code generation
Fit the perspective you are in
Conceptual Model during requirementsengineering
Specification models during design
Implementation models during language-specificphases
Showing a particular implementation technique
58
When to use Class Diagrams (cont.)
Do Not
Use all constructs (start from basics and useadvanced ones only if needed)
Draw models for everything
Focus on key aspects in few diagrams
Go down to implementation details too early
8/12/2019 3b Re Tech Softeng 0203
30/35
59
How to derive a Class Diagram
A noun could be a class.
Example: When we receive an order, we check each line itemon the order to see if we have the goods in stock. If we do,we assign the goods to the order. If this assignment sendsthe quantity of those goods in stock below the reorder level,we reorder goods.
What other classes can we identify?
Finding the classes: examine the use cases
60
How to derive a Class diagram(cont.)
Finding the classes: candidate objects
Order
Supply
Line Item
Reorder Level (attribute)
Product, Good (= Product) (individual instance) Product Description (meta level object describing
instances)
Stock (do we need this one?)
Company (not in use cases)
Customer (not in use cases, but needed to check thecreditworthiness)
Invoice (not in use cases)
8/12/2019 3b Re Tech Softeng 0203
31/35
61
How to derive a Class diagram(cont.)
Finding the classes: carefully consider the candidate list
Equate synonymous terms
Product and Good Product Eliminate operation names, if possible
E.g. Reorder
Be careful in what you really mean
Is it Product rather than Product Description?
Eliminate individual objects (as opposed to classes)
Reorder Level attribute of Product Description
Eliminate implementation constructs
E.g. software
Replace or eliminate vague terms
system computer
62
How to derive a Class diagram(cont.)
ProductDescProduct
P1P2
PD1PD2
Order
Line Item
TradingCompany
*
1
1
1
1
1
*
*
***
*
1
Customer
1*
1
8/12/2019 3b Re Tech Softeng 0203
32/35
63
Assigning Responsibilities to Classes
At this point, we have derived activity and classdiagrams from performing task analysis and
developing use cases. The next step is to assign responsibilities to
classes.
CRC Cards can be used for this purpose.
64
CRC Card
A CRC (Class-Responsibility-Collaboration) cardis an index card with three elements
Class: element under analysis (a class as usuallyused for object-oriented analysis)
Responsibility: a high level description of the
purpose of the class Collaboration: the classes involved to fulfill a
responsibility
Very simple yet very useful
8/12/2019 3b Re Tech Softeng 0203
33/35
65
CRC Card (cont.)
Class
Responsibility
Collaborators
Check if item in stock
Determine price
Check for valid payment
Dispatch to delivery address
Order OrderLine
Customer
But, how are responsibilities carried out? Who is collaborating
with whom?
66
CRC Card (cont.)
Elaborate the CRC Cards for the system allowingstudents to enroll in exams.
8/12/2019 3b Re Tech Softeng 0203
34/35
67
Prototyping the User Interface
Use rapid prototyping tools (e.g., Visual Basic,Java Beans compliant)
Use cases are the starting point
68
Assessment of Risks
A risk is a possible future negative event that mayaffect the success of an effort.
Examples are
Requirements
Technological
Skills
Political
8/12/2019 3b Re Tech Softeng 0203
35/35
69
RE Techniques Interactions
From a task model (conceptual model, focus onthe user) to use cases (system model, focus on
user using a system). Tasks act on things (e.g., entities, objects)
class diagrams
The relation between actions and objects can bedefined with CRC cards, which can be refined ininteraction diagrams