Se 008
Se 008
SOFTWARE ENGINEERING
FORMAL SPECIFICATIONS
1
FORMAL SPECIFICATIONS
Formal specification techniques enable us to:
oprecisely specify a system
overify that a system is correctly implemented
We say a system is correctly implemented:
owhen it satisfies its specification
A formal technique is a mathematical method
Formal techniques can be used:
oto specify a hardware and/or software system
3
ACCEPTANCE OF FORMAL METHODS
Formal methods have not become mainstream software
development techniques as was once predicted
5
SPECIFICATION IN THE SOFTWARE PROCESS
6
SPECIFICATION AND DESIGN
User System
Architectural Formal High-level
requirements requirements
design specification design
definition specification
Specification
Design
7
SPECIFICATION IN THE SOFTWARE PROCESS
System
Formal
requirements
specification
specification
User High-level
requirements
design
definition
System Architectural
modelling design
8
USE OF FORMAL SPECIFICATION
o Formal specification involves investing more effort in the early phases
of software development.
o This reduces requirements errors as it forces a detailed analysis of the
requirements.
o Incompleteness and inconsistencies can be discovered and resolved.
o Hence, savings as made as the amount of rework due to requirements
problems is reduced.
9
COST PROFILE
The use of formal specification means that the cost profile of a
project changes
o There are greater up front costs as more time and effort are spent
developing the specification;
10
DEVELOPMENT COSTS WITH FORMAL
SPECIFICATION
Cost
Validation
Design and
implementation Validation
Design and
implementation
Specification
Specification
11
SPECIFICATION TECHNIQUES
Algebraic specification
The system is specified in terms of its operations and their relationships.
Model-based specification
The system is specified in terms of a state model that is constructed using
mathematical constructs such as sets and sequences. Operations are defined by
modifications to the system’s state.
Sequential Concurrent
12
SPECIFICATION TECHNIQUES
Algebraic specification
The system is specified in terms of its operations and their relationships.
Model-based specification
The system is specified in terms of a state model that is constructed
using mathematical constructs such as sets and sequences. Operations
are defined by modifications to the system’s state.
13
ALGEBRAIC SPECIFICATION
WRITING SPECIFICATION FOR LIST
LIST ( Elem )
sor t List
impor ts INTEGER
Create List
Cons (List, Elem) List
Head (List) Elem
Length (List) Integer
Tail (List) List
14
ASSIGNEMENT 1
15
ASSIGNMENT 2
16
FIFO ORDER ORDERING PROPERTIES(1)
E11 E1 E1
P1 2 3
M1 M
2
P2
E21 E2
M1 2
P3
E3 E3 E3
1 2 1
If a particular process broadcasts a message M1 before it broadcasts a
message M2 , then each recipient process delivers M1 before M2.
17
Message M1 ( ) shows violation of FIFO order.
Local Order Ordering
Properties(2)
E11 E1 E1
P1 2 3
M1 M
2
P2
E21 E2 E2
M1 2 3
P3
E3 E3 E3
1 3 1
If a process delivers a message M1 before it broadcasts a message M2 ,
then each recipient process delivers M1 before M2.
18
Message M1 ( ) shows violation of global causal ordering.
Causal Order Ordering
Properties(3)
P1
M1 M2 M3 M4
P2
P3
M1 é M2 M2 é M3 M1 é M2 & M2 é M3 G M1 é M319
20