Professional Development Lecture Notes

Download as pdf or txt
Download as pdf or txt
You are on page 1of 235

Professional Software Development 3/M

r2704
Tim Storer
[email protected]
Room 304 SAWB
2011-12
Acknowledgments
These notes are a mixture of my own material on Software Engineering, that
provided by Ray Welland and Phil Gray and material derived (well co-opted)
from the cited sources. The case study is derived from the coursework topic set
for the PSD3 class in 2009-10 and so is also partly inuenced by the solutions
proposed by students in that cohort.
The notes are typeset in L
A
T
E
X, using the beamer package.
1
Diagrams were
produced using MetaPost
2
. The MetaPost module metauml
3
was used to for
the UML diagrams, and the Expressg
4
module was used for ow charts.
1
http://latex-beamer.sourceforge.net/
2
http://www.tex.ac.uk/ctan/graphics/metapost/
3
http://metauml.sourceforge.net/
4
http://www.ctan.org/tex-archive/graphics/metapost/contrib/macros/
expressg
i
ii
Some Administration
This booklet of lecture notes accompanies approximately half of the Professional
Software Development (PSD3/M) courses across the entire year.
The labels that appear in the margin roughly correspond to the title of a
slide used in the lecture course. Like this Some
administration (2)
an electronic version of the notes is available on the PSD3 course webpage
on moodle
5
The electronic version of the handout will be updated as the lecture course
progresses.
if you have questions during the course:
interrupt during the lecture - please feel free to stop the lecture if
you feel there is something I havent explained properly, got wrong
or contradicts something else you have read. Someone else might
be thinking the same thing.
comment on Mahara
6
- I will try and write a blog after each lecture,
repeating any clarications or signicant points, and reecting on
any discussion.
open door policy - this means you can come and see me whenever you
have a question. Generally, I prefer a face to face chat to an email
exchange, because it is easier to work out what the real problem
is, work through examples etc. Also, verbal communication has the
benet of deniability...
team unix le system space available:
/users/psd3<a-m,p,q>
Recommended reading means like fresh green vegetables - it may not taste
very nice, but will benet you in the long run. The notes also reference a small
bibliography and each chapter starts with pointers for further reading. The
5
http://fims.moodle.gla.ac.uk/course/view.php?id=128
6
http://portfolio.gla.ac.uk/view/view.php?id=3107
iii
notes should not be considered as a an adequate replacement for a good text
book on Software Engineering and your own notes from the lectures. In fact,
while were on the subject, the key texts are: Recommended reading
(3)
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, ninth edition, 2010.
Simon Bennett, Steve McRobb, and Ray Farmer. Object Oriented Sys-
tems Analysis and Design Using UML. McGraw Hill, Shoppenhangers
Road, Maidenhead, Berkshire, SL6 2QL, third edition, 2006.
You should make sure that you acquire at least one of these text books
(there are copies of both in the library). Sommerville provides a good preliminary
introduction to many aspects of software engineering. Bennett et al. gives a
comprehensive introduction to analysis, specication and design using the UML.
The lecturers on this course are: The ugly face of
software engineering
(4)
Tim Storer;
Jeremy Singer; and
Posco Tso.
We will also bring in the odd guest lecturer, when we can, and you will have
the opportunity during the course to talk to software development professionals
working in industry today.
The PSD programme shares teaching material between PSD3 and PSDM,
although there are dierent assessments for the dierent cohorts. PSDM is
split into two cohorts, PSDM-CS and PSDM-IT. Material is identical for both
cohorts in Semester 1. In Semester 2, PSDM-CS students follow the same mate-
rial as PSD3, with the exception of the lectures on Formal Methods. PSDM-IT
students follow the material on Object Oriented Software Engineering (OOSE),
with the exception of the lectures on software frameworks. Both cohorts under-
take extra material on user-centered design.
The course consists of: Course schedule
(semester 1) (5)
lectures
11am Mondays, Adam Smith Building 1115
10am Wednesdays, St Andrews Building 213
laboratories
2-4pm (PSD3), Maths 325
2-3pm (PSD-CS, PSD-IT semester 1), Graham Kerr 224
iv
S
e
m
e
s
t
e
r
1
w
e
e
k
M
o
n
1
1
a
m
-
1
2
p
m
M
o
n
2
-
4
p
m
W
e
d
1
0
-
1
1
a
m
d
e
l
i
v
e
r
a
b
l
e
2
2
6
t
h
S
e
p
t
i
n
t
r
o
d
u
c
t
i
o
n
G
E
1
t
h
e
s
o
f
t
w
a
r
e
l
i
f
e
-
c
y
c
l
e
D
1
g
r
o
u
p
o
r
g
a
n
i
s
a
t
i
o
n
(
d
r
a
f
t
)
3
3
r
d
O
c
t
p
l
a
n
n
i
n
g
T
r
a
c
r
i
s
k
m
a
n
a
g
e
m
e
n
t
4
1
0
t
h
O
c
t
r
e
q
u
i
r
e
m
e
n
t
s
1
m
o
d
e
l
l
i
n
g
w
i
t
h
u
s
e
c
a
s
e
s
r
e
q
u
i
r
e
m
e
n
t
s
2
D
2
p
r
o
j
e
c
t
s
c
h
e
d
u
l
e
a
n
d
p
l
a
n
(
d
r
a
f
t
)
5
1
7
t
h
O
c
t
r
e
q
u
i
r
e
m
e
n
t
s
3
c
l
i
e
n
t
i
n
t
e
r
v
i
e
w
s
m
o
d
e
l
l
i
n
g
6
2
4
t
h
O
c
t
m
o
d
e
l
l
i
n
g
U
m
b
r
e
l
l
o
r
e
q
u
i
r
e
m
e
n
t
s
4
7
3
1
s
t
O
c
t
c
h
a
n
g
e
m
a
n
a
g
e
m
e
n
t
S
u
b
v
e
r
s
i
o
n
f
o
r
t
e
a
m
s
s
t
a
k
e
h
o
l
d
e
r
p
a
n
e
l
D
3
r
e
q
u
i
r
e
m
e
n
t
s
s
p
e
c
i

c
a
t
i
o
n
(
d
r
a
f
t
)
8
7
t
h
N
o
v
d
o
c
u
m
e
n
t
a
t
i
o
n
p
r
o
t
o
t
y
p
i
n
g
D
3
f
e
e
d
b
a
c
k
9
1
4
t
h
N
o
v
q
u
a
l
i
t
y
a
s
s
u
r
a
n
c
e
i
n
s
p
e
c
t
i
o
n
s
a
r
c
h
i
t
e
c
t
u
r
a
l
p
a
t
t
e
r
n
s
1
0
2
1
s
t
N
o
v
c
o
m
p
o
n
e
n
t
s
O
S
G
i
a
d
v
a
n
c
e
d
p
r
o
c
e
s
s
m
o
d
e
l
s
1
1
2
8
t
h
N
o
v
X
P
p
r
o
t
o
t
y
p
e
d
e
m
o
n
s
t
r
a
t
i
o
n
s
o
f
t
w
a
r
e
e
n
g
i
n
e
e
r
i
n
g
p
a
n
e
l
D
4
g
r
o
u
p
e
x
e
r
c
i
s
e
1
r
e
p
o
r
t
(

n
a
l
)
S
e
m
e
s
t
e
r
2
w
e
e
k
M
o
n
1
1
a
m
-
1
2
p
m
M
o
n
2
-
4
p
m
T
h
u
1
1
a
m
-
1
2
p
m
d
e
l
i
v
e
r
a
b
l
e
1
7
9
t
h
J
a
n
d
e
s
i
g
n
b
y
c
o
n
t
r
a
c
t
G
E
2
,
c
o
n
s
o
r
t
i
u
m
m
e
e
t
i
n
g
s
c
o
n
s
o
r
t
i
u
m
p
r
e
s
e
n
t
a
t
i
o
n
1
8
1
6
t
h
J
a
n
t
e
s
t
i
n
g
t
e
s
t
i
n
g
s
t
a
t
e
c
h
a
r
t
s
D
5
i
n
d
i
v
i
d
u
a
l
r
e
p
o
r
t
1
1
9
2
3
r
d
J
a
n
s
t
a
t
e
c
h
a
r
t
s
s
t
a
t
e
c
h
a
r
t
s
m
e
t
r
i
c
s
D
6
d
e
s
i
g
n
d
o
c
u
m
e
n
t
a
n
d
t
e
s
t
p
l
a
n
(
d
r
a
f
t
)
2
0
3
0
t
h
J
a
n
m
e
t
r
i
c
s
s
o
f
t
w
a
r
e
c
o
s
t
i
n
g
d
e
s
i
g
n
f
e
e
d
b
a
c
k
2
1
6
t
h
F
e
b
d
e
l
i
v
e
r
y
a
n
d
d
e
p
l
o
y
m
e
n
t
d
e
l
i
v
e
r
y
a
n
d
d
e
p
l
o
y
m
e
n
t
s
o
f
t
w
a
r
e
c
o
m
p
r
e
h
e
n
s
i
o
n
2
2
1
3
t
h
F
e
b
r
e
f
a
c
t
o
r
i
n
g
t
o
o
l
s
f
o
r
c
o
m
p
r
e
h
e
n
s
i
o
n
/
r
e
f
a
c
t
o
r
-
i
n
g
i
n
t
r
o
d
u
c
t
i
o
n
t
o
D
8
.
3
a
n
d
D
8
.
4
D
7
i
m
p
l
e
m
e
n
t
a
t
i
o
n
s
w
a
p
2
3
2
0
t
h
F
e
b
s
o
f
t
w
a
r
e
e
v
o
l
u
t
i
o
n
s
o
f
t
w
a
r
e
e
v
o
l
u
t
i
o
n
2
4
2
7
t
h
F
e
b
a
s
p
e
c
t
o
r
i
e
n
t
e
d
d
e
v
e
l
o
p
m
e
n
t
a
s
p
e
c
t
o
r
i
e
n
t
e
d
d
e
v
e
l
o
p
m
e
n
t
p
r
o
f
e
s
s
i
o
n
a
l
i
s
s
u
e
s
D
8
g
r
o
u
p
e
x
e
r
c
i
s
e
2
(

n
a
l
)
2
5
5
t
h
M
a
r
f
o
r
m
a
l
m
e
t
h
o
d
s
d
e
m
o
n
s
t
r
a
t
i
o
n
f
o
r
m
a
l
m
e
t
h
o
d
s
2
6
1
2
t
h
M
a
r
f
o
r
m
a
l
m
e
t
h
o
d
s
f
o
r
m
a
l
m
e
t
h
o
d
s
s
u
m
m
a
r
y
T
a
b
l
e
1
:
P
S
D
3
t
i
m
e
t
a
b
l
e
S
e
m
e
s
t
e
r
1
w
e
e
k
M
o
n
1
1
a
m
-
1
2
p
m
M
o
n
2
-
3
p
m
W
e
d
1
0
-
1
1
a
m
d
e
l
i
v
e
r
a
b
l
e
2
2
6
t
h
S
e
p
t
i
n
t
r
o
d
u
c
t
i
o
n
G
E
1
t
h
e
s
o
f
t
w
a
r
e
l
i
f
e
-
c
y
c
l
e
D
1
g
r
o
u
p
o
r
g
a
n
i
s
a
t
i
o
n
(
d
r
a
f
t
)
3
3
r
d
O
c
t
p
l
a
n
n
i
n
g
T
r
a
c
r
i
s
k
m
a
n
a
g
e
m
e
n
t
4
1
0
t
h
O
c
t
r
e
q
u
i
r
e
m
e
n
t
s
1
m
o
d
e
l
l
i
n
g
w
i
t
h
u
s
e
c
a
s
e
s
r
e
q
u
i
r
e
m
e
n
t
s
2
D
2
p
r
o
j
e
c
t
s
c
h
e
d
u
l
e
a
n
d
p
l
a
n
(
d
r
a
f
t
)
5
1
7
t
h
O
c
t
r
e
q
u
i
r
e
m
e
n
t
s
3
c
l
i
e
n
t
i
n
t
e
r
v
i
e
w
s
m
o
d
e
l
l
i
n
g
6
2
4
t
h
O
c
t
m
o
d
e
l
l
i
n
g
U
m
b
r
e
l
l
o
r
e
q
u
i
r
e
m
e
n
t
s
4
7
3
1
s
t
O
c
t
c
h
a
n
g
e
m
a
n
a
g
e
m
e
n
t
S
u
b
v
e
r
s
i
o
n
f
o
r
t
e
a
m
s
s
t
a
k
e
h
o
l
d
e
r
p
a
n
e
l
D
3
r
e
q
u
i
r
e
m
e
n
t
s
s
p
e
c
i

c
a
t
i
o
n
(
d
r
a
f
t
)
8
7
t
h
N
o
v
d
o
c
u
m
e
n
t
a
t
i
o
n
p
r
o
t
o
t
y
p
i
n
g
D
3
f
e
e
d
b
a
c
k
9
1
4
t
h
N
o
v
q
u
a
l
i
t
y
a
s
s
u
r
a
n
c
e
i
n
s
p
e
c
t
i
o
n
s
a
r
c
h
i
t
e
c
t
u
r
a
l
p
a
t
t
e
r
n
s
1
0
2
1
s
t
N
o
v
c
o
m
p
o
n
e
n
t
s
O
S
G
i
a
d
v
a
n
c
e
d
p
r
o
c
e
s
s
m
o
d
e
l
s
1
1
2
8
t
h
N
o
v
X
P
p
r
o
t
o
t
y
p
e
d
e
m
o
n
s
t
r
a
t
i
o
n
s
o
f
t
w
a
r
e
e
n
g
i
n
e
e
r
i
n
g
p
a
n
e
l
D
4
g
r
o
u
p
e
x
e
r
c
i
s
e
1
r
e
p
o
r
t
(

n
a
l
)
S
e
m
e
s
t
e
r
2
w
e
e
k
M
o
n
1
1
a
m
-
1
2
p
m
M
o
n
2
-
3
p
m
T
h
u
1
1
a
m
-
1
2
p
m
d
e
l
i
v
e
r
a
b
l
e
1
7
9
t
h
J
a
n
d
e
s
i
g
n
b
y
c
o
n
t
r
a
c
t
G
E
2
,
c
o
n
s
o
r
t
i
u
m
m
e
e
t
i
n
g
s
c
o
n
s
o
r
t
i
u
m
p
r
e
s
e
n
t
a
t
i
o
n
1
8
1
6
t
h
J
a
n
t
e
s
t
i
n
g
t
e
s
t
i
n
g
s
t
a
t
e
c
h
a
r
t
s
1
9
2
3
r
d
J
a
n
s
t
a
t
e
c
h
a
r
t
s
s
t
a
t
e
c
h
a
r
t
s
m
e
t
r
i
c
s
D
6
d
e
s
i
g
n
d
o
c
u
m
e
n
t
a
n
d
t
e
s
t
p
l
a
n
(
d
r
a
f
t
)
2
0
3
0
t
h
J
a
n
m
e
t
r
i
c
s
s
o
f
t
w
a
r
e
c
o
s
t
i
n
g
d
e
s
i
g
n
f
e
e
d
b
a
c
k
2
1
6
t
h
F
e
b
d
e
l
i
v
e
r
y
a
n
d
d
e
p
l
o
y
m
e
n
t
d
e
l
i
v
e
r
y
a
n
d
d
e
p
l
o
y
m
e
n
t
s
o
f
t
w
a
r
e
c
o
m
p
r
e
h
e
n
s
i
o
n
2
2
1
3
t
h
F
e
b
r
e
f
a
c
t
o
r
i
n
g
t
o
o
l
s
f
o
r
c
o
m
p
r
e
h
e
n
s
i
o
n
/
r
e
f
a
c
t
o
r
-
i
n
g
i
n
t
r
o
d
u
c
t
i
o
n
t
o
G
E
2
.
3
a
n
d
2
.
4
D
7
i
m
p
l
e
m
e
n
t
a
t
i
o
n
s
w
a
p
2
3
2
0
t
h
F
e
b
s
o
f
t
w
a
r
e
e
v
o
l
u
t
i
o
n
s
o
f
t
w
a
r
e
e
v
o
l
u
t
i
o
n
2
4
2
7
t
h
F
e
b
a
s
p
e
c
t
o
r
i
e
n
t
e
d
d
e
v
e
l
o
p
m
e
n
t
a
s
p
e
c
t
o
r
i
e
n
t
e
d
d
e
v
e
l
o
p
m
e
n
t
p
r
o
f
e
s
s
i
o
n
a
l
i
s
s
u
e
s
D
8
g
r
o
u
p
e
x
e
r
c
i
s
e
2
(

n
a
l
)
2
5
5
t
h
M
a
r
d
e
m
o
n
s
t
r
a
t
i
o
n
u
s
e
r
c
e
n
t
e
r
e
d
d
e
s
i
g
n
2
6
1
2
t
h
M
a
r
u
s
e
r
c
e
n
t
e
r
e
d
d
e
s
i
g
n
u
s
e
r
-
c
e
n
t
e
r
e
d
d
e
s
i
g
n
s
u
m
m
a
r
y
3
1
1
6
t
h
A
p
r
D
1
0
i
n
d
i
v
i
d
u
a
l
r
e

e
c
t
i
v
e
e
x
e
r
c
i
s
e
T
a
b
l
e
2
:
P
S
D
M
-
C
S
t
i
m
e
t
a
b
l
e
S
e
m
e
s
t
e
r
1
w
e
e
k
l
e
c
t
u
r
e
M
o
n
1
1
a
m
-
1
2
p
m
w
o
r
k
s
h
o
p
M
o
n
2
-
3
p
m
l
e
c
t
u
r
e
W
e
d
1
0
-
1
1
a
m
d
e
l
i
v
e
r
a
b
l
e
2
2
6
t
h
S
e
p
t
i
n
t
r
o
d
u
c
t
i
o
n
G
E
1
t
h
e
s
o
f
t
w
a
r
e
l
i
f
e
-
c
y
c
l
e
D
1
g
r
o
u
p
o
r
g
a
n
i
s
a
t
i
o
n
(
d
r
a
f
t
)
3
3
r
d
O
c
t
p
l
a
n
n
i
n
g
T
r
a
c
r
i
s
k
m
a
n
a
g
e
m
e
n
t
4
1
0
t
h
O
c
t
r
e
q
u
i
r
e
m
e
n
t
s
1
m
o
d
e
l
l
i
n
g
w
i
t
h
u
s
e
c
a
s
e
s
r
e
q
u
i
r
e
m
e
n
t
s
2
D
2
p
r
o
j
e
c
t
s
c
h
e
d
u
l
e
a
n
d
p
l
a
n
(
d
r
a
f
t
)
5
1
7
t
h
O
c
t
r
e
q
u
i
r
e
m
e
n
t
s
3
c
l
i
e
n
t
i
n
t
e
r
v
i
e
w
s
m
o
d
e
l
l
i
n
g
6
2
4
t
h
O
c
t
m
o
d
e
l
l
i
n
g
U
m
b
r
e
l
l
o
r
e
q
u
i
r
e
m
e
n
t
s
4
7
3
1
s
t
O
c
t
c
h
a
n
g
e
m
a
n
a
g
e
m
e
n
t
S
u
b
v
e
r
s
i
o
n
f
o
r
t
e
a
m
s
s
t
a
k
e
h
o
l
d
e
r
p
a
n
e
l
D
3
r
e
q
u
i
r
e
m
e
n
t
s
s
p
e
c
i

c
a
t
i
o
n
(
d
r
a
f
t
)
8
7
t
h
N
o
v
d
o
c
u
m
e
n
t
a
t
i
o
n
p
r
o
t
o
t
y
p
i
n
g
D
3
f
e
e
d
b
a
c
k
9
1
4
t
h
N
o
v
q
u
a
l
i
t
y
a
s
s
u
r
a
n
c
e
i
n
s
p
e
c
t
i
o
n
s
a
r
c
h
i
t
e
c
t
u
r
a
l
p
a
t
t
e
r
n
s
1
0
2
1
s
t
N
o
v
c
o
m
p
o
n
e
n
t
s
O
S
G
i
a
d
v
a
n
c
e
d
p
r
o
c
e
s
s
m
o
d
e
l
s
1
1
2
8
t
h
N
o
v
X
P
p
r
o
t
o
t
y
p
e
d
e
m
o
n
s
t
r
a
t
i
o
n
s
o
f
t
w
a
r
e
e
n
g
i
n
e
e
r
i
n
g
p
a
n
e
l
D
4
g
r
o
u
p
e
x
e
r
c
i
s
e
1
r
e
p
o
r
t
(

n
a
l
)
S
e
m
e
s
t
e
r
2
w
e
e
k
l
e
c
t
u
r
e
T
u
e
1
1
a
m
-
1
2
p
m
l
e
c
t
u
r
e
W
e
d
1
-
2
p
m
e
x
a
m
p
l
e
s
c
l
a
s
s
F
r
i
1
-
2
p
m
d
e
l
i
v
e
r
a
b
l
e
1
7
9
t
h
J
a
n
i
n
t
r
o
d
u
c
t
i
o
n
O
O
C
o
n
c
e
p
t
s
1
8
1
6
t
h
J
a
n
O
O
p
r
o
g
r
a
m
m
i
n
g
s
o
f
t
w
a
r
e
t
e
s
t
i
n
g
1
1
9
2
3
r
d
J
a
n
s
o
f
t
w
a
r
e
t
e
s
t
i
n
g
s
o
f
t
w
a
r
e
t
e
s
t
i
n
g
2
0
3
0
t
h
J
a
n
m
o
d
e
l
l
i
n
g
a
n
d
a
n
a
l
y
s
i
s
w
i
t
h
U
M
L
m
o
d
e
l
l
i
n
g
a
n
d
a
n
a
l
y
s
i
s
w
i
t
h
U
M
L
2
1
6
t
h
F
e
b
m
o
d
e
l
l
i
n
g
a
n
d
a
n
a
l
y
s
i
s
w
i
t
h
U
M
L
m
o
d
e
l
l
i
n
g
a
n
d
a
n
a
l
y
s
i
s
w
i
t
h
U
M
L
2
2
2
1
3
t
h
F
e
b
f
r
a
m
e
w
o
r
k
s
,
r
e
-
u
s
e
a
n
d
s
w
i
n
g
f
r
a
m
e
w
o
r
k
s
,
r
e
-
u
s
e
a
n
d
s
w
i
n
g
2
3
2
0
t
h
F
e
b
d
e
s
i
g
n
p
a
t
t
e
r
n
s
a
n
d
p
r
i
n
c
i
p
l
e
s
d
e
s
i
g
n
p
a
t
t
e
r
n
s
a
n
d
p
r
i
n
c
i
p
l
e
s
2
4
2
7
t
h
F
e
b
d
e
s
i
g
n
p
a
t
t
e
r
n
s
a
n
d
p
r
i
n
c
i
p
l
e
s
d
e
s
i
g
n
p
a
t
t
e
r
n
s
a
n
d
p
r
i
n
c
i
p
l
e
s
3
2
5
5
t
h
M
a
r
d
e
s
i
g
n
p
a
t
t
e
r
n
s
a
n
d
p
r
i
n
c
i
p
l
e
s
d
e
s
i
g
n
p
a
t
t
e
r
n
s
a
n
d
p
r
i
n
c
i
p
l
e
s
u
s
e
r
c
e
n
t
e
r
e
d
d
e
s
i
g
n
(
T
h
u
1
1
a
m
)
2
6
1
2
t
h
M
a
r
u
s
e
r
c
e
n
t
e
r
e
d
d
e
s
i
g
n
(
M
o
n
1
1
a
m
)
u
s
e
r
-
c
e
n
t
e
r
e
d
d
e
s
i
g
n
(
M
o
n
2
-
3
p
m
)
s
u
m
m
a
r
y
3
1
1
6
t
h
A
p
r
D
1
0
i
n
d
i
v
i
d
u
a
l
r
e

e
c
t
i
v
e
e
x
e
r
c
i
s
e
T
a
b
l
e
3
:
P
S
D
M
-
I
T
t
i
m
e
t
a
b
l
e
An approximate timetable for the courses is shown in Tables 1, 2 and 3,
The rst semester focuses on project management and analysis, specication
and design.
The lectures on project management will cover: Project management
topics (6)
software process models;
group organisation;
project planning;
change management;
quality assurance; and
risk analysis and management.
The lectures on requirements analysis, specication and design will cover: Analysis, specication
and design topics (7)
requirements elicitation methods;
requirements specication with use cases;
domain modelling;
design elaboration from specications using behaviour models.
prototyping; and
component oriented engineering.
The second semester is concerned with software design, implementation,
testing, and evolution. There is also an introduction to the use of formal meth-
ods in software engineering.
Regarding assessment, PSD/M runs for two semesters, so is worth twice the
credits of other level 3 modules.
PSD3 is assessed as follows: Assessment PSD3
(8)
by course work (50%), divided into
group exercise 1, focusing on requirements capture, specication,
domain modelling and evaluation,
group exercise 2, focusing on system design, implementation, testing,
evolution and maintenance and
two individual reective journals.
One individual and group coursework assignment must be completed in
each semester.
viii
nal exam, covering (50%):
all lecture material, tutorials and workshops,
all coursework, and
all recommended reading.
PSDM-CS is assessed as follows: Assessment
PSDM-CS (9)
30% course work, in three parts, each worth 10%
group exercise 1, focusing on requirements capture, specication,
domain modelling and evaluation;
group exercise 2, focusing on system design, implementation, testing,
evolution and maintenance only);
an individual reective exercise.
70% nal exam, covering:
all lecture material, tutorials and workshops,
all coursework, and
all recommended reading.
PSDM-IT is assessed as follows: Assessment
PSDM-IT (10)
30% course work, in three parts:
group exercise 1, focusing on requirements capture, specication,
domain modelling and evaluation (10%);
two individual object-oriented software engineering exercises (5%
each);
an individual reective exercise (10%).
70% nal exam, covering:
all lecture material, tutorials and workshops,
all coursework, and
all recommended reading.
The emphasis on coursework and team activities will be the most challenging
part of PSD. We will introduce the practices and skills you will need to address
these challenges during the course. The deliverables schedule for semester 1 is
the same for all cohorts, and is shown in tables 1, 2 and 3.
ix
x
Contents
1 The Software Life Cycle 1
1.1 Why Software Engineering? . . . . . . . . . . . . . . . . . . . . 2
1.2 Software Development Activities . . . . . . . . . . . . . . . . . 11
1.3 Software Development Process Models . . . . . . . . . . . . . . 13
1.4 Object Oriented Software Development . . . . . . . . . . . . . . 13
1.5 Software Projects and Risk . . . . . . . . . . . . . . . . . . . . 19
1.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2 Requirements Engineering 23
2.1 Requirements Risk . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2 The Requirements Process . . . . . . . . . . . . . . . . . . . . 24
2.3 Requirements Elicitation . . . . . . . . . . . . . . . . . . . . . 27
2.3.1 Questionnaires . . . . . . . . . . . . . . . . . . . . . . . 27
2.3.2 Observations . . . . . . . . . . . . . . . . . . . . . . . . 28
2.3.3 Interviews . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.3.4 Walk throughs . . . . . . . . . . . . . . . . . . . . . . . 29
2.4 Documenting Requirements as Use Cases . . . . . . . . . . . . 30
2.5 Requirements Validation and Analysis . . . . . . . . . . . . . . 33
2.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.7 Tutorial - Requirements Capture . . . . . . . . . . . . . . . . . 38
3 Requirements Renement and Planning 39
3.1 Recap - Branch Library . . . . . . . . . . . . . . . . . . . . . . 39
3.2 Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.3 Describing Use Cases . . . . . . . . . . . . . . . . . . . . . . . 44
3.4 Activity Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.5 Advanced Features . . . . . . . . . . . . . . . . . . . . . . . . 50
3.6 Completing Use Case Descriptions . . . . . . . . . . . . . . . . 54
3.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.8 Tutorial Requirements Renement . . . . . . . . . . . . . . . 57
xi
4 Domain Modelling 59
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
4.2 Object Oriented Analysis and Design . . . . . . . . . . . . . . . 59
4.3 Class Responsibility Collaboration . . . . . . . . . . . . . . . . . 63
4.4 CRC Cards to UML Class Diagrams . . . . . . . . . . . . . . . 65
4.4.1 Instance Diagrams . . . . . . . . . . . . . . . . . . . . . 67
4.4.2 Aggregates and Composites . . . . . . . . . . . . . . . . 67
4.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.6 Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
5 Modelling Dynamic Behaviour 71
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5.2 Sequence Diagrams . . . . . . . . . . . . . . . . . . . . . . . . 72
5.3 Communication Diagrams . . . . . . . . . . . . . . . . . . . . . 78
5.4 From Use Cases to Architecture . . . . . . . . . . . . . . . . . 81
5.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.6 Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
6 Prototyping 95
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
6.2 Why prototype? . . . . . . . . . . . . . . . . . . . . . . . . . . 95
6.3 The Prototyping Process . . . . . . . . . . . . . . . . . . . . . 97
6.4 Approaches to Prototyping . . . . . . . . . . . . . . . . . . . . 98
6.4.1 Throw-Away Prototypes . . . . . . . . . . . . . . . . . 98
6.4.2 Evaluating New Technology . . . . . . . . . . . . . . . . 100
6.4.3 Proof of Concept . . . . . . . . . . . . . . . . . . . . . 102
6.4.4 User Interface Prototyping . . . . . . . . . . . . . . . . 103
6.4.5 Rapid Application Development (RAD) . . . . . . . . . 104
6.4.6 Incremental Prototypes . . . . . . . . . . . . . . . . . . 106
6.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
7 Advanced Software Process Models 109
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
7.2 V-Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
7.3 Spiral Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
7.4 Iterative Models . . . . . . . . . . . . . . . . . . . . . . . . . . 116
7.5 More on the Rational Unied Process . . . . . . . . . . . . . . 117
7.6 Agile Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
7.7 Extreme Programming . . . . . . . . . . . . . . . . . . . . . . 122
7.7.1 Planning and Specication . . . . . . . . . . . . . . . . 123
7.7.2 Testing and Coding . . . . . . . . . . . . . . . . . . . . 127
7.8 Prototyping, Design and Architecture . . . . . . . . . . . . . . . 130
7.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
xii
8 Formal Methods in Software Engineering 133
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
8.2 Formal Specication in Software Development . . . . . . . . . . 135
8.3 Using Formal Specications . . . . . . . . . . . . . . . . . . . . 137
8.4 The Object Constraint Language . . . . . . . . . . . . . . . . . 138
8.4.1 Writing Constraints . . . . . . . . . . . . . . . . . . . . 139
8.5 Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
8.6 Constraints on Operations . . . . . . . . . . . . . . . . . . . . . 149
8.7 Model Driven Development . . . . . . . . . . . . . . . . . . . . 151
8.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
8.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
8.10 Workshop: Model Driven Development . . . . . . . . . . . . . . 159
8.10.1 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
8.10.2 Exploring a Project . . . . . . . . . . . . . . . . . . . . 160
8.10.3 Checking Constraints . . . . . . . . . . . . . . . . . . . 163
8.10.4 Modifying the Snapshot . . . . . . . . . . . . . . . . . . 166
8.10.5 Adding More Constraints . . . . . . . . . . . . . . . . . 166
8.10.6 Generating Source Code . . . . . . . . . . . . . . . . . 167
8.10.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . 167
9 Documentation and Technical Writing 169
9.1 General Considerations . . . . . . . . . . . . . . . . . . . . . . 169
9.2 Structuring Documentation . . . . . . . . . . . . . . . . . . . . 170
9.3 Quality Assurance and Documentation . . . . . . . . . . . . . . 174
9.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
10 Project Management 181
10.1 Working in Groups . . . . . . . . . . . . . . . . . . . . . . . . . 181
10.1.1 Types of Team Organisation . . . . . . . . . . . . . . . 181
10.1.2 Deciding on and Documenting Group Organisation . . . 183
10.2 Using Trac for Project Planning . . . . . . . . . . . . . . . . . . 185
10.2.1 Logging into the Trac Server . . . . . . . . . . . . . . . 185
10.2.2 Setting up the Site . . . . . . . . . . . . . . . . . . . . 186
10.2.3 Creating and Viewing Tickets . . . . . . . . . . . . . . . 188
10.2.4 Customising Trac to Fit your Project . . . . . . . . . . . 189
10.2.5 Extending Trac . . . . . . . . . . . . . . . . . . . . . . 191
11 Testing and Assurance of Large Scale, Complex Software Based
Systems 195
11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
11.2 Testing Non-functional Requirements . . . . . . . . . . . . . . . 199
11.2.1 Reliability, Safety and Security Testing . . . . . . . . . . 200
11.2.2 Performance Testing . . . . . . . . . . . . . . . . . . . 203
11.2.3 Threshold Testing . . . . . . . . . . . . . . . . . . . . . 203
xiii
11.3 Managing Testing within Teams . . . . . . . . . . . . . . . . . 204
11.3.1 Developing Acceptance Tests . . . . . . . . . . . . . . . 205
11.3.2 Regression Testing . . . . . . . . . . . . . . . . . . . . 207
11.3.3 Conducting Acceptance Test Demonstrations . . . . . . 208
11.3.4 Evaluating Test Plans . . . . . . . . . . . . . . . . . . . 208
11.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
A Use Case Description Template 213
xiv
List of Figures
1.1 surveyed rates of software project failures, selected studies, adapted
from Emam and Koru [2008] . . . . . . . . . . . . . . . . . . . 3
1.2 (non exclusive) causes of software project failure [Emam and
Koru, 2008] . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 the e-counting system used for the Scottish General Election in
2007 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4 Accenture share price, 6
th
May 2010 . . . . . . . . . . . . . . . 10
1.5 the waterfall software development process model . . . . . . . . 11
1.6 RUP phases . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.7 inception phase of the RUP . . . . . . . . . . . . . . . . . . . . 18
1.8 example problem denition . . . . . . . . . . . . . . . . . . . . 18
1.9 elaboration phase of the RUP . . . . . . . . . . . . . . . . . . . 19
1.10 initial requirements modelling for the branch library . . . . . . . 20
2.1 the requirements engineering process . . . . . . . . . . . . . . . 24
2.2 non functional requirements for the request book use case . . . 25
2.3 example system requirements for the branch library . . . . . . . 25
2.4 requirements and design . . . . . . . . . . . . . . . . . . . . . . 26
2.5 methods for requirements elicitation . . . . . . . . . . . . . . . 27
2.6 dierent approaches to structuring interviews . . . . . . . . . . 29
2.7 a report of an interview with a department administrator . . . . 30
2.8 revised set of actors for the system . . . . . . . . . . . . . . . . 31
2.9 actors and the system boundary . . . . . . . . . . . . . . . . . 31
2.10 a use case diagram for some of the the branch library use cases . 32
2.11 the central library system as an external actor on the branch library 32
2.12 a timed notication use case . . . . . . . . . . . . . . . . . . . 33
2.13 the request book use case extended with non-functional require-
ments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.14 the new cancel book request use case . . . . . . . . . . . . . . 36
2.15 a pre-mature design decision expressed as a use case . . . . . . 36
2.16 museum problem description . . . . . . . . . . . . . . . . . . . 38
3.1 interview with the Head of Department (HoD) . . . . . . . . . . 40
3.2 the use cases related to transferring a book to the branch . . . . 41
xv
3.3 use cases for lending books in the branch . . . . . . . . . . . . 42
3.4 use cases for keeper administration . . . . . . . . . . . . . . . . 42
3.5 non-functional requirements for the branch library system . . . . 43
3.6 all use cases identied for the branch library . . . . . . . . . . . 43
3.7 moscow rules categorisation of the use cases . . . . . . . . . . . 44
3.8 the primary scenario for the request book use case . . . . . . . . 45
3.9 an alternative scenarios for the request book use case . . . . . . 45
3.10 the steps of the primary scenario for the request book use case . 46
3.11 the steps of the request book use case as pseudo code . . . . . 46
3.12 denoting alternatives in pseudo code . . . . . . . . . . . . . . . 47
3.13 denoting repetition in pseudo code . . . . . . . . . . . . . . . . 47
3.14 the request book use case description in pseudo-code . . . . . . 47
3.15 notation for activity diagrams . . . . . . . . . . . . . . . . . . . 48
3.16 the request book for branch use case illustrated as an activity
diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.17 the login use case . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.18 including login in the request use case . . . . . . . . . . . . . . 51
3.19 extending the view status use case . . . . . . . . . . . . . . . . 52
3.20 the lend book use case and actor inheritance . . . . . . . . . . . 53
3.21 revised actors for the branch library system . . . . . . . . . . . . 54
3.22 pre and post conditions for the request book and lend book use
cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.23 the component parts of a use case document . . . . . . . . . . 56
4.1 UML class notation . . . . . . . . . . . . . . . . . . . . . . . . 61
4.2 Object oriented analysis, design and implementation . . . . . . . 62
4.3 identifying entities in the request book for branch use case . . . 63
4.4 branch class CRC card . . . . . . . . . . . . . . . . . . . . . . . 64
4.5 class collaborations . . . . . . . . . . . . . . . . . . . . . . . . 65
4.6 UML class diagram . . . . . . . . . . . . . . . . . . . . . . . . 66
4.7 UML class association multiplicities . . . . . . . . . . . . . . . . 66
4.8 denoting class instances (objects) in UML . . . . . . . . . . . . 67
4.9 User-Request instance diagram . . . . . . . . . . . . . . . . . . 67
4.10 association relationship decorations . . . . . . . . . . . . . . . . 68
4.11 revised UML class diagram . . . . . . . . . . . . . . . . . . . . 69
5.1 taxonomy of dynamic UML diagram types . . . . . . . . . . . . 72
5.2 sequence diagram notation . . . . . . . . . . . . . . . . . . . . 73
5.3 invoking sequences . . . . . . . . . . . . . . . . . . . . . . . . 73
5.4 object construction and deletion . . . . . . . . . . . . . . . . . 74
5.5 self-messaging in sequence diagrams . . . . . . . . . . . . . . . 75
5.6 control structures using guards on sequence diagrams . . . . . . 75
5.7 references to other sequence diagrams . . . . . . . . . . . . . . 76
5.8 asynchronous messaging on sequence diagrams . . . . . . . . . 77
xvi
5.9 timing constraints on sequence diagrams . . . . . . . . . . . . . 78
5.10 communication diagram for the request book use case . . . . . 79
5.11 classes developed from the communication diagram in Figure
5.10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
5.12 moving from use cases to architecture . . . . . . . . . . . . . . 81
5.13 the lend book use case . . . . . . . . . . . . . . . . . . . . . . 82
5.14 initial conceptual class for the lend book use case . . . . . . . . 82
5.15 the initial lend book sequence diagram . . . . . . . . . . . . . . 83
5.16 the selectLoan message . . . . . . . . . . . . . . . . . . . . . . 84
5.17 the login sequence diagram . . . . . . . . . . . . . . . . . . . . 85
5.18 the revised selectLoan message . . . . . . . . . . . . . . . . . . 86
5.19 the revised login sequence diagram . . . . . . . . . . . . . . . . 87
5.20 the selectBook sequence . . . . . . . . . . . . . . . . . . . . . 87
5.21 the revised selectBook sequence . . . . . . . . . . . . . . . . . 88
5.22 the complete lend book sequence diagram . . . . . . . . . . . . 90
5.23 extended communication diagram . . . . . . . . . . . . . . . . . 91
5.24 revised class diagram extended with method names . . . . . . . 92
6.1 overview of the prototyping process . . . . . . . . . . . . . . . . 98
6.2 overview of the throw away prototyping process . . . . . . . . . 99
6.3 using prototypes during testing . . . . . . . . . . . . . . . . . . 101
6.4 prototyping process for evaluating new technology . . . . . . . . 103
6.5 the netbeans GUI designer . . . . . . . . . . . . . . . . . . . . 104
6.6 throw-away vs incremental prototyping . . . . . . . . . . . . . . 107
6.7 longevity of dierent types of prototype . . . . . . . . . . . . . 107
7.1 the waterfall SDP with feedback . . . . . . . . . . . . . . . . . 111
7.2 a close up view of the software evolution activity . . . . . . . . 112
7.3 the V software development model . . . . . . . . . . . . . . . . 113
7.4 the spiral model showing activities . . . . . . . . . . . . . . . . 114
7.5 the phases of a software development organised into a spiral . . 115
7.6 construction phase of the RUP . . . . . . . . . . . . . . . . . . 118
7.7 transition phase of the RUP . . . . . . . . . . . . . . . . . . . . 119
7.8 milestones and releases within the Rational Unied Process model119
7.9 subsequent cycles of the Rational Unied Process model . . . . 120
7.10 overview of the XP process (re-drawn from Wells
3
) . . . . . . . 124
7.11 an example XP user story . . . . . . . . . . . . . . . . . . . . . 124
7.12 an example project velocity . . . . . . . . . . . . . . . . . . . . 126
7.13 test rst development . . . . . . . . . . . . . . . . . . . . . . . 128
7.14 cost of xing defects in XP, (redrawn from Beck and Andres
[2005]) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
8.1 separation of elicitation and specication in the software process 135
8.2 running example coursework management system. . . . . . . . 141
xvii
8.3 placing constraints directly on the class diagram . . . . . . . . . 142
8.4 navigating the class diagram . . . . . . . . . . . . . . . . . . . 144
8.5 model driven development . . . . . . . . . . . . . . . . . . . . . 152
8.6 library system . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
8.7 project proposals . . . . . . . . . . . . . . . . . . . . . . . . . . 155
8.8 voting system . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
8.9 mountain walks system domain model . . . . . . . . . . . . . . 157
8.10 the OCLE application after start up . . . . . . . . . . . . . . . 160
8.11 the OCLE environment after loading the StudentLifeElipse project161
8.12 the StudentLifeElipse class diagram . . . . . . . . . . . . . . . . 162
8.13 the UoStGlasburgh instance model . . . . . . . . . . . . . . . . 164
8.14 the StudentLifeElipse constraints le . . . . . . . . . . . . . . . 165
8.15 an error reported in the UoStGlasburgh model . . . . . . . . . . 166
9.1 sample structures for two types of technical document . . . . . 172
10.1 the front page of Trac . . . . . . . . . . . . . . . . . . . . . . . 187
10.2 adding a milestone to the Trac . . . . . . . . . . . . . . . . . . 190
10.3 conguring Trac with the MoSCoW rules. . . . . . . . . . . . . 191
10.4 embedding a Gantt chart in Trac . . . . . . . . . . . . . . . . . 193
11.1 combinatorial explosion in software testing . . . . . . . . . . . . 196
11.2 documenting acceptance tests . . . . . . . . . . . . . . . . . . 206
11.3 documentation test cases for non-functional requirements . . . . 207
xviii
Chapter 1
The Software Life Cycle
Recommended Reading
Recommended reading
(11)
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, ninth edition, 2010.
Chapter 1 and Section 2.4 (on RUP)
Peter Naur and Brian Randell, editors. Report on a conference sponsored
by the NATO Science Committee, Garmisch, Germany

1968 1968.
Robert L. Glass. Software Runaways: Lessons Learned from Massive
Software Project Failures. Prentice Hall, rst edition, September 1997.
The RISKS digest http://catless.ncl.ac.uk/Risks
Joel on Software. http://www.joelonsoftware.com/
Daily Worse Than Failure. http://www.dailywtf.com
Scott Rosenberg. Dreaming in Code. Crown, 2007.
Naur and Randell [1968] is the report on the rst conference on software
engineering sponsored by NATO in 1968. Many of the problems addressed by
teh conference still be-devil software projects today.
Glass [1997] is a compendium of software project failures dating from the
1970s, 80s and 90s. Much of the technological discussion is now (unsurprisingly)
rather dated. However, the problems faced by the project teams in terms of
project scale and complexity, management of political conict and uncertain
requirements are as applicable today as they were in their own time.
Rosenberg [2007] is a personal account of the Open Source Application
Foundations Chandler
1
personal organiser project. The book describes the
1
http://www.chandlerprxoject.org
1
challenges faced by the project team, including uncertain requirements, changing
software base and external political pressures.
Joel on Software is a very practical blog on software development and soft-
ware project management issues, written by Joel Spolsky. The Daily Worse
Than Failure (DailyWTF) is an informal blog of curious perversions in infor-
mation technology (amusing war stories of software engineering in the small,
medium and large cock-ups) maintained by Alex Papadimoulis. The RISKS di-
gest is a mailing list for reporting and discussing software failures (some of the
supposed failures are a little hysterical).
1.1 Why Software Engineering?
The concept of software engineering was introduced in the Object Oriented
Software Engineering course in level 2. We examined the reasons why software
development in the small is hard, and some of the principles, practices, meth-
ods and tools that can contribute to the production of high quality software.
However, most software projects are a collaborative eort amongst a team of
software engineers, working with a heterogeneous group of customers, managers
and users, all of which will have their own preferences for the functionality of
the software system.
The scale of many software projects projects and the challenges of coordi-
nating work in an already complex discipline makes such software projects even
more prone to failure. Figure 1.1 illustrates a selection of estimates of soft-
ware project failure rates, gathered by Emam and Koru [2008] between 1994
and 2006. Note that despite some decline in reported failures, several recent
estimates put the rate of project failure at above 20%. Emam and Korus
own prediction was that software failures were between ten and fteen percent
between 2005 and 2007. Software failures by
the numbers (12)
Consider the following case study, which illustrate the challenges of large-
scale system development.
The London Ambulance Services Computer Aided System (CAD), was
conceived as a replacement for a largely paper based system, but which would
also substantially alter the working practices of the services sta. The failures
associated with the project are well documented in an ocial inquiry [South
West Thames Regional Health Authority, 1993], as well as by several other
authors [Robinson, 1996, Dalcher, 1999, Finkelstein and Dowell, 1996]. The
following description is largely based on these sources. The context for the
project in 1991 was: LAS CAD overview
(13)
an emergency service with 500 front line emergency sta operating 200
emergency vehicles 40 control room sta;
2
5
10
15
20
25
30
35
40
S
t
a
n
d
i
s
h

G
r
o
u
p
,

1
9
9
4
S
t
a
n
d
i
s
h

G
r
o
u
p
,

1
9
8
6
S
t
a
n
d
i
s
h

G
r
o
u
p
,

1
9
9
8
J
o
n
e
s

(
s
y
s
t
e
m
s

p
r
o
j
e
c
t
s
)
,

1
9
9
8
J
o
n
e
s

(
m
i
l
i
t
a
r
y

p
r
o
j
e
c
t
s
)
,

1
9
9
8
J
o
n
e
s

(
o
t
h
e
r

p
r
o
j
e
c
t
s
)
,

1
9
9
8
S
t
a
n
d
i
s
h

G
r
o
u
p
,

2
0
0
0
S
t
a
n
d
i
s
h

G
r
o
u
p
,

2
0
0
2
C
o
m
p
u
t
e
r

W
e
e
k
l
y
,

2
0
0
3
S
o
n
n
e
k
u
s

a
n
d

L
a
b
u
s
c
h
a
g
n
e
,

2
0
0
3
S
t
a
n
d
i
s
h

G
r
o
u
p
,

2
0
0
4
S
t
a
n
d
i
s
h

G
r
o
u
p
,

2
0
0
6
p
e
r
c
e
n
t
a
g
e

f
a
i
l
u
r
e
Figure 1.1: surveyed rates of software project failures, selected studies, adapted
from Emam and Koru [2008]
between 2000 and 2500 calls to the emergency service every day, result-
ing in 1400 emergency journeys (the LAS also provides non-emergency
transport for patients);
a largely mannual system for managing and allocating service resources
to emergencies, that was widely perceived as under strain;
a previous attempt at computerisation that had been abandoned due to
project budget and schedule over-runs;
an atmosphere of mistrust between ambulance crews, dispatch centre sta
and management, following an acrimonious pay dispute and a major re-
organization; and
a political and management desire to meet standards for response times
without major additional investment. Indeed, the LAS budget was reduced
during the project.
The project to deliver the system, supplied by a consortium of Apricot Sys-
tems, Mitsubishi, Datatrak and System Options, was divided into three phases.
The rst two phases were concerned with improving the call taking and resource
allocation activities. During the nal phase, the allocation system would be fully
automated, making the role of resource allocation redundant.
The project had experienced on-going problems during phase one and two.
However, the new system suered serious overload following a deployment on
3
the 26
th
October, 1992, during the nal phase three launch. Evidence of severe
problems with the system throughout the project include: LAS CAD
annecdotes of the
failures (14)
management ignored early warnings of problems, such as from experts on
safety critical systems;
calls to the service took 11 hours to receive a response;
new calls to the system sometimes wiped old calls before they had been
dealt with;
vehicle location information was inaccurate and sometimes the nearest
vehicle to an emergency could not be identied;
the vehicle location system failed to identify every 53
rd
vehicle;
sometimes, two ambulances would be sent to the same emergency;
several sources allege that approximately 30 people died as a consequence
of the new system (these gures are disputed and dicult to verify);
the service received 900 complaints in the days following initial deploy-
ment;
the chief executive of the LAS resigned on the 28
th
of October (two days
after the phase three go live). The chairman of the LAS resigned ve
months later;
Systems Options lost their contracts with other customers;
the new system was abandoned at a cost of 43 million (an initial cost
estimate was 1.5 million); and
the introduction of successful computerisation in the LAS was delayed by
a further four years, contributing to a number of unnecessary deaths under
the manual system.
A complete system failure on the 4
th
of November, resulting in a reversion
to the full manual system. The proximate cause of the system failure was a
memory leak. A memory leak occurs when memory that has been allocated to
temporarily to a process is not subsequently released, meaning that the amount
of free memory available for use gradually declines until the system is un-usable.
However, the causes of the project failure were much more widespread than this.
Typically, we can classify the causes of software project failure as: Causes of software
project failure (15)
1. building a system for the wrong reason;
2. building the wrong system; and
4
3. building the system wrong.
The ocial inquiry into the LAS CAD project identied numerous causes of
the system failure. The documented causes of failure can be categorised using
the scheme described above. The LAS disaster
causes (16) The system was built for the wrong reasons, because there was:
a political imperative to make budget savings across the service, creating
a preference for the lowest tender;
pressure to complete the system within a (eventually extended) timeframe
of less than a year: the original specication, completed in February 1991
required complete system implementation by January 1992; and
a desire to automate the decision of which ambulances to allocate to
which emergencies, which had previously been taken by emergency medical
dispatchers.
The wrong system was built because there was:
little consultation with prospective system users (emergency or control
room) about the nature of their work;
a gross under-estimation of the costs of the software development part
of the project;
a dependence on perfect information and communication channels, caus-
ing a build of error reports;
The system was built wrongly because:
there was inadequate training of sta for the new system, creating an
environment of hostility and suspicion;
parts of the system was developed using Visual Basic, a (then) un-proven
programming language;
code changes were made on-the-y in response to user requests and in
many cases undocumented;
test coverage (particularly of throughput) was limited due to the con-
strained nature of the project plan;
deployment was disorganized and haphazard; and
proscribed standards were allowed to slip (again, due to the constrained
project time frame).
5
5
10
15
20
25
30
35
i
n
s
u

c
i
e
n
t

p
o
l
i
t
i
c
a
l

s
u
p
p
o
r
t
r
e
q
u
i
r
e
m
e
n
t
s
/
s
c
o
p
e

c
h
a
n
g
e
s
l
a
c
k

o
f

m
a
n
a
g
e
m
e
n
t

s
k
i
l
l
s
o
v
e
r

b
u
d
g
e
t
l
a
c
k

o
f

t
e
c
h
n
i
c
a
l

s
k
i
l
l
s
s
y
s
t
e
m

o
b
s
o
l
e
s
e
n
c
e
o
v
e
r

s
c
h
e
d
u
l
e
i
m
m
a
t
u
r
e

t
e
c
h
n
l
o
g
y
i
n
s
u

c
e
n
t

s
t
a

s
o
f
t
w
a
r
e

q
u
a
l
i
t
y
i
n
s
u

c
i
e
n
t

u
s
e
r

e
n
g
a
g
e
m
e
n
t
p
e
r
c
e
n
t
a
g
e

f
a
i
l
u
r
e
Figure 1.2: (non exclusive) causes of software project failure [Emam and Koru,
2008]
The causes of project failure should usually be addressed in the order listed:
if you are building a system for the wrong reason, there is little point trying
to ensure the system meets those reasons (i.e. trying to get the requirements
right); if you are building the wrong system, then trying to ensure the system
meets (incorrect) requirements is not much use.
More generally, Emam and Koru have surveyed the causes of project can-
cellation, as shown in Figure 1.2. The causes are not exclusive, so a project
cancellation could be attributed to more than one cause. Causes of software
project cancellation
(17)
Of particular interest is that the two biggest causes of project cancellation
can be categorised as building the system for the wrong reason (insucient man-
agement support) and building the wrong system (requirements/scope changes).
An easy question to ask, but often dicult to answer is: who is to blame
for a project failure? In the case of LAS CAD, the consortium that provided
the system was overly optimistic about their ability to deliver. Consortiums are
almost always dicult organisational structures to manage, such that they have
clear purpose and direction.
2
However, the LAS managers who specied the project imposed impossible
constraints on the delivery of the system, which made delivery within the ex-
pected timescale and budget allowed highly unlikely. The design of the tendering
process meant that the cheapest bidder (regardless of their capacity to deliver)
would be awarded the contract. Consequently It was seems unlikely that the
2
Ask any academic about collaborative research projects.
6
LAS managers ever questioned why the lowest bid was dramatically cheaper
than any other.
A political scientist might, of course, note the pressures that the LAS man-
agement were under in the immediate short term to simultaneously improve
performance and cut bugdets was highly detrimental to the chances of project
success. Had the project proceeded in a more relaxed atmosphere, then per-
haps more realistic decisions might have been made. Consequently, it could be
argued, the project was doomed to failure by high level decisions far removed
from the management of the project of itself.
And yet, this would seem to allow any of the software and system devel-
opment professionals involved to abdicate any responsibility for the projects
consequences by referring complaints to higher powers. Consider the British
Computer Societys code of conduct
3
: The British Computer
Society code of
conduct (18)
You shall:
1. (a) have regard for the public health, safety and environ-
ment...
2. (a) only oer to do work or provide a service that is within
your professional competence.
(b) not claim any level of competence that you do not pos-
sess...
Clearly, the code of conduct implies that IT professionals hold responsibility
for the consequences of projects they work on. Bear in mind that although you
are not legally bound by the code of conduct, you may face disciplinary action
as a member of the BCS and you might be legally and or criminally liable for
your actions if you dis-regard it.
Software engineering as a discipline in its own right was proposed because
of the perceived failure of software development projects during the 1950s and
1960s. The challenges of producing software of sucient quality to meet the
project objectives, within the anticipated schedule and budget were considered
so severe that commentators referred to the problem as the software crisis.
Numerous denitions of the discipline have been proposed, for example: Dening software
engineering (19)
the principles, methods, techniques and tools for the specica-
tion, development, management and evolution of software systems
[Sommerville, 2010]
The application of a systematic, disciplined, quantiable ap-
proach to the development, operation, and maintenance of software;
that is, the application of engineering to software
3
http://www.bcs.org/upload/pdf/conduct.pdf
7
Figure 1.3: the e-counting system used for the Scottish General Election in 2007
[Bourque and Dupuis, 2005]
the process of solving customers problems by the systematic de-
velopment of large, high-quality software systems within cost, time
and other constraints
[Lethbridge and Lagani`ere, 2005]
In summary, software engineering is concerned with the production of soft-
ware of sucient quality which meets the real needs of the customer. This is
achieved through the methodical application of computing science (and other
scientic disciplines) to the practice of software development.
Software engineering has made considerable progress over the previous half-
century in reducing the problems associated with developing large scale software
systems. Emam and Koru [2008], for example, as we have already seen, found
a general decline in software project failures since 1994. Despite this, its still
fairly easy to draw on examples of software project failures in the 21
st
Century.
Consider the following two recent case studies.
Scottish Elections e-Count System, May 2007 Figure 1.3 illustrates the e-
counting system used by the Scottish Executive for the Scottish General Election
in 2007 Lock et al. [2008]. The system was used to electronically count the paper
ballots marked by voters. Despite successful acceptance test (demonstrating
that the system met the customers requirements), the system suered extensive
problems on the night of the election count, including: Scottish Elections,
2007 (20)
loss of voting privacy for voters due to the requirement that ballot papers
be placed into a ballot box unfolded;
slower ballot processing than expected due to repeated paper jams in the
scanners;
8
a higher rate of rejected or unscanned ballots (approximately 140,000
ballot papers were rejected across Scotland; and
the inability of monitoring systems to display count progress to election
monitors. This was symptomatic of a problem later in the night, when
election ocials were unable to obtain the raw vote data from the system
database in order to produce a nal result.
The problems experienced, caused a loss of trust in the results that were
nally produced, because the system had not satised the implicit requirement
to be transparent, as well as accurate and ecient. The ocial inquiry into the
failure Gould [2007] of the system concluded (among other problems) that:
management of the project had been confused and split between the Scot-
tish Executive, the local authority Returning Ocers (chief election o-
cials), the Scottish Oce and the vendor;
the timetable for the project had been compressed due to uncertainty over
legislation. Legislation permitting the use of e-counting was not passed
until very close to the election; and
testing of the system was limited and not realistic.
In summary, the scale of the project was beyond the capabilities of the
consortium formed to manage it. The resources available (both budgetary and
schedule) were insucient to deliver a system of sucient quality, resulting in
severe problems on election night.
The New York Stock Exchange Flash Crash, 6
th
May, 2010 occurred
during a short period of time in the late afternoon and is described in an ocial
report released later in the year [U.S. CFTC/SEC, 2010]. During a matter
of minutes, the quoted value of securities on the exchange began to uctuate
dramatically, with some trades occuring at extreme dollar values (as low as a
penny, or as high as $100,0000). Several indices dropped by nearly 6% in a
matter of minutes, before re-bounding. In an extremely short time $800 billion
dollars of value dissappeared from the market before re-appearing. This volatility
is illustrated by the dramatic decline and then recovery of the Accenture share
price, as shown in Figure 1.4. New York Stock
Exchange Flash
Crash, May 2010 (21)
The ocial report into the events, suggested that the proximate cause of the
crash to a large trader who initiated an automated sell program for approximately
$ 4.1 billion of contracts [U.S. CFTC/SEC, 2010]. The program was congured
to sell the contracts when the volume of activity in the market was high, one
indicator that there are ready buyers for the contracts. Unfortunately, the large
number of sells on oer caused sharp declines in the number of traders willing
to buy. Consequently, this caused a large number of sells to be initiated as price
9
Figure 1.4: decline and recovery in Accenture share price value 2.40pm - 2.55pm,
6
th
May, 2010. Extracted from U.S. CFTC/SEC [2010].
values declined. This triggered more sells by the automated program as volume
increased, because the program did not monitor prices as well as volume. Only
a short pause in trading by several of the larger traders eventually allowed the
exchange to recover; however, the situation could have been much worse. This
explanation has been contested by several other sources commenting on the
events.
All three case studies presented in this chapter can be characterised as large,
complex systems. Such systems (in any discipline) are prone to failures, char-
acterised by budget or deadline over-runs, negative political or social impact,
reduction in functionality, project cancellation or outright system collapse. Soft-
ware projects are often compared to large, complex and unique projects in civil
engineering, which are similarly prone to failure (think of the Tay bridge disaster,
for example).
However, such failures are often followed by successful development projects
once the lessons from the initial attempts have been learnt.In the LAS case, a
CAD system was eventually successfully implemented by the end of the decade;
and substantial revisions have been made to the e-counting system used for
Scottish Elections in preparation for 2012.
Comparing the ash crash software failure with the e-counting and LAS CAD
systems reveals quite dierent characteristics. This scale of system, (sometimes
dubbed systems of systems) where behaviour is manifested by the interactions
between numerous independently managed software programs is an increasing
facet of software engineering. Their domains of control extend across numerous
organisations and legal jurisdictions and are are near on impossible for any one
developer, or even a development team to fully understand or manage. Such
10
problem denition
requirements
analysis &
specication
design
implementation
verication &
validation
delivery &
operation
evolution &
maintenance
problem statement
specication document
system design document
deployable software product
acceptance test report
deployed or distributed product
Figure 1.5: the waterfall software development process model
systems become extremely long lived, and consequently are never developed or
de-commissioned in their entirety. Rather, the overall system evolves gradually
as sub-systems and components are added and replaced. Software development
as infrastructure
maintenance and
evolution (22)
Failures in such systems are likely to be quite dierent from those in tradi-
tional development projects, as the Flash Crash illustrates. In addition, soft-
ware development processes will need to reect the inter-connection of systems-
of-systems. Much greater emphasis will need to be placed on software devel-
opment as a maintenance and evolution activity, rather than as a development
model.
The purpose of this course is to introduced you to some of the risks of large
scale, collaborative software development, and some of the methods, techniques
and tools that have been developed to address them. During the course, you
will have the opportunity to practice software development on a software team
project. The techniques introduced do not necessarily address the challenges
of ultra-large scale, or system-of-systems development. The Flash Crash case
study was introduced to illustrate the limits of our current understanding of the
capability of software engineering.
1.2 Software Development Activities
Software is often said to have a life cycle, in which a number of basic activities
recur. Figure 1.5 illustrates the basic phases common to many software engi-
neering process models (in dierent guises and with dierent emphasis). The
gure also shows the key outputs from each of the phases: Software development
activities (23)
Establishing a problem denition initiates a period of software develop-
11
ment by providing a high level outline of the problem to be addressed.
output: an initial problem statement
During the requirements analysis and specication phase the initial prob-
lem statement is rened and extended. The scope of the project is estab-
lished. Two questions in particular must be answered during this phase:
1. what is the problem to be solved? concerns what is inadequate
about the world that the development project should put right. In
addition, it is necessary to establish the conditions under which the
project can be considered successful, and the metrics used to gauge
this. Note that the outcome from this activity may be a decision to
not build a software system at all.
2. what is needed to solve the problem? identies what should be
developed to solve the identied problem, such as the functional
capabilities of a system and its non-functional characteristics.
outputs: a requirements specication document detailing what the sys-
tem to be built is to do and a test plan containing acceptance test cases
for the proposed system.
The design of a system describes how the what the system should do
from the requirements specication is to be achieved.
output: a system design document containing an architectural description
of the system components and their relationships; and a description of how
the components interact with each other (dynamic behaviour).
During implementation the proposed software system is written, typically
in a high level programming language. The product must also be pre-
pared for testing and delivery at this time. In addition, any accompanying
documentation such as user manuals must also be produced.
output: a deployable software product
The verication and validation phase is concerned with ensuring that the
developed system satises the customers requirements. Verication is
concerned with whether the software product is being built correctly, typ-
ically whether it satises its documented requirements. Validation con-
siders the fundamental question of whether the software satises the cus-
tomers real needs, irrespective or documented requirements.
output: an acceptance test report, describing the extent to which the
software product meets the customers requirements
During delivery the software product is handed over to the customer.
Depending on the type of project, this may be a bespoke deployment, or
the preparation of the product for distribution to a large customer base.
12
output: a deployed or distributed product
The operation and evolution of the deployed system represents the period
of time when the customers users interact with the system. As a result,
the customer may identify defects in the new system or potential new
features. As a consequence, the system must be further developed to
meet the customers needs.
output: further versions of the system
The activities in the model are organised into a waterfall Benington [1983];
the outputs from higher activities ow downwards into the next activity until
the system is deployed. We will begin this course by examining the early stage
activities, concerning requirements elicitation.
1.3 Software Development Process Models
Software development process models are frameworks for organising the phases
and activities that occur during a software project life cycle. Dierent process
models have been proposed that have advantages and disadvantages for dierent
types of project. Process models prescribe when and how activities should occur,
and often incorporates particular software practices and standards. There are a
number of dierent types of process model:
linear (waterfall, which we have reviewed above);
iterative (multiple releases); or
congurable or adaptive.
All process models are approximations of the reality in a real project, as
accommodations are made for particular needs or events. We will use a linear
model in PSD3 (actually, a single evolution of an iterative software process) to
manage the coursework eort.
1.4 Object Oriented Software Development
Object oriented modelling developed in the 1980s as three separate methods:
Object-Oriented Design Booch [1982], Object Modelling Technique Beck and
Cunningham [1989] and the Objectory Method Kruchten [1997]. The Unied
Modelling Language (UML) is a graphical notation for expressing aspects of a
software development project. The language resulted from their combination
during the 1990s. Table 1.1 lists a sub-set of UML diagram types that will be
used during the course. The table categorizes the diagram types in two ways: The Unied Modelling
Language (UML) (24)
13
type a
n
a
l
y
s
i
s
d
e
s
i
g
n
s
t
r
u
c
t
u
r
e
b
e
h
a
v
i
o
u
r
use case
activity
class
communication
sequence
state chart
package
component
deployment
Table 1.1: a subset of UML diagram types
a diagram type can be used to show the structure of a software arti-
fact, illustrating the components and relationships between them; or the
dynamic behaviour a system during execution.
a diagram type is suitable for either analysis (understanding the world as
it is) or construction (proposing a new software artifact), or both.
There are numerous implementations of the UML in Computer Aided Soft-
ware Engineering (CASE) tools, such as Borland Eclipse
4
, Umbrello
5
, MetaUML
6
and Microsoft Visio
7
, to name just a few. Many of these tools integrate directly
with object oriented programming languages, such as Java and C++.
The UML notation is managed as an Object Management Group (OMG)
8
open standard. This has the advantage of establishing a common understanding
of concepts from dierent perspectives of a project (requirements analyst, cus-
tomer, software architect, developer and so on). Despite this, the UML notation
is not a software development process in itself, but can be used to document
the outputs from the activities of a process.
The Rational Unied Process (RUP) is a software development process
model established by the Rational Corporation RC. The process is iterative,
beginning with the establishment of a business case and with an emphasis on
relating the software development process to business concerns. RUP explicitly
incorporates object oriented concepts and utilises the UML notation throughout
the life cycle.
4
http://www.eclipse.org
5
http://uml.sourceforge.net
6
http://metauml.sourceforge.net
7
http://office.microsoft.com/en-us/visio
8
http://www.omg.org
14
inception
elaboration
construction transition
business case
requirements model
initial system
accepted system
Figure 1.6: RUP phases
The RUP is characterised by the three Ps, phases, processes and practices.
The four phases of a RUP iteration are shown in (Figure 1.6). Each phase is
discrete, work is completed in one before progressing through a milestone to the
next. If a project milestone for nishing a phase is not reached, more work is
done in that phase before continuing. RUP phases (25)
Conversely, RUP processes (Table 1.2), or work ows, describes activities
conducted within an iteration that will occur in one or more phases (with varying
amounts of eort). For example, implementation will begin during the elabora-
tion phase, as early prototyped are developed, will pre-dominate in the construc-
tion phase as the main product is built and will continue during the transition
phase as testing un-covers defects. Core engineering processes are concerned
with the development of the software product itself. Supporting processes are
concerned with the surrounding project management, tracking progress towards
goals and facilitating the project team in their work. RUP processes (26)
The RUP also advocates practices (Table 1.3) to be adopted by software
developers. These are not specic to any phase, but should be conducted
through-out a projects life-time. RUP practices (27)
Notice the emphasis on tool or automation support for the software process
throughout RUP, with an emphasis on tool supported modelling, development
and project management. Tools include compilers, model and source code edi-
tors, test suites, conguration management services and issue tracking systems.
Figure 1.7 illustrates the inputs and outputs to the inception phase of the
RUP. The main input to the phase is an preliminary problem description, to-
gether with an initial budget and intended scope. The purpose of the inception
phase is to establish a business case for the proposed project, estimating the
costs and duration against the potential benet. These may lead to alterations
in the project budget and duration as expressed in the business case. An accept-
able business case for a project will obviously need to demonstrate a reasonable
15
16
e
n
g
i
n
e
e
r
i
n
g
business
modelling
understanding how the development project will
aect the organisation. In particular, business
workow models are developed as a common
interface between software and business
engineers
requirements eliciting, gathering, rening of the system
specication describing what the system will do
analysis &
design
development of a design model describing how
the proposed system will satisfy the specication
implementation construction and unit testing of software
components, organised into sub-systems
testing verication of the completed system against the
specication document and the identication
and removal of systemic defects
deployment preparing and packaging the software release, or
installing the software and migrating the
organisation and users to the new version
s
u
p
p
o
r
t
i
n
g
conguration
&
management
on-going management of the integration of new
and modied artefacts into the product
project
management
tracking progress towards objectives and
managing risks
tool provision provision, conguration and maintenance of the
Software Development Environment (SDE) and
Computer Aided Software Engineering (CASE)
tool set
Table 1.2: RUP work ows
17
develop software
iteratively
small changes to large software systems often
reduce the amount of uncertainty
manage
requirements
the system requirements will evolve during the
project, so it is important to track these changes
and their consequences for the development plan
use component
based
architectures
encapsulating software in components encourages
software re-use and design for re-usability, reducing
development costs for new projects
visually model
software
visual models ease comprehension of large scale
software projects. Employing a structured
notation, such as the UML, helps to ensure
consistency between dierent models
verify software
quality
high quality software is more likely to be defect free
control changes
to software
as software evolves with new features, defects may
be introduced, removed and re-introduced.
Implementing a process for changes to a source
code base helps to limit these problems
Table 1.3: RUP practices
inception
early problem denition
scope
available budget
business case
Figure 1.7: inception phase of the RUP
benet over cost within a realistic time-scale! The estimates for the business
case are parameterised by the available budget for the project and anticipated
scope. Inception phase (28)
Example problem
denition (29)
Figure 1.8 illustrates an example problem denition input to the inception
phase of a RUP project. The description is relatively short, and could lead
to considerable uncertainty concerning the scope and duration of the project.
The purpose of the inception phase is to resolve some of these issues in order
to establish a sound business case. The requirements for the project will be
established and rened during the elaboration phase. Elaboration (30)
Once the business case has been prepared, it is necessary to elaborate a com-
prehensive understanding of the problem domain and establish the requirements
for the system as a complete specication. Figure 1.9 illustrates the outputs
from the elaboration phase:
a domain model illustrating the key concepts in the problem domain and
the relationships between them;
a set of use cases, describing the available system interactions a user can
perform;
a description of the non-functional requirements of the system. Non-
functional requirements refer to the emergent, measurable properties of
the end system, such as performance, throughput and reliability;
a development plan, including a schedule or work, project milestones and
an estimated delivery date; and
Managing a branch library
A university is considering the introduction of a branch library system in its
departments to support sta and students in their work. A computer
based system is needed for managing the movement of books from the
central library and within the branch. Each branch will receive a collection
of books from the main library, typically as a result of a request from a
member of sta. These will then be available to loan out to members of
sta and students.
Figure 1.8: example problem denition
18
elaboration
business case
domain model
use cases
non-functional requirements
project schedule
risk management plan
Figure 1.9: elaboration phase of the RUP
a risk management plan addressing the risks to the project, their conse-
quential impact on the projects success and any strategies to be adopted
to mitigate them.
Use cases are descriptions of interactions between a user and the system in
order to achieve some purpose. I stress the middle part of the last sentence,
because there is a tendency for those new to use cases to attempt to use them
to describe activities around the system, which is not their purpose.
Figure 1.10(a) illustrates some initial use cases that can be gathered from
the problem denition in Figure 1.8.
A system will typically have a large number of small use cases. It may
prove useful to rene complex use cases into several smaller (related ones). The
relationships between use cases and system users (organised into roles) dene
the systems scope. Figure 1.10(b) identies some initial actors for the system.
A domain model is a high level representation of the system (data and op-
erations) and its context (environment). The model identies the key elements
which are of interest in the domain and represent them as classes. Domain
models provide functionality to realise the use cases. Figure 1.10(c) illustrates
some initial classes in the domain identied from the problem denition. Initial modelling - use
cases, actors and the
domain (31)
The elaboration phase is iterative - the set of use cases will need to be
rened and extended as more is learnt about the problem domain. More use
cases may also transpire during the construction and transition phases.
1.5 Software Projects and Risk
Dening project risk
(32)
All software development projects are subject to risks, potential future events
which may adversely aect the success of the project. This is often expressed
mathematically for adverse event e:
risk(e) probability(e) impact(e)
but pay attention to the use of approximation, rather than equals, partic-
ularly when dealing with risks categorised as having catastrophic impact for a
project.
19
Request book
for branch
check book out check book in
(a) use cases
Staff Student
(b) actors
Book Loan Branch
(c) domain elements
Figure 1.10: initial requirements modelling for the branch library
Risk planning is concerned with identifying, mitigating and managing per-
ceived project risks. Table 1.4 lists some categories of risks that need to be
considered by a software project team. Risk categories (33)
Perhaps the most common form of project failure is to build the wrong
system (requirements risk). This may be for several reasons:
a lack of understanding of the business or social context of the system by
the engineers;
uncertainty on behalf of the customer as to what the system should do
cultural dierences between engineers and customers;
ambiguous or vague requirements specications, for examplethe system
needs to have features to support members of sta in processing applica-
tions;
ambiguities over domain items. A member of sta in a university, for
example, may mean academic sta, ancillary sta, post-graduates (who
often support teaching, or any combination of the above.
From the engineers perspective, the risk is that we do not know what the
customer really wants. The solution that we will use on this course involves: Managing
requirements risk (34)
methods for eliciting the real requirements from the customer;
a semi-formal notation for describing what the system should do (use
case diagrams) in a way that is understandable to both system engineers,
customers and users;
20
political can be either in external to
the project (in the big) or
internal (in the small)
re-organisation of the
business, conict
between software
development teams
technical new technologies represent an
unknown for a project team
re-implementation of
a desktop package to
a web-based online
application
skills there is often a tension within
an organisation between
training sta and ensuring
that a project gets completed
developers wish to
acquire experience in
using AJAX for
interactive web
applications
requirements mis-understanding of or lack
of clear requirements for the
system is a common cause of
software project failure
the customer wants an
online, but not
necessarily web-based
application
Table 1.4: types of project risk
a process for tracking, managing, updating and validating use cases and
other requirements ; and
a means of investigating poorly understood requirements (prototyping)
with the customer
We will begin to look at gathering and documenting requirements using use
cases in Chapter 2.
1.6 Summary
Software engineering is concerned with methods, tools and practices for reducing
uncertainty (particularly requirements risk) in the software development process.
Software process models are used to structure the development process, so that
developers know what to do next. The UML and RUP are a object oriented
modelling language and development model, respectively.
21
22
Chapter 2
Requirements Engineering
The problem of requirements risk was introduced in Chapter 1. In this Chapter,
we will introduce the process of managing and gathering the requirements for a
software system.
Recommended Reading
Recommended reading
(35)
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, ninth edition, 2010.
Chapter 4
2.1 Requirements Risk
Recall the problem denition for the branch library system in Figure 1.8. Table
2.1 identies some initial risks associated with the branch library system. Branch library risks
(36)
political the university may cancel the entire branch system
product, there may not be resources in departments to
host branches
technical the programming interface to the central library system
is poorly understood and may not be compatible with
the branch system platform
skills the software development team do not have any
experience of web application programming
requirements dierent departments may want dierent models of a
branch system, it is unclear how lending policy will be
implemented
Table 2.1: risks to the branch library system
23
business
case
domain
model
use cases
requirements
document
elicitation specication validation
Figure 2.1: the requirements engineering process
The political risks that have been identied may mean that the projects
scope will need to be reduced, or the project be cancelled altogether. Notice
also that the technical risks aecting the project are indicative of a browneld
(see Chapter 7) development - the project team will need to integrate the branch
library system with some existing artifacts - library management system used by
the library. However, the requirements risks are the most pressing at the start of
the project, since it isnt clear what form of branch library system the university,
individual departments or the central library want.
Methods to address requirements risk were introduced in Section 1.5. Lets
now look at applying these methods to the branch library system project.
2.2 The Requirements Process
Figure 2.1 illustrates the general process for eliciting and documenting software
requirements. The input to the process the initial business case and problem
denition. More detailed requirements are then elicited from the customer and
users using methods such as observations, interviews and prototypes. One out-
put from requirements elicitation is a description of the environment in which
the problem exists, called a domain model. The domain model explains the var-
ious artifacts found in the problem environment and the relationship between
them. We will return to domain modelling in Chapter 4. The requirements
engineering process
(37)
The other output from the elicitation phase is the collection of raw user
requirements for the system, describing what the user needs to be able to do with
the system. These requirements must be documented, organised and rened,
24
F6.3.1 request books from central library
A user shall be able to use the system to request that a book be
transferred from the central library to the branch
Figure 2.2: non functional requirements for the request book use case
SR6.3.1.1
A member of the department (user) shall be able to log in to their account
with the branch library.
SR6.3.1.2
A user shall be able to search for books in the central library from the
branch library system
SR6.3.1.2
A user shall be able to select a book to be requested to be transferred to
the branch library
Figure 2.3: example system requirements for the branch library
producing a collection of use cases.
Often, the most natural way to organise requirements is by grouping re-
lated functions together. Figure 2.2 documents a functional requirement for the
branch library system User requirements
(38) User requirements, expressed as use cases, should be comprehensible to
users. However, they are often too high level to be directly implemented by
software engineers. System requirements are more detailed descriptions of what
a user requirement, suitable for translation into a system design. Figure 2.3
documents several system requirements for the user requirement documented
in Figure 2.2. Note that there is usually a one-many relationship between user
and system requirements. From requirements to
design (39) Finally, the domain model and use cases are combined into a requirements
document that must be validated. Requirements validation is the process of
obtaining agreement with the customer that the right system is being built.
When the system is veried with respect to the requirements document, it
should be possible to determine from the systems design whether functional
requirements have been satised (assuming the implementation is faithful to
the design). However, non-functional requirements usually have to be measured
from the real system as it is deployed.
Notice that the requirements engineering process depicted in Figure 2.1 is it-
erative. Outcomes from the validation phase lead to changes in the requirements
documentation. The identication of omissions in the documentation may re-
quire further elicitation activities. In addition, the requirements themselves will
evolve as the project progresses because: Requirements
evolution (40)
the problem domain changes;
25
system
component
library
impose
constrain
Figure 2.4: the relationship between requirements specication and design in a
browneld context
the customers own understanding of the problem increases; and
progress on system design and implementation uncovers new risks and
opportunities.
This evolution should be detected through continual review and evolution
of the requirements documentation.
The discussion above implies a complicated relationship between require-
ments and design. In principle there is a clear distinction between a problem
denition, which describes what is inadequate about the world; a requirements
specication, which describes what a system should do to correct the problem;
and the system design, which describes how it should do it. This implies a
top-down ow from requirements to design. At the highest level of abstraction,
the system specication states what the system will do. The system design
then impose specications on system components. In turn these components
are designed, imposing further specication on sub-components and so on.
However, the design of pre-existing browneld software artifacts can also
constrain what a new software system is able to do. Figure 2.4 illustrates
the symbiotic relationship between the requirements and design of a software
system. Requirements and
design (41)
At the system level, a system design imposes a specication on new compo-
nents to be implemented for the system before they are designed. The dotted
T attached indicates the specication of the components interface by the sys-
tem design. However, the use of pre-existing software libraries, frameworks or
platforms which provide some functionality for the system, imposes constraints
on what the overall system is able to do, and thus also constrains its design.
The dotted red line from the library to the system indicates the constraint on
the systems design imposed by the librarys specication.
26
2.3 Requirements Elicitation
The principle task of requirements elicitation is to elaborate with the customer
and users what must be achieved in the project in order to resolve the original
problem. This involves identifying the actors who will interact with the system
and the goals they need to reach with it. Eliciting requirements
(42) Requirements elicitation is also concerned with understanding the organisa-
tional context in which the system will be deployed, including both the formal
activities and the organisational culture. Culture can be summarised as the way
we do things around here, reecting the collective outlook and values of the
organisation.
Organisational culture can mask implicit assumptions about the system and
what it will do. These need to be identied and documented as part of the
elicitation process. In addition, there may be political reasons that the project
has been started. Requirements elicitation can help uncover these and make
them explicit.
In principal, the requirements elicitation process should not commit a project
to particular design solutions. In practice, requirements inevitably constrain the
nal design because most projects begin with some pre-conceptions about what
will be built to solve the problem. In addition, outlining design options may also
help stakeholders think about the problem itself. A compromise is to start by
exploring the problem space and consider many possible solutions.
There are numerous methods for eliciting requirements. Figure 2.5 illustrates
some methods that will be discussed below. The methods are shown along an
active-passive axis, indicating the extent to which the requirements engineer
interacts with the problem domain. Requirements
elicitation methods
(43)
2.3.1 Questionnaires
Questionnaires are the least interactive form of gathering requirements. Typi-
cally, the questionnaire is compiled and distributed to customers and users for
completion. Results are then collected and aggregated. Questions can either
oer a discrete number of nite responses, such as a Likert scale, or request a
natural language unstructured response. Aggregating responses to structured
questions often helps identify trends on concerns amongst respondents. How-
ever, structured questionnaires may also miss important details of concern to
the respondents because there is no place for them to express themselves. A
good questionnaire will normally mix structured and un-structured questions.
active
passive
questionnaires observations interviews walkthroughs placements
Figure 2.5: methods for requirements elicitation
27
A disadvantage of questionnaires is that poorly worded questions cannot be
remedied after distribution.
2.3.2 Observations
Making observations is a good way to understand the organisational and cultural
context of the problem. The documented work ows and processes of an organ-
isation are often very dierent from how tasks are actually carried out. Work
practices that have evolved over time to improve organisational eciency may
be disrupted by the introduction of a new system with a design that doesnt
acknowledge their presence. The results of observations may be as much a
surprise to the customer organisationss management as to the project team. Observations (44)
System actors who havent ben identied through other elicitation activities
may be revealed by observing the real work practices. Observations may also
help to reveal assumptions that prospective users have made about the features
of the proposed system.
One method of conducting observations is to instrument the work place in
order to automatically gather data. Data sources can be video feeds, or logs
from existing systems, for example.
A more active approach to observation is to shadow (follow around) a mem-
ber of the organisation during their day to day tasks, building up an understand-
ing of the organisational context from their perspective. In some situations, it
may be appropriate to actually do the task normally undertaken by the member
of the organisation. The observer takes copious notes, sketches, photos and even
audio/video recordings. Some software engineers work with professional ethnog-
raphers to obtain detailed observations of work practices Viller and Sommerville
[2000]. A disadvantage of observations is that it is sometimes challenging to
draw general insights about the organisation from the results.
2.3.3 Interviews
An alternative to distributing questionnaires is to ask questions in person in an
interview. Interview styles can range from completely structured to unstructured
in a similar way to questionnaires. Figure 2.6 illustrates this range of options.
The advantage of using interviews is that they permit interaction between the
interviewer and the interviewee, and in particular, allow the interviewer to iden-
tify and correct mistakes in pre-dened questions. Interviews (45)
A good approach for interviews is to prepare a number of relevant questions
to ask beforehand that cover the things you want to learn, but be prepared to
depart from these if an interesting line of questioning emerges. Remember, you
may be able to obtain answers to missed questions from other interviews, e.g.
those conduct by other software development teams on the same project. Conducting interviews
(46) When conducting the interview, take some time at the start to explain
your purpose an what you hope to learn. Use warm up questions to get the
28
passive
active
open ended
conversation
between
interviewer and
interviewee
questions provide
framework for
conducting
interview
Fixed questions
administered by
interviewer
Figure 2.6: dierent approaches to structuring interviews
interviewee comfortable with the environment. Leave time at the end to debrief
the interviewee. This involves presenting an initial summary of the interview,
allowing the interviewee to identify any mis-understandings. Also, allow time for
the interviewee to ask any questions of you - this may also help uncover issues
that havent been addressed.
Generally, the more documentation taken during the interview, the better.
You can always discard useless information later. Designate a note taker for the
interview who wont be involved in asking questions. You can also take an audio
recording with the permission of the interviewee, but you shouldnt rely on it
for documentation. After the interview, write up your notes immediately and
summarise the key ndings. Try to verify the ndings with those from dierent
interviews if possible.
2.3.4 Walk throughs
The elicitation and validation of requirements from users is often easier if the
discussion can be centered around a potential design solution for the problem
to be addressed. This can be useful during the later stages of the process, when
the broad specication of the system has been established, but the project team
has discovered a more detailed aspect of the system that needs to be addressed.
A scenario is an example of the execution of a use case for the proposed
system. The scenario documents the specic steps taken by a user in order to
achieve a goal. Walk throughs (47)
During a walk through, users are tasked with following a particular scenario
in order to enact the use case. Alternatively, walk throughs can be videoed using
actors and shown to users.
Typically walk-throughs can be conducted using a mock-up or a prototype
of the proposed system. A mock-up is a crude user interface for a system with
no underlying functionality. The mock-up may be little more than a collection
of hand drawn sketches of system dialog boxes. Prototypes are similar, but
often have some functionality, and in some cases may be developed into the
nal system.
Walk throughs provide a shared environment for users and the project team
to investigate and evaluate the requirements for a system. Walking through a
29
Interview report
Postgraduate students are to be treated separately from undergraduates,
since the central library has dierent lending policies for them, and they
can also be employed as sta within the department. The administrator
suggests that a librarian will be employed by the department to manage
the branch and any interactions with the central library.
The administrator also believes that the central library are concerned that
books will go missing from the branch, because borrowers will not treat
lending policies with the same respect.
Figure 2.7: a report of an interview with a department administrator
scenario helps users to understand the structure of the proposed activity and
make changes if necessary. They also allow exceptional situations to be explored
with respect to the system.
2.4 Documenting Requirements as Use Cases
Once the requirements have been elicited from the users they need to be docu-
mented in a form that is understandable by users, customers and system devel-
opers. This eases the process of organising and analysing the requirements to
ensure consistency and completeness. We will use use case descriptions and use
case diagrams to document the requirements identied for the branch library
system.
Figure 2.7 is an extract from a report of an interview with a departmental
administrator. Using the new information, we can identify the dierent classes
of actors who will interact with the system. Actor classes are sometimes called
roles because they are partly dened by how they interact with the system and
the use cases they may invoke. Figure 2.8 updates the collection of actors for
the branch library. Actors are denoted by stick gures with a label. A short
description of the actor also helps to document their role in relation to the
system.
Documenting the actors helps to identify the scope of a system, which
denes the scope of the project and identify constraints. Figure 2.9 shows the
relationship between actors and the system. Things inside the system boundary
must be created in order to support user activities. Use cases dene the interface
between the system and the actors. Actors and roles (49)
Identifying the system
boundary (50)
The next step is to begin to document the activities that the actors will
undertake with the system. Figure 2.10 illustrates a use case diagram. A use
case diagram shows the relationships between several dierent use cases and the
branch librarian actor. Use cases are shown as ovals with a label. As for actors,
it is useful to accompany each use case with a short description, explaining its
purpose. Sometimes the description can just be the requirement itself. Use case diagrams
(51)
30
Academic
Postgraduate
Undergraduate
BranchLibrarian
CentralLibrarian
A member of
academic sta in
the department.
The librarian at
the central library
The branchs
administrator
Permitted to
receive up to 5
library books
Permitted to
receive up to 10
library books may
act as sta.
Figure 2.8: revised set of actors for the system
The gure shows the use cases identied so far for the branch library. There
is a branch librarian, who will manage the lending and collection of books to
and from members of the department. In addition, members of sta can use
the system to request a book be transferred to the library. The branch librarian
will use the system to process the request, passing it on to the central library.
Notice that Staff has replaced the Academic actor, since we have discovered
from the interview report in Figure 2.7 that non-academics may also be sta.
We also need to give short descriptions for each of the use cases:
request book sta borrowers are entitled to use the system to generate re-
quests for books hosted in the central library are moved into their depart-
mental branch
process request the book requests made by sta are reviewed by the branch
librarian prior to initiating the request with the central library
check book out books in the branch library can be issued to borrowers. The
system needs to track which books have been issued to which borrowers
actor
system boundary
activity
use case
Figure 2.9: actors and the system boundary
31
Staff BranchLibrarian
request book
for branch
process
book request
check book out
check book in
Figure 2.10: a use case diagram for some of the the branch library use cases
and ensure that the central librarys borrowing policy for that class of user
has not been violated
check book in books that are borrowed can be checked back in to the branch
library
External systems as
actors (52)
From the problem description and requirements elicitation it is clear that
the branch library system will need to interact with the central library system,
so that requests for books to be transferred can be processed. We can show
external systems as actors in the normal way on a use case diagram. Figure 2.11
includes the central library system as an actor that will interact with the branch
library system for the process book request use case. Note that this again
helps to dene the scope of the system, by encapsulating central library system
functionality in an actor. Actors do not have to be human users of the system,
they are simply external entities in the domain that have some interaction with
the target system.
So far, we have only considered interactions with the system that are initiated
by external actors. For these cases, the system is essentially passive, waiting for
and responding to user input. However, there are some use cases that are better
represented as being initiated by the system itself, even though they describe
interactions with external users.
BranchLibrarian
process
book request
CentralLibrary
Figure 2.11: the central library system as an external actor on the branch library
32
Academic
Undergraduate
Postgraduate
notify users of
overdue loans
Timer
Figure 2.12: a timed notication use case
Recall from the interview report that the administrator was concerned that
some users might treat branch library lending policies as more exible than the
central library. Although we cant expect the branch library system to alter
human behaviour, we might be able to nudge it a little. Figure 2.12 illustrates
the use of an internal system timer to initiate a notication use case. All
the borrower actors (sta, undergraduate, etc) are passive. When the timer is
triggered the system checks all borrower accounts and issues notications to
any borrowers who are over-due in returning books. Timed activities (53)
Now that the functional requirements are starting to become clear, it is
necessary to consider the non-functional requirements for the system. Non
functional requirements refer to the emergent properties of a system that cannot
be tested by the presence or absence of a feature. Non-functional requirements
may be associated with one use case, several, or the entire system.
Non-functional requirements can be organised in a variety of ways. Som-
merville uses a hierarchical taxonomy of product, organisational and external
requirements. Table 2.2 lists dierent categories of non-functional requirements
given by Mynatt, with some questions that can be used as a check list for a
requirements document Mynatt [1990]. Non-functional
requirements (54) We can begin to identify some non-functional requirements associated with
the branch library use cases we have identied, and classify them using the
categories given in Table 2.2. Figure 2.13 illustrates the request book use case
extended with some non functional requirements. Branch library
non-functional
requirements (55)
2.5 Requirements Validation and Analysis
The process of checking that the requirements document is acceptable is called
requirements validation. The task is to ensure that the document describes what
33
34
usability What type of user will actually be using the system
(novice, expert, frequent, casual)?
Are alternative interfaces required?
What are the desirable learning times for new users?
What is an acceptable error rate for a trained user?
error handling How should the system respond to input errors
(recovery, report)?
How should the system respond to extreme
conditions?
documentation Are user manuals, on-line help features, or tutorials
required?
What audience is to be addressed by each
document?
performance What metric will be used to measure throughput,
response time etc?
storage capacity What are the current and future storage needs?
compatability Where are the interfaces with other systems?
What data formats must be supported?
availability What is the expected life time of the system?
What periods of time does the system need to be
available?
How long can the organisation survive without the
system?
Are fall-back or fail-safe options necessary?
What is the maximum acceptable downtime per
day, month, year and frequency of outages?
How often should the system data backed up?
Who will be responsible for back up?
environmental Are there any unusual operating conditions for the
hardware?
security Must access to the data or system be controlled?
Is the data subject to the provisions of the Data
Protection, or Freedom of Information Act?
resources What is the budget for the system?
Are there any personnel constraints?
Table 2.2: categories of non-functional requirements [Mynatt, 1990]
F6.3.1 request books from central library
A user shall be able to use the system to request that a book be
transferred from the central library to the branch
NF6.3.1.1
Only sta members are permitted to request books
type: security
NF6.3.1.2
A response to the request shall be sent to the user within 3 working days
type: performance
Figure 2.13: the request book use case extended with non-functional require-
ments
the customer wants and is of a sucient standard that the project team can
begin to design the system. Table 2.3 summarises the key criteria for validating
requirements. Criteria for
appropriate
requirements (56)
The rst criteria is to consider whether the requirement should be included
in the system at all. If a requirement contributes no value to the systems
business case, it should be discarded. One way of evaluating the importance of
a requirement is to consider whether the customer would care if it wasnt present
in the system, given that they are paying for it to be implemented. Also, the
requirement should be traceable to the evidence gathered during requirements
elicitation. If the requirement cant be justied, then it should be removed.
The second criteria is whether requirements can be realised within the
projects current budget and resources. If a requirement cannot be realised,
then the project scope may need to be adjusted. The realism of requirements
reects the fuzzy distinction between requirements and design. In principle, re-
quirements should be specied in isolation, without concern for how they are
to be satised. However, this risks specifying a system that cannot be imple-
mented at all, due to the constraints that have been identied in the problem
domain! In practice, a judgment needs to be made as to what belongs in the
requirements specication, and what belongs in the design.
For the third criteria, if requirements are not testable, then it cannot be
necessary would the system be inadequate without the requirements?
realistic can the requirements be realised by a design?
testable can the requirements be observed in the deployed system?
quality are the requirements complete and comprehensible?
Table 2.3: criteria for evaluating requirements
35
Staff BranchLibrarian
request book
for branch
cancel
book request
request book
for branch
cancel
book request
Figure 2.14: the new cancel book request use case
shown whether the system meets the requirements specication or not. A useful
indicator of untestable requirements is the presence of phrases like user friendly,
robust, or good in the statement. Instead, consider the metrics you can apply
to testing requirements.
The quality of the requirements documentation should also be reviewed dur-
ing requirements validation. In particular, the completeness of the requirements
can indicate the readiness of the project to proceed to the design and implemen-
tation activities. If parts of the system are still unspecied, more requirements
elicitation may be required. The organisation and comprehensibility of the re-
quirements specication should also be reviewed. Requirements that are poorly
written may be interpreted dierently by dierent customers and users.
After reviewing our existing use cases we decide to return to the request book
use case. Writing use cases facilitates a dialogue between the customer and soft-
ware team, and help us to decide what the system will and will not do. Use case
descriptions can be added to and changed as our understanding of the problem
improves. Rening the problem
description (57) After further discussion with the branch librarian, we discover that it be-
comes necessary to add a new use case for cancelling a book request. This will
allow sta to correct mistaken requests before the book arrives in the branch
library. The cancellation will generate a notication for the branch librarian.
Figure 2.14 shows the addition of the new use case to the diagram. We may
also need to add use cases for returning books to the central library.
We next proceed in reviewing some use cases developed by another member
of the project team. We discover one use case (Figure 2.15) that reads better
if it is satised by the actor rather than the system. Identifying premature
design decisions (58)
Database
store
book request
Figure 2.15: a pre-mature design decision expressed as a use case
36
must have the system will not be successful without the
feature
should have this feature is highly desirable,
could have this feature is desirable if everything else has
been achieved
would like to have this feature does not need to be implemented yet
Table 2.4: MoSCoW rules prioritisation scheme for requirements
In the diagram, the database actor is responsible for storing the request in-
formation. This is often a good sign that the use case is prematurely committing
the team to a design decision. In this case, the use case commits the system to
storing requests in a database, which is clearly a design decision, because it is
concerned with the internal implementation details of the branch library system.
It may turn out that requests can be stored in a le, must be sent to a logging
server or do not need to be retained on the system at all.
As a result of reviewing the existing requirements set, a number of new func-
tional requirements have been identied. However, new features are not always
desirable. When identifying potential new use cases, consideration should be
given as to whether the new features are something the system should naturally
do, or could they be done by one of the existing actors.
Adding many new requirements may alter the project scope substantially,
meaning that we have to re-consider the risk analysis and business case. All
projects have a nite budget and duration, so it may not be possible to include
all the desirable features in the system, or at least not in the rst instance.
Instead, the use cases identied for the project should be prioritised and an
estimate established for implementing each of them. Prioritising use cases
(59) Table 2.4 shows the MoSCoW rules, a typical scheme for prioritising use
cases. Broadly, use cases should be ordered into a priority list from highest to
least. Following the prioritisation, all of the must have and most of the should
have use cases should be achievable within the allocated budget and duration.
If this is not the case, it in indicates that the project is not realistic and either
the budget and scope are adjusted, or the project should be abandoned.
2.6 Summary
The requirements engineering process is concerned with eliciting, documenting
and validating requirements about the system. There are numerous methods for
eliciting requirements, depending on the type of information to be learned about
the proposed system and the stage of the requirements elicitation process.
37
A museum requires a system that will enable museum sta to keep track of
guided tours of the museum. When a party of visitors arrives, a sta member
must be able to record the date, start time, details of the visitors and one of
the pre-dened routes for the tour. The age of each visitor is used to calculate
the total entrance fee to charge for the tour.
Also, a sta member must be able to assign a guide to the tour, from available
museum tour guides (i.e., those not currently conducting a tour or performing
some other duty); the assigned guide will be notied of the assignment.
During a tour, its guide must be able to record special incidents that might
occur, such as a visitor becoming ill. Each such incident will be related to the
tour on which it occurred and will include a description and a time. Incident
reports must be communicated to the Museums Safety Oce.
Figure 2.16: museum problem description
2.7 Tutorial - Requirements Capture
Consider the problem description in Figure 2.16, and then complete the following
tasks: Problem description
(60) From the description:
Task (61)
1. Identify the actors (including all stakeholders) in the system.
2. Write an initial collection of use cases to describe the functional require-
ments for the system.
3. Draw a use case diagram to illustrate the relationships between actors and
use cases.
4. Write a list of non-functional requirements for the system. Organise the
list by the categories given in Table 2.2 (you dont necessarily need re-
quirements in every category).
Once you have an initial set of use cases, consider the following questions: Questions (62)
1. Are there any functional or non-functional requirements that you think
have not been explicitly identied in the description?
2. How would test the non-functional requirements you have identied?
3. How do your requirements measure up to the criteria described in Section
2.5?
38
Chapter 3
Requirements Renement and
Planning
Recommended Reading
Simon Bennett, Steve McRobb, and Ray Farmer. Object Oriented Systems
Analysis and Design Using UML. McGraw Hill, Shoppenhangers Road, Maid-
enhead, Berkshire, SL6 2QL, third edition, 2006.
Section 5.3
3.1 Recap - Branch Library
Recall from Chapter 2 that we are working on a project to develop a system
to manage the movement of books in a branch library. We have established
an initial problem description and business case and begun, on the basis of
some requirements elicitation, to document the use cases and associated non-
functional requirements.
We have now received the results of an interview with a Head of Department
(HoD) from one of our colleagues. The department will host one of the branch
libraries. Figure 3.1 is a partial transcript of the conversation with the HoD. Interview with the
head of department
(64)
The results of the interview are not encouraging. The requirements engi-
neer was hoping to use the interview to nalise some details regarding system
infrastructure. However, the questions have un-covered a hidden assumption
in the system specication. The use cases we have established so far were on
the assumption that there would be a space allocated in the department for
the branch and that a branch librarian would be appointed. According to the
HoD, neither of these things will happen.We are going to have to re-think the
features of the system to t within the organizational constraints. The good
news is that at least we have uncovered this assumption before proceeding to
system design.
39
40
Requirements Engineer(RE) thanks for agreeing to talk to me... I need to
just ask you a few questions about the systems infrastructure in the school.
Head of Department (HoD) okay,... but you might be better talking to the
technicans.
RE right, Ill arrange that, but I would like to conrm a couple of basic things
with you rst.
HoD okay...
RE rst, of all, I just need to check that there is network cabling in the branch
library?
HoD well, there is networking throughout the department!
RE so... where exactly is the branch library going to be based,... within the
department?
HoD Im sorry, I dont understand...
RE where is the branch library going to be physically located, in the depart-
ment, which room are you planning to allocate to it?
HoD oh, I see. There must be some mis-understanding!... space is very tight
here at the moment. I dont have any room to allocate for a branch
library... it wouldnt be attended anyway.
RE oh, so where will the branch librarian be based?
HoD who?
RE we thought you were planning to appoint a librarian to manage the branch.
HoD no, theres no money for that! Who told you that?
RE are you planning to make branch librarian an administrative duty for one
of your academic members of sta?
HoD I dont think that would work at all. A branch librarian would probably be
a full time task. I could probably ask the existing library representative to
take on a slightly larger administration load, but nothing more than say
an hour a week.
RE so who do you envisage managing the books in the branch then?
HoD Id assumed you were planning some sort of distributed system, with books
held and lent out by individual academics.
RE Right, well thank you very much for your time - Ive got a lot to talk to
the team about!
Figure 3.1: interview with the Head of Department (HoD)
Librarian Keeper
Request book
for branch
Process request
Record receipt
of book
Figure 3.2: the use cases related to transferring a book to the branch
The HoD has also oered a small amount of administrative time for the
system and has also suggested a dierent system specication. We need to
develop a specication for a distributed branch library management system,
rather than the centralised approach we had adopted thus far.
Although a distributed branch library system may be more complicated to
implement, it does provide users with some useful features. In the distributed
branch library, books are held by members of sta throughout the department.
Each academic requests books to be transferred to the branch, and the member
of sta is then responsible for the book while it is in the department. The
member of sta is able to lend the books they hold out directly to students or
other members of sta.
Recall the discussion in Section 2.2 on the relationship between requirements
and design, and the constraints imposed by browneld development. Notice how
the new organisational design that we have adopted has constrained the speci-
cation of the branch library system. In this context, the branch library system
is just one component in the larger organisational system consisting of the Uni-
versity, the Central Library and the constituent departments. Thankfully, we
havent begun to design the branch library system itself yet, so the specication
is still open to alteration.
The new organiational model means that we are going to have to revise the
use cases and actors for the branch library system. Figure 3.2 shows the revised
use case diagram for transferring a book to the branch from the central library. Revised use cases (65)
The diagram shows three use cases (request book for branch, process request
and record receipt of book) and two actors (a Keeper and the Librarian in
the central library), much of which is new. The Keeper actor represents a mem-
ber of the department who is entitled to hold books on behalf of the branch.
There may be many keepers appointed within the department because the books
41
lend book
return book
(to branch)
Borrower Keeper
Figure 3.3: use cases for lending books in the branch
will be distributed rather than held in a central location. As before, a librarian
in the central library will approve and process requests. There is also a new use
case for a Keeper to record receipt of a book. We have adopted a looser model
of book management, so we need to record on the system when a book has
been received into the possession of a keeper.
Having arranged for books to be delivered to the branch library, we need to
model the lending of books by keepers to borrowers. Figure 3.3 shows the use
case diagram with the collection of use cases for lending books in the branch. Sub-lending (66)
Next, we need to consider how members of sta get appointed as keepers.
Recall from the interview with the Head of Department that a small amount of
administrative work load can be allocated to a member of departmental sta.
Figure 3.4 illustrates the use case diagram containing the two use cases for
adding and removing keeper accounts from the system. Keeper administration
(67) The altered use cases also means we should revisit the non-functional re-
quirements for the system. In particular, the decision to opt for a distributed
system means that the management application will need to be available at a
larger number of locations than previously considered, because each registered
Administrator
Add Keeper
Remove Keeper
Figure 3.4: use cases for keeper administration
42
NF1 The system must interact with the Central Librarys database of
books.
NF2 The system must interact with the Central Librarys database of users.
Access control must be implemented with reference to this database.
Figure 3.5: non-functional requirements for the branch library system
keeper will need to access the system from their oce. This has implications in
a large number of categories of non-functional requirements, in particular, user
interface and security requirements. Figure 3.5 documents some system wide
non-functional requirements. Non-functional
requirements (68) Notice how the system-wide specication of non-functional security require-
ments implies new functional requirements. In particular we will need to imple-
ment use cases for logging on to and logging o from user accounts to ensure
proper authentication and access control.
3.2 Planning
Now that a revised system specication has begun to take shape, we need to
begin planning the elaboration and construction phases. Requirements elicita-
tion has identied a large number of use cases for the system (see Figure 3.6),
not all of which are going to be possible to implement within the time scale for
the rst iteration of the project. In addition, some of the use cases have been
added late and are not fully documented yet. All use cases (69)
We can use the MoSCoW rules method to decide which use cases to priori-
tise. Figure 3.7 illustrates the use cases grouped according to priority. Notice
that the must have category includes only the essential use cases for the system.
Use cases for searching for books, viewing status and so on have be placed in
the should have category, because the system can function without them, just
not at all well. The use cases for returning books to the central library have
been relegated to the could have category. Books will need to be transferred
login
logout
search borrower
search book
view status
add keeper
remove keeper
request book
process request
record receipt
lend book
request return (to
branch)
record returned (to
branch)
request return (to
central)
record sent
record returned (to
central)
send reminder
apply ne
record ne payment
Figure 3.6: all use cases identied for the branch library
43
Must have:
login
logout
request book
process request
record receipt
lend book
record returned (to branch)
Should have:
search borrower
search book
view status
add keeper
remove keeper
Would like to have:
send reminder
apply ne
record ne payment
cancel request
Could have:
request return (to branch)
request return (to central)
record sent
record returned (to central)
Figure 3.7: moscow rules categorisation of the use cases
back at some point, but this is likely to be required once the body of books in
the branch is established. Planning (70)
With the use cases organised by priority we can begin to plan the overall
project as a series of iterations. We will aim to implement the must have and
should have use cases during the rst iteration.
3.3 Describing Use Cases
The next step in the elaboration phase is to begin to add more detail to the use
cases so that they are in a state to be translated into a system design. To do
this, we need to document the sequence of events that occur when a use case is
executed and how variations and exceptions are managed. In addition, we need
to document the state the system must be in before a use case can be started,
and the state it is in after the use case has nished. These are called the pre
and post conditions for the use case.
The method we will adopt for this process will be to develop a number
of scenarios for each use case. A scenario uses specic information (perhaps
ctional) to add detail to a use case. Figure 3.8 illustrates the primary scenario
for the request book use case. A primary use case describes the situation when
all the normal steps take place, with no unusual exceptions. Primary scenarios
are sometimes referred to as happy day scenarios, because everything goes right
in them. Primary scenario (71)
Figure 3.9(a) illustrates an alternative scenario for the same use case. The
scenario shows what happens when the book requested is not found in the
44
John logs into his account with the branch system. He is a registered keeper
and wants to request that a copy of the book Software engineering by Som-
merville is transferred into his posession in the branch library. He selects
the request book for branch option from the main menu, and enters Som-
merville* into the search eld. The query return several possible options,
including 12 copies of the book on software engineering (in the 6th, 7th and
8th edition) and another on requirements engineering. John chooses the
software engineering book (9th ed). Finally, he clicks the button to conrm
the request and logs o.
Figure 3.8: the primary scenario for the request book use case
John logs into his account with the branch system. He is a registered keeper
and wants to request that a copy of the book How to lie with statistics is
transferred into his posession in the branch library. He selects the request
book for branch option from the main menu, and enters *Statistics* into
the search eld. The query return a 4652 options, unfortunately, none of
which are the book he is looking for. John logs o the system.
(a)
John logs into his account with the branch system. He is a registered keeper
and wants to request that a copy of the book How to lie with statistics is
transferred into his posession in the branch library. He selects the request
book for branch option from the main menu. The system reports that the
connection to the central library is unavailable. John logs o the system.
(b)
Figure 3.9: an alternative scenarios for the request book use case
central library. Alternative scenarios illustrate how exceptions or unusual events
are handled. In principle, all possible alternative scenarios should be documented
along with the use case. In practice, many trivial variations can be combined.
Figure 3.9(b) illustrates a second alternative use case, this time documenting
how the system should respond when the connection to the central library is
unavailable. Alternative scenarios
(72)
Scenarios are useful for establishing the details of a use case with users and
customers. However, the information contained is too specic to be directly
transferred into a system design. Instead, the structure of the use case needs
to be abstracted from the specic examples. The rst task is to enumerate the
steps of the scenario. Figure 3.10 shows the steps taken by the participant in
the primary scenario in Figure 3.8 Enumerating the steps
(73)
Next, the specic steps taken in the scenario are abstracted to a general
procedure detailing the use case. Figure 3.11 shows the steps of the use case
45
1. John logs into his account with the branch system by entering his
username johnd and password mypetcat84.
2. He selects the request book for branch option from the main menu
3. and enters Sommerville* into the search eld.
4. John chooses the software engineering book (9th ed).
5. he clicks the button to conrm the request and
6. John logs o.
Figure 3.10: the steps of the primary scenario for the request book use case
in pseudo code, a semi-formal language for describing activities. Using pseudo
code provides a briefer description of the steps taken, suitable for input to the
design process. Abstracting from the
sample data (74) The alternative scenarios now need to be integrated into the use case de-
scription. To do this, it will be necessary to describe the conditions under
which alternative routes are taken through the use case. Pseudo code can be
extended to include descriptions of alternatives and rrepetitive actions. Figure
3.12 illustrates the use of conditions in pseudo code to integrate alternatives. Alternatives (75)
Repeated tasks can also be denoted in pseudo code using foreach and while
loops, based on a condition. Figure 3.13 illustrates the use of repetition for
describing the request book use case. Repetition (76)
Finally, all the separate parts of the use case can be integrated into a single
description. Figure 3.14 illustrates the complete pseudo-code description of the
request book use case. Complete Example
(77)
3.4 Activity Diagrams
Pseudo code is an expressive notation for conveying system activities for later
software design. However, for complex use cases, it can be dicult to gain an
understanding of the ow of work from a pseudo-code description. In addition,
login
select request book for branch option
search for books
select books
confirm request
log off
Figure 3.11: the steps of the request book use case as pseudo code
46
47
if <condition > do
<step 1.1>
<step 1.2>
...
else if <condition > do
<step 2.1>
else
<step 2.2>
endif
if connection available
search
...
endif
if book found do
if not book in branch
select books
confirm request
else if on loan
request return
endif
endif
Figure 3.12: denoting alternatives in pseudo code
foreach <items > do
<step 1.1>
<step 1.2>
<...>
done
while <condition > do
<step 1.1>
<step 1.2>
<...>
done
foreach books found do
select book
done
confirm request
while book not found
search
done
Figure 3.13: denoting repetition in pseudo code
login
select request book
if connection available
while not books found
search
done
foreach book found do
select book
done
confirm request
endif
Figure 3.14: the request book use case description in pseudo-code
the notation is less suited for explaining specications to customers and users.
Activity diagrams are a graphical notation for illustrating activities. All
the constructs available in pseudo-code are available in an activity diagram.
In addition, activity diagrams can represent activities that occur in parallel,
which are dicult to denote in pseudo-code. Activity diagrams (as of UML 2.0)
are based on the concept of petri-nets, which can have multiple ows passing
through them simultaneously. This can be a powerful formalism for modelling
complex concurrent activities. However, we will be using activity diagrams to
represent relatively simple purposes.
Figure 3.15 illustrates the notation for activity diagrams. Activities are rep-
resented as labelled lozenges with ows between activities indicated by arrows. Activity Diagram
notation (78) Decisions are indicated by diamonds accompanied by the appropriate condi-
tion (the guard) on each of the out-bound ows. Some variants of the activity
diagram notation place the guard on the diamond itself, if it is obvious which
ow to follow based on the condition.
Activity ows can diverge or merge in parallel at forks and joins respectively.
When a fork is reached, all proceeding ows can be followed immediately (allow-
ing any connected activities to also begin). When a join is reached, all preceding
activities must terminate before the ow can proceed beyond the join.
Activities can be decomposed into ner levels of detail if necessary. Activity
diagrams have entry (begin) and nal (ow and activity) points, indicating
the interface between the diagram and activities represented at higher levels of
abstraction. A ow nal node indicates the end of a single ow. Multiple ows
may be active in a diagram as a result of one or more fork nodes being reached.
The activity nal node indicates the end of all ows in the activity. Example activity
diagram (79) Figure 3.16(a) shows the same request book activity described in pseudo
code in Figure 3.14 as an activity diagram, using the notation in Figure 3.15. A
user logs in and (if a connection is available) searches for books to request for
transfer to the library. If the search has produced the desired results, the books
can be selected and the request conrmed.
On reviewing the ow of activities with a user, it becomes apparent that the
label
activities
ows
[route 1]
[route 2]
branches
fork
join
begin
end
nal
Figure 3.15: notation for activity diagrams
48
49
log in
select
request book
search for books
select
books
confirm
request
[books found?]
[search again?]
[connection available?]
(a) pseudo code-equivalent
log in
select
request book
search for books
select
books
confirm
request
[books found?]
[search again?]
[connection available?]
[finished?]
(b) using parallelism
Figure 3.16: the request book for branch use case illustrated as an activity
diagram
enter
username
enter
password
submit
do delay
[logged in?]
[correct?]
Figure 3.17: the login use case
arrangement is rather awkward. In particular, the work ow requires that a user
either get their search exactly right before selecting the books to be requested,
or alternatively submit separate requests for each search.
Figure 3.16(b) renes the activity diagram by using a parallel arrangement of
searching for and selecting books. Once a user has searched for books, they may
do any of three things in parallel: search again, select some books or conrm
the request. Note that activity nal nodes have been replaced with ow nal
nodes for each of the decisions following the fork. These allow the relevant ow
to be terminated, without halting the entire activity. We could also extend the
activity diagram further to allow a user to cancel a request.
We can also add further renements by drawing activity diagrams that de-
scribe a single activity at a ner level of detail. Figure 3.17 shows the login
activity used in the request book use case description as a full activity diagram
in its own right. Notice that we have used fork and join nodes to exploit paral-
lelism again in representing the login use case. A user must enter both a user
name and a password for authentication, but the order in which they do this is
not restricted. Activity diagram
renement (80)
3.5 Advanced Features
There are some additional features of use case diagrams that can be used to
simplify requirements documentation. The UML was designed to be extensible,
50
request book
login
lend book
Keeper User
<<include>>
<<include>>
I:login
select request book
if connection available
while not books found
search
done
foreach book found do
select book
done
confirm request
endif
Figure 3.18: including login in the request use case
which means we can dene special classes of entities and relationships with par-
ticular semantics. Extensions in UML are dened using stereotypes, which can
be denoted using a label surrounded by guillemots, like this. Stereotypes
can also be denoted by changing the appearance of the artifact. Actors for
example are special types of object classes. Stereotypes in UML
(81)
There are two standard stereotypes for use case diagrams. Sometimes it is
convenient to show a commonly occurring activity as a use case which is part
of a number of other use cases. Included use cases are usually complete and
can be used in isolation (a user may login and do nothing else for example).
We have already seen how the login use case is represented as an atomic
activity in the request book use case activity diagram in Figure 3.16. We can
also represent this on a use case diagram with an include relationship, as
shown in Figure 3.18. In the diagram, login is included in both request book
and lend book use cases. The gure also shows the equivalent modications
to the pseudo-code description of request book to indicate where the login use
case is included, the login statement is preceded by an I:. Including use cases
(82)
Alternatively, it may be the case that a use case description has become
complicated by too much detail. To manage this situation, some details of the
use case can by encapsulated in an extending use case, denoted by an extend
relationship. Typically, an extending use case is an encapsulation of a fragment
of activity that isnt naturally part of the main use case (e.g. for managing
unusual situations or alternatives) and cannot be used as a use case in its own
right.
Figure 3.19 illustrates the view status use case extended by two further
use cases, pay ne and amend details. The gure also illustrates the equivalent
notation in pseudo-code, the extending statements are preceded by an EP:. Extending use cases
(83)
Note the distinction between included and extending use cases. Included
use cases can be thought of as common utility activities that occur frequently
51
amend details
view status
pay fine
User
<<extend>>
<<extend>>
I:login
select view status
if fines owed
EP:pay fines
endif
if details wrong
EP:edit details
endif
Figure 3.19: extending the view status use case
as part of other use cases. Extension use cases are fragments of activity that
add extra activity to a main use case. This dierence is emphasised by the
stereotype relationships. Included relationships are drawn from the including
use case to the included. Extended relationships are drawn from the extended
use case to the extending.
We can now see the recursive relationship between use case and activity
diagrams. Use case diagrams are used to denote the functional specication of
a system and the interface between the system and external actors. Use case
diagrams also show where one use case is used as part of another. Activity
diagrams are used to explain the structure of activities within each use case.
Where a use case is used as part of another, it is represented as an activity.
We now need to revise the descriptions of the actors on the system to take
account of the changes made to the use cases. The change to a distributed
system has meant that the former role of branch librarian has been split between
a branch administrator and the book keepers who request and lend books.
Keepers are academics who can also borrow books like other student borrowers.
This can make use cases quite complicated with many dierent actor classes
associated with each of the use cases. Figure 3.20(a) illustrates this problem
with the lend book use case with all of the relevant actors present. It isnt clear
from the diagram whether all the dierent actors play dierent roles in the use
case, or whether they all (or some of them) play the same role. Actors and Inheritance
(84)
To simplify the diagram, we can use inheritance between dierent actor
classes. We can see now that actors are just a special object classes, so the
is a rule of inheritance applies to them in the normal way. Figure 3.20(a)
shows the lend book use case with inheritance among the actors. The diagram
introduces a borrower class. Now, the only two actors associated with the lend
book use case are the books keeper and the prospective borrower. All other
actor roles who are able to borrow books are sub-classes of the borrower.
52
53
Keeper
StaffMember
Undergraduate
Postgraduate
Undergraduate
Postgraduate
Keeper
StaffMember
lend book
(a) without inheritance
Borrower Keeper
StaffMember Undergraduate Postgraduate
lend book
(b) with inheritance
Figure 3.20: the lend book use case and actor inheritance
Borrower
Staff Member Student
Keeper Administrator Postgraduate Undergraduate Postgraduate Undergraduate Keeper Administrator
CentralLibrary User
Staff Member
Figure 3.21: revised actors for the branch library system
In practice, it can be useful to show inheritance between actors on a separate
diagram from the use cases. Figure 3.21 shows the revised actors for the branch
library system with the inheritance relationships between them. Notice we have
decided to include an extra student role in the hierarchy - it may be that some
aspects of the undergraduate and postgraduate roles are the same. Revised actors (85)
3.6 Completing Use Case Descriptions
We have now covered the dierent approaches to describing the details of use
cases, and need to ll in the nal few details.
Use cases must be associated with both pre- and post-conditions. Pre-
conditions describe the state that the system (note the emphasis) must be in
before a use case is executed. Pre-conditions describe the constraints on the
system state that are not handled by the internal logic of the use case. Pre
conditions must be checked and satised by the system before the use case is
started.
Post conditions describe the state that the system must be in once a use case
has nished. There may be several alternative states for the system, depending
on the possible outcomes from a use case.
Finally, a rationale is needed which gives the justication for the use case.
The rationale supports traceability checking for use cases to the original source
54
rationale: Keepers need to be able to request books to be transferred into
the branch library.
conditions:
pre none
post a request for the transfer of the requested books is stored for process-
ing; or
post no request is stored if not conrmed
Figure 3.22: pre and post conditions for the request book and lend book use
cases
documentation for the requirements.
Figure 3.22 illustrates the pre- and post-conditions and rationale for the
request book and lend book use cases. Note that there are two possible post
conditions because the use case can terminate with or without a request being
conrmed. Also note that there is no pre-condition, indicating that the use case
can be executed from any system state. This is acceptable, because we have
documented which users can invoke the use case separately (keepers), and have
included the login process as part of the use case. Conditions and
rationale (86)
We now have all the elements necessary to document the system require-
ments as use cases, so we now need to collate the information into a single
requirements document. Appendix A contains a L
A
T
E
X template for recording
all the information related to use cases discussed above.
Each use case for a system should be described using a separate template.
Use cases are best grouped together into related functions, accompanied by a
use case diagram to describe the relationships between use cases and actors.
Where appropriate, use cases can be repeated on dierent use case diagrams.
For example, the login use case may need to appear on each diagram where it
is included in another use case.
Figure 3.23 illustrates the overall structure for a use case document. The
document consists of a problem denition; a description of system actors; a set of
use case diagrams illustrating relationships between related use cases and actors;
and a set of use case descriptions, developed using the template described above.
In addition, the requirements document should have an appendix containing the
key scenarios for the use cases. Use case document
(87)
An example use case document for the branch library system is available on
Moodle.
55
requirements
document
use case
diagram
use case
diagram
use case
description
use case
description
use case
description
use case
description
scenarios
scenarios
scenarios
Figure 3.23: the component parts of a use case document
3.7 Summary
Use case descriptions document a single use case of a system. Use case diagrams
show the relationships between use cases.
56
3.8 Tutorial Requirements Renement
Recall the scenario in Figure 2.16 and then work on the followings tasks. Work
on the activity diagrams using Umbrello (Level 3), StarUML (Level M) or an-
other CASE tool in the laboratory. There are tutorials online for both tools
at:
http://staruml.sourceforge.net/docs/user-guide%28en%29/toc.html
http://docs.kde.org/stable/en/kdesdk/umbrello/index.html
Task requirements
renement (88)
1. Elaborate primary and alternative scenarios for each of the use cases iden-
tied in the previous tutorial.
2. Draw an activity diagram for each of the use cases you have identied.
3. Indicate any omissions or ambiguities in the description and state any
assumptions you have made.
Develop the detail of your use cases using the L
A
T
E
X (Level 3) or Word (Level
M) template available in appendix A and on Moodle between now and the next
tutorial. In particular, for each use case give a rationale and describe some
scenarios to illustrate the possible variations and exceptions, the pre and post-
conditions, extension and inclusion points and any non-functional requirements.
57
58
Chapter 4
Domain Modelling
Recommended Reading
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, ninth edition, 2010.
Section 5.3, 7
Simon Bennett, Steve McRobb, and Ray Farmer. Object Oriented Sys-
tems Analysis and Design Using UML. McGraw Hill, Shoppenhangers
Road, Maidenhead, Berkshire, SL6 2QL, third edition, 2006.
Chapter 7 and Appendix 3
4.1 Introduction
Chapter 1 introduced the elaboration of use cases and domain models as key
methods for documenting the requirements for a system. Use cases (described
in Chapters 2 and 3) are used to specify the functionality of a system, i.e. what
the system will do. This chapter explores the concept of domain modelling
further, using the class responsibility collaboration (CRC) method and UML
class diagrams. Domain models describe the entities in the environment that
are to be represented in the system in some way.
4.2 Object Oriented Analysis and Design
Before we continue, we should review the notion of objects and classes that will
be the basis for the domain models we will build. Object oriented analysis and
design using UML is a consolidation and development of notations from three
earlier object oriented methods:
object oriented design Booch [1982];
59
the object modelling technique, including state and class diagramsRum-
baugh et al. [1991]; and
the ObjectOry method including component and use case diagrams, as
well what became the phases in RUP Kruchten [1997].
An object is an entity with a state, usually represented as a collection of
attributes representing internal data and relationships to other objects.
An object oriented environment must usually provide a mechanism for iden-
tifying and addressing objects; and for altering object state (typically via a
prescribed set of services or operations for each object that can aect that
state). Communication between objects is managed via messages to and from
the services oered by each object.
The specication of an object is described by its class, including the state
attributes maintained by every object and the services they will oer via oper-
ations. Classes can be used to represent and reason about the behaviour of a
large number of objects.
An object oriented approach to software development partitions data and
behaviour into objects. The overall behaviour of the system is a result of the
interactions between the collection of object in the system. Object oriented
modelling and development is characterised by two features useful for managing
system complexity: Features of object
oriented development
(90)
encapsulation and information hiding of the state and internal be-
haviour of an object so that is not directly accessible to external service
clients. Access to internal state can be regulated by the specication of an
objects operations. Operations can be provided to create a new instance
(a constructor), alter an objects state (a mutator) or access the state (an
accessor). System development is concentrated on what the services an
object provides can do, not how it does it.
inheritance and polymorphism encourages re-use of higher level class
specications among more detailed implementations. Polymorphism en-
ables multiple implementations to handle the same message from a client
in dierent ways, in a manner which is transparent to the client.
Classes are represented in UML using the notation shown in Figure 4.1. The
class has a name (or identier), a collection of attributes and a collection of
operations. Attributes can be denoted as having a particular type, int, String
or AnotherClass, for example, as shown in the diagram. Operations may be
denoted as having a number of arguments that are passed with a message
(each of which can have a type and/or identier), and a return type indicating
the type of the value to be passed back to the client when the invocation of the
operation is complete. Classes in UML (91)
60
<<stereotype>>
ASuperClass::AClass
attributeOne:int
attributeTwo:String
attributeThree:AnotherClass
AClass(arg1:String)
operationOne():void
operationTwo(arg1:String):AClass
operationThree(arg1:AClass,arg2:String):void
Figure 4.1: UML class notation
Collectively, a class attributes and operations are known as its members.
Class member visibility (outside an instance) can be recorded as either public,
protected or private as described in Table 4.1. Member visibility is denoted by
a padlock being either unlocked (public), open (protected) or locked (private). Member visibility
modiers (92) Figure 4.1 illustrates the use of member visibility modiers on class diagrams.
The class may be decorated with one or more stereotypes denoting that
it is a member of a collection of classes with particular properties. There are
several standard stereotypes for classes, some of which are denoted by altering
the appearance of the class. For example, the interface stereotype can
also be denoted by an italicised font for the class name. A class name of the
form ASuperClass::AClass can be used to show that AClass is a sub-class of
ASuperClass.
An object oriented approach can be adopted at several stages of software
development. However, the application of object oriented techniques and the
tools and notation adopted are dierent in each case, as illustrated in Figure
4.2. Object oriented
analysis and design
(93) during analysis an object oriented approach is used to identify the enti-
ties in the domain, as referred to in the original problem description and
use cases. These are documented as a high level design which identies
each domain entity type, their attributes and the relationships between
them. Figure 4.2(a) documents the features of the Book class, identied
for the branch library system. At this stage, it is identied that the book
has an author, however, further details are omitted.
during design the class models are rened and extra detail is added.
Design alternatives are also identied and resolved at this stage. Further
, + public globally visible to all other classes
, # protected visible to child classes
, - private only visible internally in the owning class
Table 4.1: member visibility modiers
61
62
Book
author
getAuthor()
setAuthor(a)
(a) domain analysis
Book
author:String
getAuthor():String
setAuthor(a:String):void
Book
author:Author
getAuthor():Author
setAuthor(a:Author):void
Author
surname:String
forename:String
title:String
Book
author:Author
getAuthor():Author
setAuthor(a:Author):void
Author
surname:String
forename:String
title:String
option 1:
author as
a private
member
option 2:
author as a
separate
class
(b) design choices
publ i c c l a s s Book {
pr i v a t e Author author;
pr i v a t e Author getAuthor ();
pr i v a t e voi d setAuthor(Author a);
}
publ i c c l a s s Author {
pr i v a t e String surname;
pr i v a t e String forename;
pr i v a t e String title;
}
(c) implementation
Figure 4.2: Object oriented analysis, design and implementation
The keeper selects the request
book for branch option from the
main menu and enters a
search term for books by either
author or title. The keeper selects
the desired books from the list and
either searches again or conrms
the request for the list of books.
Keeper
Request book
for branch
Figure 4.3: identifying entities in the request book for branch use case
classes may be added and the architecture of the system gradually be-
comes established. Further renements may be made to the design later
on to accommodate the constraints of external libraries or platforms, or to
leverage design patterns. Figure 4.2(b) shows two dierent design alter-
natives for the Book class. In option 1, the author is represented as a class
attribute. In option 2, a book author is represented as a separate class,
with its own attributes. Option 2 is selected, to allow for the possibility
of a many to many relationship between authors and books.
during implementation the chosen design is translated into an exe-
cutable object oriented system, using a language such as C++, Java,
Python or C#. Figure 4.2(c) shows the implementation of design option
2 in Java. CASE tools such as Umbrello or StarUML can be used to
translate class diagrams into object oriented program stubs, containing
the attribute and method signatures of the class.
In summary, object oriented analysis is concerned with documenting the
features of entities in the problem domain and the relationships between them.
Object oriented design is concerned with translating the domain representation
into a system architecture suitable to be implemented in an object oriented
programming language. Design models document the software components to
be implemented. This chapter is concerned with early stage object oriented
analysis, we will return to object oriented design in semester 2.
4.3 Class Responsibility Collaboration
Problem descriptions and use cases are the primary source of information for
domain analysis, since they implicitly describe the entities in the problem en-
vironment that must be represented in the system. As with other aspects of
requirements elaboration, the domain model must be developed iteratively as
the set of use cases becomes more rened. Eliciting domain
entities (94) A straight-forward method for identifying domain entities is to extract nouns
in problem descriptions. Consider the use case description in Figure 4.3. Each
63
class name:
responsibilities: collaborations:
Branch
provide lists
of books;
handle requests
Book, Request
Figure 4.4: branch class CRC card
of the nouns has been emphasised. Of immediate interest are the nouns book,
branch, keeper and request. CRC card schema (95)
We now need to translate from the domain entities we have identied to
a UML class diagram. Class-responsibility-collaboration (CRC) is a method for
eliciting and documenting domain classes during analysis Beck and Cunningham
[1989]. Candidate classes are recorded on index cards that can be inspected and
re-organised to elicit the structure of domain relationships.
Figure 4.4 illustrates the format of a CRC card, using the Branch class as
an example. The name of the class is placed at the top of the card. The rest
of the card is divided into sections used to describe the responsibilities of the
class and collaborations with other classes.
Responsibilities can be categorised as:
doing: such as coordinating activity, invoking operations or providing
services; or
knowing: the private data and associations held by instances of the class
or how to calculate to a value.
The class descriptions are documented by hand on CRC cards should be
informal and used for a basis for discussion. As well as recording them on the
card, collaborations can also be visualised by laying out the cards and drawing
lines between them, e.g. on a white board in the teams area. Figure 4.5
illustrates the collaborations between four of the dierent classes identied so
far from the use case description. Finding collaborations
(96) The CRC cards are grouped together to investigate how they collaborate
with one another. Lines are drawn between collaborating classes indicating the
basic structure of the interaction.
64
class name:
responsibilities: collaborations:
Branch
provide lists
of books;
handle requests
Book, Request
class name:
responsibilities: collaborations:
Book
store book
details
class name:
responsibilities: collaborations:
Request
store books
for request
Book
class name:
responsibilities: collaborations:
User
account details
Branch
Request
Book
Figure 4.5: class collaborations
4.4 CRC Cards to UML Class Diagrams
We can now use the CRC cards to begin developing a class diagram. We need
to dene a class with a name, operations and attributes for each of the CRC
cards. The name of the class comes directly from the name on the CRC card.
The attributes and operations can be derived from the responsibilities identied
for the class. Broadly, knowing responsibilities will be represented as attributes
of the class and doing responsibilities will be represented as operations. Figure
4.6 illustrates an initial class diagram containing classes for each of the CRC
cards developed from Figure 4.5.
Notice that much of the functionality is concerned with manipulating the
information we wish to represent about the domain. An initial attempt at estab-
lishing the likely attributes and relationships has been made, however, further
functionality will be added during later design stages as the architecture be-
comes more established. The domain model will also be extended further as
each use case is examined for domain entities. CRC cards to UML
class diagrams (97)
The next step is to rene the collaboration descriptions between the classes.
Currently, the collaborations are denoted by undecorated associations between
the classes, however, this doesnt inform us about the nature of the relationship
in any detail. For example, we havent yet identied how many books can be
associated with a request, or labelled any of the relationships.
Associations between classes can be decorated with multiplicities that denote
the number of relationships between instances of the class during execution of
the system and labels that can be used to describe the relationship. Multiplicities
and labels are placed on one end of an association between classes and should be
read from the remote to the local class. Multiplicities are denoted as discrete,
inclusive number ranges. For example, Figure 4.7 illustrates dierent use of
65
Book
title
author
ISBN
getTitle()
setTitle()
getAuthor()
setAuthor()
getISBN()
setISBN()
Branch
location
getLocation()
setLocation()
getBooks()
getUsers()
addBook()
addUser()
getRequests()
Request
date
addBook()
removeBook()
getUser()
setUser()
User
name
Figure 4.6: UML class diagram of the Branch, Request,User and Book classes
multiplicities and labels for the relationships between classes in the branch library
domain model. The multiplicities can be read as:
a branch can have many books, but a book is associated with only one
branch (a one to many relationship);
a request for books is made by exactly one user (the requester). A user
can make up to ve requests at a time; and
a branch can have many members and a user can be a member of many
branches.
Book Branch
Request User
User Branch
0..* 0..1
0..5 1
0..* 0..*
requester
member
Figure 4.7: UML class association multiplicities
66
identifier identifier:Class :Class
icse_2010:Conference
address="hawaii"
Figure 4.8: denoting class instances (objects) in UML
4.4.1 Instance Diagrams
Modelling instances
(99)
Associations can also be represented between instances of classes. Figure 4.8
illustrates a number of instances, drawn as labelled rectangles. The label can
consist of any combination of object identier and type (identiers go on the
left of the colon, type on the right).
Relationships drawn between objects denote the current associations be-
tween them. If necessary, objects can also be annotated with the state of their
attributes. Figure 4.9 illustrates an instance diagram of one possible state of
the relationship between User and Request show in Figure 4.6. Instance relationships
(100) During object oriented analysis and domain modelling, this can be a useful
method for establishing the constraints to be represented in the class diagram.
Instance diagrams represent a snap-shot of the state of an object oriented system
during execution. Imagine the system has been paused in a debugger. An
instance diagram is a graphical representation of the state information we can
discover about the paused program.
4.4.2 Aggregates and Composites
Class associations can also be decorated to indicate the composition relationship
between two classes.
Aggregation relationships denote that the objects of one class form part
of another. The relationship is illustrated by decorating the association
with an open diamond at the aggregation end. Figure 4.10(a) illustrates
that Branch is an aggregation of Book.
Composition relationships denote that the composites are dependent
:User
surname=Storer
:Request
:Request
:Request
Figure 4.9: an instance diagram of a state of the User-Request relationship
67
Book Branch
0..* 0..1
(a) aggregation
Request User
0..5 1
requester
(b) composition
Book User
0..20 0..1
keeper
(c) directed
Figure 4.10: association relationship decorations
on the composition for their existence - they cannot exist independently.
Destruction of the composition means that the composites must also be
destroyed. The relationship is illustrated by decorating the association
with a lled diamond at the aggregation end. Figure 4.10(b) illustrates
that User is a composition of Request. If a user is removed from the
system their requests for books also cease to exist.
The association between two classes can also have a direction, as shown in
Figure 4.10(c). The direction indicates that only one class has reference to the
other, reducing the coupling between them. Aggregation and
composition
relationships (101)
Now that we know how to denote attributes and relationships, we need to
decide which aspects of the problem domain are which. In general, attributes
are simple data items such as boolean values, numbers or strings. More complex
data types should be represented as classes in their own right. Utility classes
such as dates, colours, coordinates or locales are usually best represented as
attributes because their internal design is not of interest the system design. Distinguishing
attributes from
relationships (102)
Attributes can be derived directly from use cases and the problem descrip-
tion; or from the identication of knowing responsibilities and equivalent op-
erations. Alternatively, the absence of details of the attributes for a class may
indicate that further requirements elicitation activities are required. The initial
analysis does not need to establish the precise representation of an association
as this will be done at the design and implementation stages.
Returning to the class diagram introduced in Figure 4.6, we can now rene
the attributes and relationships with further detail. Figure 4.6 illustrates the
same class diagram with further detail. The association decorations from Figure
4.10 have been added, as well as the multiplicity relationships between the
classes. Revised class diagram
(103) The diagram does raise the question as to whether the attributes identied
for the Request and Branch classes are correct. We have assumed that branches
68
Book
title
author
ISBN
getTitle()
setTitle()
getAuthor()
setAuthor()
getISBN()
setISBN()
Branch
location
getLocation()
setLocation()
getBooks()
getUsers()
addBook()
addUser()
getRequests()
Request
date
addBook()
removeBook()
getUser()
setUser()
User
name
0..* 0..1
0..5
1
0..* 0..*
Figure 4.11: revised UML class diagram of the Branch, Request, User and Book
classes
have a location, but we have not yet decided how to represent this information
in the system. We have also assumed that each request is associated with a date
when it is made, in order to process requests in an orderly manner at the central
library. However, we cant be sure from the current use case descriptions that
this feature is necessary - perhaps requests are too infrequent to be concerned
with ensuring a rst-come rst served ordering of requests. We may need to
investigate these questions by developing a prototype and evaluating it with the
customer.
4.5 Summary
This chapter has reviewed the dierent uses of object oriented modelling for
domain analysis, system design and implementation. The chapter focused on
domain analysis using CRC cards and class diagrams for elicitation and docu-
mentation. We also considered the relationship between requirements elicitation
and the domain model documentation process.
69
4.6 Tutorial
Recall the problem description given in Figure 2.16. By now you should have
developed use cases for the system. For this tutorial: task (104)
1. create a set of CRC cards for the key candidate classes needed to realise
the use cases (you will be provided with some index cards to do this);
2. produce a class diagram showing the class names, attributes, operations
and associations. Try creating two versions of the class diagram. The
rst version should just show the class names and associations between
the classes. The second version should add attributes and operations to
the key domain classes;
3. identify the three most important analysis questions you would want to
answer to improve or validate your domain model.
70
Chapter 5
Modelling Dynamic Behaviour
Recommended Reading
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, eighth edition, 2007.
Section 8.4
Simon Bennett, Steve McRobb, and Ray Farmer. Object Oriented Sys-
tems Analysis and Design Using UML. McGraw Hill, Shoppenhangers
Road, Maidenhead, Berkshire, SL6 2QL, third edition, 2006.
Chapter 9
The Bennett et al. text is more useful for understanding the semantics of
sequence diagrams.
5.1 Introduction
In Chapters 2 and 3 we developed a specication of system behaviour for the
branch library based on a collection of use cases. Use cases are useful for
describing dynamic interactions between actors and the system; a collection of
use cases describe the system interface with the surrounding environment.
In this chapter we will look at a method for extending the models of dynamic
behaviour from use cases into the system itself. To do this, we will need to use
two new types of UML interaction diagram: sequence diagrams which show the
ow of program control between instances in a system over time; and commu-
nication diagrams which show the groups of objects that collaborate during an
interaction. UML diagram types
(106) Figure 5.1 shows sequence and communication diagrams in the context of
all types of dynamic UML diagram. We will use these dynamic representations
of the system to establish a static architectural representation of the branch
library system represented as an object class diagram.
71
sequence
communication
use case
activity
interaction
state chart
dynamic
timing
overview
Figure 5.1: taxonomy of dynamic UML diagram types
We are concerned with modelling the dynamic behaviour of object oriented
systems, which arises from the interactions of object instances, rst introduced
in Chapter 4. Instance diagrams are an intermediate representation between
architectural and dynamic behaviour diagrams. Sequence and communication
diagrams are used to show the ow of control and collaborations between object
instances in a system.
5.2 Sequence Diagrams
Aside from showing the structural relationships between instances at run time,
we also want to be able to denote the ow of program control between ob-
jects. Sequence diagrams can be used to show the passing of messages between
instances over time. Messages on sequence diagrams may represent method
or function invocations, remote procedure calls (RPCs), web service messages,
network packets, or just about any other type of communication.
Figure 5.2 shows a simple sequence diagram for two object instances. Notice
that the object instances have been extended with dashed lifelines that show
time owing vertically down the diagram. The instances have active periods
denoted by a white rectangle on the lifeline. Program control transfers from an
active object to a passive object when a message is passed. Messages have labels
that may be equivalent to a method in the passive object. The passive object
then becomes active and may pass messages to other objects in the system. Messaging sequence
and information ow
(107)
Notice that sequence diagrams are concerned with the ow of control in a
system, rather than information. However, it is possible to annotate message
72
active:Object passive:Object
doYourThing()
doYourThing(arg1:String)
doItAgain(arg3:It)
Figure 5.2: sequence diagram notation
labels with parameters if desirable. In addition, the return of control from the
passive instance to the active instance can be represented by a dashed arrow.
However, in both cases, sequence diagrams can become rather cluttered if these
are always used. Remember diagrams are useful for conveying meaning to a
reader, as well as for literal documentation.
By convention, users and boundary objects are placed on the left of the
diagram, with sequences of interactions proceeding to the right where the inter-
nal instances of the system are represented. Instances which represent external
systems that are part of an interaction are typically placed on the far right of
the diagram. However, there is no requirement that messages are only passed
to the right - it just tends to make the diagrams easier to follow. Invoking sequences
(108) Given that all instances presumably begin life in a passive state, we need to
consider how to invoke sequences. Our model of systems is essentially reactive
to external input, so invocation of a sequence must originate outside the system
(or from a trigger from an internal timer object). Figure 5.3 illustrates the two
ways to denote a use case being invoked.
Figure 5.3(a) denotes a GUI instance being activated by from the search for
book use case. Each invocation from a use case on a sequence diagram should
GUI
s
e
a
r
c
h

f
o
r

b
o
o
k
selectSearch()
(a)
:User
GUI
selectSearch()
(b)
Figure 5.3: invoking sequences
73
:BranchLibrary
:Request
cancel()
:Request
Request()
Figure 5.4: object construction and deletion
be associated with a step in the use cases activity diagram description. In this
case, the rst message, selectSearch is equivalent to the rst step taken by the
actor in the activity diagram which describes the use case. The activity diagram
shows the steps an actor takes during a use case as the system produces output.
The sequence diagram shows how the output from the system for each step is
produced.
Figure 5.3(b) denotes an instance of an actor class invoking a sequence.
Note that this is an instance of the actor classes denoted in the use case diagrams
discussed in Chapter 2 and 3. This is convenient short hand where only a single
actor class is associated with a use case.
Sequence diagrams illustrate dynamic behaviour of instances over their life-
time, so we need to represented object construction and destruction. Figure 5.4
illustrates the notation for construction and deletion of an object in a system.
Construction is denoted by a new message to the object to be instantiated,
which you can think of as a class constructor message. Note that the new
instance appears further down the diagram than others to indicate it is created
later in time than the other objects. Some variants of UML use an explicit
constructor label for instance creation, as shown for the instance in the bottom
right in the diagram. Instance construction
and deletion (109)
Instance deletion is denoted by a bold red cross at the end of the instances
nal active period. Notice that instance deletion is explicit in the UML, unlike
in memory managed OO programming languages, such as Java.
Sometimes it is useful to denote the messages that an instance passes to
itself while it is active, sometimes referred to as self-invocation. Figure 5.5
illustrates the notation for self delegation. A new active period is nested on the
instances existing lifeline just after the point when the self invocation occurs.
The message is drawn from the outer to the nested active period. Although
the instance is not idle, nothing will happen in the outer active period whilst
the nested invocation is active. This is denoted by shading the idle period in a
darker colour. Self
invocation/delegation
(110)
74
:Library
getQueryResult()
printQueryResult()
Figure 5.5: self-messaging in sequence diagrams
:User
:GUI :Branch :LibraryClient
selectSearch()
conn = getConnectionState()
[!conn]
setWarning()
[else]
setOK()
enterQuery(q:String)
searchBook()
searchBooks(q:String)
books
tryConnection()
*[numAttempts]
searchBooks(q:String)
[conn]
Figure 5.6: control structures using guards on sequence diagrams
Be careful when using this notation, as showing every internal message and
indicating all periods of idling will quickly clutter the sequence diagram. Cer-
tainly dont include any messages that will be private members of the instances
class.
The ow of messages on a sequence diagram can be controlled using guards
in a similar way to sequence diagrams. Figure 5.6 illustrates how guards are
associated with messages for both if-else and loop conditions.
The diagram shows the interaction between the Branch instance, and the
component provided by the central library for interacting with their database,
the LibraryClient. The type of connection status message set on the GUI
depends on the result of the getConnectionState() message. If no connection
to the central library is present, the branch library GUI shows a warning. Loop
guards are decorated with a *, as for the tryConnection() message. Control structures
(111) If a guard is not satised then the message wont be sent. Note that this
75
:User
:GUI :Branch :LibraryClient
selectRequest()
selectRequest()
:Request
ref
search books
addBooks()
loop
[more books]
addBook(b:Book)
addBook(b:Book)
confirm()
confirmRequest()
confirmRequest(r:Request)
Figure 5.7: references to other sequence diagrams
means that guards on sequence diagrams refer to the internal state of the system,
whereas guards on activity diagrams refer to actor responses to system output.
In some variants of the UML sequence diagram notation, conditions and
loops are encapsulated in sub-diagram boxes labelled with the guard. This
notation can also be used to illustrate references to other sequence diagrams.
Figure 5.7 illustrates the use of references for the request books use case. References (112)
We know from the use case description that the search books use case is
included in lending books. This arrangement is shown in the diagram by a box
extending across the lifelines of the instances involved in searching for books.
The box is labelled with a reference to the search books sequence diagram,
which we saw in Figure 5.6.
We have assumed so far that when an instance sends a message it waits in
an idle state until a response is received. Similarly, we have assumed that the
time taken to transmit a message from one instance to another is instantaneous.
For method invocations between instances within the same process or run time
these assumptions are probably reasonable.
However, there are many situations where these two assumptions are not
appropriate, if:
messages are to be transmitted across networks in which there is a no-
ticeable delay; or
processing of the message is expected to take the remote instance some
time
it may be more appropriate for an instance to send a message and then
continue processing other tasks while waiting for any reply. Figure 5.8 illustrates
76
:GUI :Branch :LibraryClient :Library
searchBooks(q:String)
mergedResult
searchBooks(q:String)
mergeResults()
searchBooks(q:String)
remoteResult
submitted
searchBooks(q:String)
result
Figure 5.8: asynchronous messaging on sequence diagrams
the use of asynchronous messages on sequence diagrams to denote when an
instance sends a message and continues processing without waiting for a reply.
The diagram is an alteration of the part of the search for books sequence
diagram when the branch library system communicates with the central library. Asynchronous
messaging (113)
An asynchronous message is denoted as an arrow with an unlled arrowhead.
On the diagram, the Branch instance sends an asynchronous message to the
LibraryClient instance for a search to be made for books with the specied
query. Once the message is sent, processing can continue. The Branch instance
proceeds to perform a local search for the books requested that might be held
in the branch. From the diagram, we can infer that the LibraryClient is
responsible for communicating with the central library system from the branch.
The LibraryClient forwards the query to the Library.
We have already seen how to use active periods on instance lifelines to
denote periods of instance processing activity. Messaging delay is denoted by
introducing a vertical gap between a message start and nish. On the diagram,
the asynchronous message from the LibraryClient to the Library, and the
reply is denoted as having a delay, presumably because this communication
occurs over a network, rather than between instances in the same environment.
Once the message is sent, an instance can continue sending other asyn-
chronous messages without waiting for any replies. The LibraryClient passes
another message back to the Branch reporting that the query was successfully
communicated. When the Library instance has processed the query it responds
with a list of books. These books are then merged with the results of a local
search to produce a nal list displayed on the GUI.
Notice that asynchronous messages are not explicitly associated with cor-
responding return messages. Rather, any replies are themselves sent as asyn-
chronous messages in their own right.
The time duration between delays in such a situation can be of concern to
77
:GUI :Branch :LibraryClient :Library
searchBooks(q:String)
mergedResult
searchBooks(q:String)
mergeResults()
searchBooks(q:String)
remoteResult
submitted
searchBooks(q:String){0..2s}
result{0..2s}
{<1s}
{<3s}
Figure 5.9: timing constraints on sequence diagrams
the specication and satisfaction of non-functional performance requirements.
Sequence diagrams can be used to denote both the specication of performance
requirements and the sources of performance problems in system designs. Figure
5.9 denotes the same sequence diagram in 5.8 annotated with timing constraints. Timing (114)
The constraints are shown as measurements annotated with the appropriate
in-equality. From the diagram, we can see that messages to and from the central
library system can take up to two seconds, due to network delay, and processing
of the request can also take up to one second. These limits may be problematic,
since we have specied that the entire sequence of interactions should not take
longer than three seconds for the user.
5.3 Communication Diagrams
Sequence diagrams are useful for denoting the ow of messages between in-
stances over time (in sequence!) as a result of a particular event, which for
our purposes, is typically the invocation of a use case. However, it is dicult
to understand from a sequence diagram how communication between instances
relates to the object-oriented structure of the system.
Communication diagrams are a hybrid of elements from instance and se-
quence diagrams, showing the sequence of messages passed between instances
and the structural relationships that must exist between objects if they are to
collaborate with each other. Figure 5.10 illustrates a communication diagram
which is equivalent to the request book sequence diagram in Figure 5.7. Communication
diagrams (115) Communication diagrams are essentially instance diagrams annotated with
sequences of messages. The messages are shown as arrows parallel to the asso-
ciations between instances. Message identiers are annotated with labels indi-
cating message ordering. Timing information concerning message or processing
delay is not shown on the diagram and generally, more complicated condition
78
structures are also omitted.
Re-drawing sequences as communication diagrams begins to reveal the struc-
ture of the object oriented system we are developing. Drawing associations be-
tween instances that will be present at run time implies that the associations
must also be present between the instance classes. Figure 5.11(a) illustrates a
class diagram developed from the communication diagram in Figure 5.10. Classes (116)
The relationships between the classes generalise the specic example given
on the instance diagram by introducing aggregations, multiplicities and so on.
Notice that the classes dont immediately have any members (attributes or
methods), since weve only identied the types from the sequence diagram.
However, we can add the methods for each class as the messages that are
passed to it on the sequence diagram. Figure 5.11(b) illustrates the full class
diagram with class members added.
It is worth considering the two diagrams a little further here. UML diagrams
used for specication and design of software systems serve two purposes which
can be in conict: a basis for the implementation of the nal system and as a
focus of discussion with customers and users.
In an ideal situation from an engineering perspective, there should be an au-
tomatic transformation from a UML design into an implementation in an object
oriented programming language. When documenting design for this purpose,
diagrams need to be both complete and consistent, including as much detail as
will be necessary to produce the implementation.
However, when using diagrams for discussion, too much detail can obscure
the important aspects of the system that need to be discussed. A customer
will probably not care what the identier is for a particular label, but will be
concerned if the overall system has insucient throughput for their needs. In ad-
dition, it can be useful during discussions to introduce temporary inconsistencies
while points of conict or concern are being resolved.
Referring back to the diagrams in Figure 5.11, we can see that Figure 5.11(a)
is more useful for early stages of the elaboration and construction of our system
:User
:GUI :Branch
:Request
:LibraryClient
:Request
:LibraryClient
2.addBooks
1.selectRequest
3.conrm
3.1.conrm
2.1.addBook
1.1.selectRequest 2.2.addBook
3.2.conrm
Figure 5.10: communication diagram for the request book use case
79
80
GUI
Request
LibraryClient
Branch
(a) labels only
GUI
selectRequest()
addBooks()
confirm()
Request
addBook(b:Book)
LibraryClient
confirmRequest(r:Request)
Branch
selectRequest()
addBook(b Book)
confirmRequest()
Request
addBook(b:Book)
LibraryClient
confirmRequest(r:Request)
(b) with members
Figure 5.11: classes developed from the communication diagram in Figure 5.10
identify classes
and structure
convert to
sequence diagram
detail methods on
class diagram
annotate
associations
use case
description
conceptual class
diagram
methods and
instances
interface class
diagram
Figure 5.12: moving from use cases to architecture
when discussion with the customer is important, while 5.11(b) provides a more
precise basis for implementation by developers, and analysis for inconsistencies
using CASE tools.
5.4 From Use Cases to Architecture
We have now reviewed a range of UML diagram types for modelling dynamic
behaviour. Developing sequence, communication and then a class diagram has
enabled us to translate the functional requirements for the system expressed as
use cases to an initial structural representation of the system to be developed
(recall in Chapter 1 that we were concerned with following rigorous methods for
software development in order to reduce risk). Method (117)
Figure 5.12 documents the method we have been following for developing
architectural class diagrams from use case descriptions. The method begins
by extracting a relatively simple conceptual class diagrams from the use case
descriptions in the specication. Next, sequence diagrams are developed from
the use cases, identifying the instances that are present in the system over time
and the messages that pass between them. These are used to annotate existing
classes with methods and extend the class diagram as new types are discovered.
Finally, the relationships between classes are identied from communication
diagrams of interactions between instances. Lend book use case
(118) We will now illustrate the method on a larger example, taking the collection
of use cases concerning the lending of a book from the branch as a case study.
Figure 5.13 shows an extended version of the use case diagram given in Figure
3.3, explicitly including the common use cases: login, search for books and
search for users. The gure also illustrates the activity diagram for the prin-
cipal lend book use case. The rst step is to develop a conceptual class diagram
of the elements referred to in the use case. Figure 5.14 illustrates this diagram
81
Borrower Keeper
lend book
return book
(to branch)
login
search
for books
search
for users
search
for books
search
for users
Login
Search for book Search for user
Approve loan
is keeper
Figure 5.13: the lend book use case
for the lend book use case, initially consisting of only the Keeper, Borrower,
Book and Branch classes, with a few attributes for each. At this stage we havent
added any methods or associations to the diagram. Conceptual class
diagram (119)
Initial sequence
diagram (120)
Next, we need to model the steps of the use cases in a sequence diagram.
Figure 5.15 illustrates an initial sequence diagram for the lend book use case. So
far, we have only detailed the boundary messages that pass between the Keeper
and the GUI instance (selectLoan, selectBook and confirmLoan), since these
can be directly inferred the specication in the activity diagram. We can also
show the position of the included use cases in the sequence of interactions for
lend book. The diagram also introduces the notation for indicating that two
sequences that occur in parallel for the search books and search user use cases.
This is done in a similar way to references by encapsulating activity in a box,
except that the parallel activities are divided by a dotted line.
The resulting sequence diagram isnt all that detailed. In one sense, this is
encouraging, we have translated the encapsulation of specication details into
the initial stages of design. However, we now need to begin extending the
sequence into the interaction between instances within the system in order to
uncover more detailed aspects of the design.
Initially, we can extend the selectLoan message. To do this, we need to
create a new loan instance for representing the relationship between a book and
Book
title
author
published
Borrower
surname
forename
id
Branch
department
Keeper
surname
forename
id
Figure 5.14: initial conceptual class for the lend book use case
82
83
:Keeper
:GUI :Branch :LibraryClient
selectLoan
selectBook
selectUser
approveLoan
ref
login
ref
search book
ref
search users
par
Figure 5.15: the initial lend book sequence diagram
:Keeper
:GUI :Branch
selectLoan
selectLoan
:Loan
setKeeper(k:Keeper)
Figure 5.16: the selectLoan message
a borrower. This gives us our rst questions: Extending selectLoan
(121)
how are loans to be represented in the system?
what information must be stored about loans?
Figure 5.16 illustrates a rst approach at addressing these questions for the
for the selectLoan sequence. A new instance of the class Loan is created, so
we will need to add this class to the conceptual class diagram. We also set the
Keeper for the loan, since we might need the information later, if for example,
we want to check that the keeper isnt lending out books they dont hold in
their possession.
But hold on, we havent yet established which keeper is making the loan,
which should be the current user. To do this, we will need to create a sequence
diagram for the login use case. We can start this process as before by adding
the boundary interactions between the user and the user interface which are
already documented in the login activity diagram (Figure 3.17).
Next, we will need to explore the internal system interactions which result
from a user submitting a username and password. In particular, we need to
establish how and where user credentials are stored. The requirements document
states that the central librarys database of users must be used to manage users.
Consulting the documentation for the provided LibraryClient class, we discover
that there is a method for retrieving users by username which returns a User class
instance. The LibraryUser class has a method for authenticating a user from
a supplied password. We can now complete the sequence diagram, as shown
in Figure 5.17 by adding the additional messages between the GUI, Branch and
LibraryClient instances. The sequence of interactions is completed by setting
the currently logged in user in the GUI and changing the state of the branch to
logged in. login sequence
diagram (122) Now that weve completed the login sequence diagram, we need to return
to the main lend book sequence. We will need to extend the login reference to
encompass the GUI, Branch and LibraryClient instances. Now that we have
84
85
:User
:GUI
setUserName
setPassword
par
submit
:Branch :LibraryClient
login(un:String,p:String)
login(un:String,p:String)
u
u:LibraryUser
authenticate(p:String)
[u!=null]
auth
loop
[!logged in]
Figure 5.17: the login sequence diagram
:Keeper
:GUI :Branch
selectLoan
selectLoan
:Loan :Loan
Loan(k:Keeper)
[currentUser.isKeeper()]
Figure 5.18: the revised selectLoan message
established who is using the branch system, we also need to check whether the
current user is a keeper, i.e. whether they are entitled to lend books at all.
Figure 5.18 illustrates the selectLoan sequence diagram fragment that reects
these changes. Weve added a guard so that a new loan instance is only created
if the current user is a keeper. Weve also revised the message itself so that the
keeper of the loan is set when the loan is created, rather than via a separate
message. Revised selectLoan
sequence diagram
(123)
However, the diagram now presents us with a problem. We have included
a guard to check whether the current user is a keeper or not. Unfortunately,
a check of the documentation for the User class of the instance returned by
the LibraryClient shows that the central library system doesnt store who are
keepers in the individual branches. This information is going to have to be
stored locally.
Figure 5.19 shows the revised login sequence diagram. Users are authen-
ticated via the LibraryClient instance as before. However, once a user is
authenticated, the LibraryUser instance is used to look up a BranchUser in-
stance within the library. The BranchUser is then set as the currentUser of
the branch. The BranchUser class will be implemented by us, so we can add a
property to test whether the user is a keeper or not. Looking back, we will also
need to add keeper information to the request book sequence diagram in the
same way. Retrieving branch
users (124) Lets return again to the lend book sequence diagram. We have already
developed the search books sequence diagram and the search users diagram
will likely be derivable from the messages sent in search books and login, so
lets turn our attention to the selectUser and selectBook messages. At this
point, we can ask: selectBook sequence
diagram (125)
what happens to a book when it is selected by a keeper for lending?
what checks need to be made before a book is lent?
Selecting a book should allocate that book to the Loan instance we have
86
87
:User
:GUI
setUserName
setPassword
par
submit
:Branch :LibraryClient
login(un:String,p:String)
login(un:String,p:String)
u
u:LibraryUser
authenticate(p:String)
[u!=null]
auth
[auth]
currentUser=getBranchUser(u:LibraryUser)
currentUser
[currentUser!=null]
loop
[!logged in]
Figure 5.19: the revised login sequence diagram
:Keeper
:GUI :Branch :Loan
selectBook
selectBook(b:Book)
setMessage(BOOK_OKAY)
setMessage(BOOK_WARN)
setBook(b:Book)
alt
[bb.getStatus()==BookStatus.KEEPER and bb.getKeeper()==currentUser]
Figure 5.20: the selectBook sequence
:Keeper
:GUI :Branch :Loan
selectBook
selectBook(b:Book)
setMessage(BOOK_OKAY)
setMessage(BOOK_WARN)
alt
[bb.getStatus()==BookStatus.KEEPER and bb.getKeeper()==currentUser]
bb = getBranchBook(b:Book)
setBook(b:BranchBook)
Figure 5.21: the revised selectBook sequence
already created. We need to check that the keeper of the book is the current
user and that the book is currently in their possession. Figure 5.20 illustrates
the selectBook fragment of the lend book sequence diagram that implements
these requirements. The diagram also introduces the use of alt alternative
boxes. These are a convenience when two alternative message sequences can
result from a guard, rather than annotating the guard on each message.
Unfortunately, the sequence diagram introduces a similar problem to the
one we encountered when checking that the logged in user was a keeper. The
documentation for the LibraryBook class shows that the central library does
not provide functionality for tracking the status of books in the branch or who
the books keeper is, so we will have to implement this ourselves as well. We
can remedy the situation in exactly the same way as for the BranchUser by
introducing a BranchBook class. When selecting a LibraryBook to be lent out,
the Branch instance will rst search for the equivalent BranchBook in its records.
Figure 5.21 shows this revised sequence diagram.
This raises another question concerning the requirements: Revising the
requirements
specication (126)
should book search results be optionally ltered by keeper and/or status?
Doing this would save the keeper from having to try each book returned
in a search. At the very least we should add a note to the search books use
case description indicating that this would be desirable. We can now see how
requirements specication may be altered as the design of a system proceeds,
as discussed in Chapter 1.
We are now ready to complete the lend books sequence diagram by lling in
the detail for the approveLoan message sequence. Figure 5.22 shows the com-
88
plete sequence diagram for lending books, including all the sequence fragments
we have developed so far. To complete the loan sequence the return due date
is added to the Loan instance. Complete sequence
diagram (127) We can now represent the collection of messages that we have developed on
a communication diagram. Figure 5.23 illustrates the communication diagram
for all the sequence diagrams developed so far. Notice that we have aggregated
all the messages from dierent sequence diagrams. The communication diagram
shows the general ow of messages between instances. Communication
diagram (128) Notice that multiple sequences are can be collated onto a single the commu-
nication diagram to show the overall structure of collaborations in the system.
Collating all sequences onto a single diagram is a good way of:
revealing the overall set of pairwise collaborations between instances, giv-
ing an indication of the relationships between components and the extent
of coupling in the system. We can see from Figure 5.23 that the Branch
instance has been revealed as a central component in the architecture of
our system;
identifying components that may need to be divided into several smaller
components during structural design activities. Instances that receive a
large number of messages for dierent use cases should probably be broken
down into smaller components later in the design process.
Note that collation onto a single diagram also tends to obscure the structure
of message ow. This isnt necessarily a bad thing, since sequence diagrams are
better at representing message ow. Rene the class
structure and detail
(129)
Weve added quite a few new instance classes to the system design, which
need to be added to the class diagram we began in Figure 5.14. In addition,
some instance classes have been replaced, as we have discovered more about
the functionality provided by the LibraryClient component. Figure 5.24 illus-
trates the extended class diagram for the use cases we have investigated so far.
The diagram shows the messages identied on the communication diagram as
methods of the receiving classes. Weve also identied the associations between
classes, in particular the relationship between the Branch and the collections of
BranchBook, BranchUser and Loan instances it maintains.
Despite the work we have done, the architecture of the system remains
incomplete and relatively unrened. Sequence diagrams need to be developed
for the other use cases we have identied. The next chapter covers methods for
improving the initial structure of the system developed so far.
5.5 Summary
We have reviewed the use of interaction diagrams for modelling the dynamic
behaviour of object oriented systems. Sequence and communication diagrams
89
90
:Keeper
:GUI :Branch :LibraryClient
selectLoan
selectBook
selectUser
approveLoan
ref
login
selectLoan
:Loan
Loan(k:Keeper)
[currentUser.isKeeper()]
ref
search book
selectBook(b:Book)
bb = getBranchBook(b:Book)
setBook(b:BranchBook)
setMessage(BOOK_OKAY)
setMessage(BOOK_WARN)
alt
[bb.getStatus()==BookStatus.KEEPER and bb.getKeeper()==currentUser]
ref
search users
setBorrower(b:BranchUser)
setBorrower(b:BranchUser)
setBorrower(b:BranchUser)
setDueDate(d:Date)
[loan.getBook()!=null and loan.getBorrower()!=null]
par
Figure 5.22: the complete lend book sequence diagram
:User
:GUI :Branch :LibraryClient
:Request
:Loan
:LibraryUser
1.selectRequest
2.addBooks
3.confirm
4.selectLoan
5.selectBook
6.selectUser
7.approveLoan
8.selectSearch
9.enterQuery
10.searchBook
11.setUserName
12.setPassword
13.submit
1.1.selectRequest
2.1.addBook
3.1.confirm
4.1.selectLoan
8.1.getConnectionState
10.1.searchBooks
13.1.login
6.1.selectBook
6.1.3.1.2.setMessage
6.1.3.2.2.setMessage
2.2.addBook
4.1.1.Loan
4.1.2.setKeeper
6.1.3.1.1.setBook
3.2.confirm
8.1.1.tryConnection
10.1.1.searchBooks
13.1.1.getUser
13.1.2.authenticate
Figure 5.23: extended communication diagram
together can be during the transition from the elaboration to construction phase
of an RUP iteration. Following the method we reviewed above allows us to derive
system architecture in the form of a class diagram from a system specication
in the form of use diagrams and descriptions. Remember, use cases and activity
diagrams describe the dynamic behaviour of actors with systems. Sequence and
communication diagrams describe dynamic behaviour within systems as a result
of external interaction.
91
92
G
U
I
s
e
l
e
c
t
R
e
q
u
e
s
t
a
d
d
B
o
o
k
s
c
o
n
f
i
r
m
s
e
l
e
c
t
L
o
a
n
s
e
l
e
c
t
B
o
o
k
s
e
l
e
c
t
U
s
e
r
a
p
p
r
o
v
e
L
o
a
n
s
e
l
e
c
t
S
e
a
r
c
h
e
n
t
e
r
Q
u
e
r
y
s
e
a
r
c
h
B
o
o
k
s
e
t
U
s
e
r
N
a
m
e
s
e
t
P
a
s
s
w
o
r
d
s
e
t
U
s
e
r
(
u
:
B
r
a
n
c
h
U
s
e
r
)
s
u
b
m
i
t
s
e
t
M
e
s
s
a
g
e
(
m
:
S
t
r
i
n
g
)
B
r
a
n
c
h
d
e
p
a
r
t
m
e
n
t
:
S
t
r
i
n
g
s
e
l
e
c
t
R
e
q
u
e
s
t
(
)
a
d
d
B
o
o
k
(
b
:
B
o
o
k
)
c
o
n
f
i
r
m
R
e
q
u
e
s
t
(
)
s
e
l
e
c
t
L
o
a
n
(
)
g
e
t
C
o
n
n
e
c
t
i
o
n
S
t
a
t
e
(
)
:
b
o
o
l
e
a
n
s
e
a
r
c
h
B
o
o
k
s
(
q
:
S
t
r
i
n
g
)
:
L
i
s
t
<
B
o
o
k
>
l
o
g
i
n
(
u
n
:
S
t
r
i
n
g
,
p
:
S
t
r
i
n
g
)
s
e
l
e
c
t
B
o
o
k
(
b
:
B
r
a
n
c
h
B
o
o
k
)
s
e
t
B
o
r
r
o
w
e
r
(
b
:
B
r
a
n
c
h
U
s
e
r
)
a
p
p
r
o
v
e
L
o
a
n
(
)
B
o
o
k
t
i
t
l
e
a
u
t
h
o
r
p
u
b
l
i
s
h
e
d
L
i
b
r
a
r
y
C
l
i
e
n
t
c
o
n
f
i
r
m
R
e
q
u
e
s
t
(
r
:
R
e
q
u
e
s
t
)
t
r
y
C
o
n
n
e
c
t
i
o
n
(
)
:
b
o
o
l
e
a
n
s
e
a
r
c
h
B
o
o
k
s
(
q
:
S
t
r
i
n
g
)
:
S
e
t
<
B
o
o
k
>
g
e
t
U
s
e
r
(
u
n
:
S
t
r
i
n
g
)
:
L
i
b
r
a
r
y
U
s
e
r
B
r
a
n
c
h
B
o
o
k
g
e
t
S
t
a
t
u
s
(
)
:
B
o
o
k
S
t
a
t
u
s
g
e
t
K
e
e
p
e
r
(
)
:
B
r
a
n
c
h
U
s
e
r
B
r
a
n
c
h
U
s
e
r
i
s
K
e
e
p
e
r
(
)
:
b
o
o
l
e
a
n
L
i
b
r
a
r
y
U
s
e
r
s
u
r
n
a
m
e
f
o
r
e
n
a
m
e
i
d
a
u
t
h
e
n
t
i
c
a
t
e
(
p
:
S
t
r
i
n
g
)
:
b
o
o
l
e
a
n
L
o
a
n
L
o
a
n
(
k
:
K
e
e
p
e
r
)
s
e
t
B
o
o
k
(
b
:
B
r
a
n
c
h
B
o
o
k
)
s
e
t
K
e
e
p
e
r
(
k
:
B
r
a
n
c
h
U
s
e
r
)
R
e
q
u
e
s
t
a
d
d
B
o
o
k
(
b
:
B
o
o
k
)
s
e
t
K
e
e
p
e
r
(
k
:
B
r
a
n
c
h
U
s
e
r
)
Figure 5.24: revised class diagram extended with method names
5.6 Tutorial
This tutorial provides practice in constructing sequence and communication dia-
grams from an initial set of use cases and a conceptual class diagram. Remember
- the construction of sequence diagrams may reveal necessary changes to the
use cases.
Recall the scenario described in Figure 2.16, describing a system for manag-
ing museum tours. You should by now have been provided with a sample solution
of the use cases and developed a domain model using the CRC method. Task (130)
Using Umbrello or StarUML, construct a:
a sequence diagram and a communication diagram to show an implemen-
tation of create tour; and
a sequence diagram and a communication diagram to show an imple-
mentation of assign guide to tour, assuming that at least one guide is
available to take the specied tour
by following the method described in this chapter for constructing interaction
diagrams from use cases.
93
94
Chapter 6
Prototyping
Recommended Reading
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, eighth edition, 2007.
Chapters 17 and 18
6.1 Introduction
What is a prototype?
(132) Prototype development typically occurs during the early stages of a software
development project (during elaboration and construction in RUP), when there
is uncertainty associated with some aspect of a systems requirements or design.
Prototypes are small projects within a longer term software development process,
which implements a part of the complete functionality required for the nal
system. Prototypes typically need to be developed and evaluated rapidly, so the
resulting build quality and broader non-functional requirements are relaxed. The
outcomes of the project are usually (but not always) not the prototype itself,
but a better understanding of the system to be delivered.
6.2 Why prototype?
Why prototype? (133)
There are several related reasons for producing a prototype, listed in Table 6.1.
In each case, the underlying reason for developing a prototype is to expend
a relatively small amount of eort in order to manage risk associated with a
project caused by some uncertainty.
Developing a demonstrator can be useful in assessing whether a proposed
business case really does oer value to an organisation.
Using prototypes during walkthroughs can help resolve ambiguity or incon-
sistency in requirements demanded by one or more stakeholders. As discussed in
Chapter 2, customers often nd discussions of how a system should work easier
95
96
as a demonstrator a prototype can be used during the early stages of a
project (initiation in RUP) to support a proposed
business case
support
requirements
gathering
prototypes, particularly of user interfaces, can be
incorporated into walkthroughs of scenarios.
Customers and users can interact with a proposed
solution, identify deciencies and propose changes
investigate the
feasibility of
requirements or
design
a prototype can be helpful in establishing the
feasibility of requirements or proposed design
solutions. A rapidly developed prototype may be
useful for showing that a particular requirement can
or cannot be achieved before too many resources are
invested in the main development
experiment with
new technologies
a prototype can be useful for assessing the feasibility
of adopting a new technology to solve a part of the
design problem for a system, or to understand a
problem with an unfamiliar technology that has
already been incorporated into the system
as the main
development for
a project
successive prototypes may be the central focus of a
software development process, if many parts of the
project are poorly dened
Table 6.1: purposes of prototyping
than a more abstract discussion of what a system should do. When require-
ments or design solutions are proposed it may be dicult to determine whether
they are feasible, so a prototype can be developed before excessive resources are
committed to an infeasible solution.
Prototypes are also useful for experimenting with new technologies to be
incorporated in a project. The experiment can take the form of an investigation
of the features and capabilities of competing equivalent products, or in order
to resolve a problem concerning an already selected technology. In both cases,
developing a prototype should reduce the uncertainty of working with the new
technology without expending excessive resources.
Finally, prototyping may be adopted as the core software development pro-
cess for the main product itself. This approach carries considerable risk, but may
be necessary when the scope of the intended project is intrinsically uncertain. Example: branch
library system (134) A prototype can be developed to address more than one type of uncertainty
at a time. For example, we could develop a prototype featuring the following
subset of use cases for the branch library system: request book, process request,
record book receipt. The prototype could then be used to:
check that the branch library system will be of benet to members of sta
in the local departments (demonstration);
validate the revised approach for managing books in a distributed branch
with the central library;
evaluate a web-based platform for hosting the system (evaluation); and
as an initial iteration of the project.
6.3 The Prototyping Process
The prototyping
process (135)
Figure 6.1 illustrates the general process for developing a prototype alongside
a longer term project. The overall intention is that some aspect of the main
project should move from being assessed as high to low risk. Initially, a high risk
aspect of the project is identied which represents some uncertainty concerning
the intended systems requirements or design. A decision is made to investigate
the uncertainty by developing a prototype, leading to an initial set of objectives
being identied. The scope of the prototype (how much of the features of the
nal system will be implemented) is then identied, within the context of the
overall budget for the project. The scope of the prototype should be constrained
to minimise the resources expended on development.
Prototype design and implementation occurs rapidly, with less consideration
for software architecture. Once the prototype has been designed and imple-
mented, it is evaluated to determine whether the objectives have been satised.
This may lead to the prototype or scope being altered, or alternatively, the objec-
tives themselves may be revised (uncertainty from the project will aect all three
97
decide objectives
dene prototype
scope
design and
implement
evaluate
acceptable?
high
risk
low
risk
main project
time
Figure 6.1: overview of the prototyping process
aspects). Finally, if the objectives are satised, a report is prepared describing
the outcomes of the project and how these address the original uncertainty that
was identied as high risk.
6.4 Approaches to Prototyping
The specic types of prototyping are now discussed in more detail with respect
to the general process in Figure 6.1.
6.4.1 Throw-Away Prototypes
Throw away prototypes are developed in order to to resolve uncertainties about
some aspect of the project, for example:
what should the requirements for the system be?
is the current requirements set feasible within the current budget and
schedule?
how should the system be designed?
Figure 6.2 illustrates the throw-away prototyping process. The objective
for a throw-away prototype is to resolve uncertainty concerning the project, so
the rst step is to formulate the questions to be answered. The prototype is
scoped, designed and implemented as before. The prototype is evaluated with
respect to the original questions asked. If the uncertainties have been resolved,
a report is prepared describing the lessons learned during the process and the
98
decide objectives
dene prototype
scope
design and
implement
evaluate
acceptable?
high
risk
low
risk
main project
time
decide questions
to answer
asking the
right
questions?
questions
answered?
lessons
learned
Figure 6.2: overview of the throw away prototyping process
implications for the main project. Alternatively, the outcome of the evaluation
may show that the uncertainty has not been satisfactorily addressed, so further
prototyping may be undertaken, or the questions to be answered may be revised. Throw-away
prototyping process
(136)
Prototypes can be a useful focus of discussion during scenario walkthroughs
with clients, making abstract questions concerning the system requirements
more concrete. Clients often have a pre-conception of what sort of system is to
be built, as this is easier to formulate than the exact problem they expect the
system to solve. Developing a prototype can help the client make these ideas
explicit, by presenting them with a concrete example of a solution and then
asking them to describe how they would like to change it. Abstract questions
such as: Prototypes in
requirements
gathering (137)
What is the workow for this use case?
can be rephrased as:
Is the workow like this? How do you want to change it
It isnt necessary to present a complete system during requirements gather-
ing, with the focus instead being on the functionality relevant to the questions
to be explored. Functionality can even be faked by, for example, only provid-
ing output for the inputs specied in the documented scenarios. Alternatively,
a Wizard of Oz interaction can be adopted, in which the inputs are processed
manually and passed back into the user interface. Care should be taken not to
over sell the capabilities of the nal system to the client based on the appar-
ent features of the prototype. In particular, avoid including features that wont
appear in the next iteration of the nal system.
99
A throw away prototype should not normally be used in a production system,
because: From prototypes to
production (138)
the design will not have been developed with consideration for the inte-
grating with wider system;
the architecture will become hacked in order to demonstrate extra fea-
tures during revisions;
system non-functional requirements will have been relaxed, or even com-
pletely ignored;
wider project quality assurance standards and conventions will have been
relaxed;
the design will not have been developed for re-use in other contexts; and
documentation will be of low quality, or non-existent.
Instead, prototypes are often re-developed once criteria is established, with
the lessons learnt from the throw-away prototype applied to the component of
the nal system. Outputs from prototyping should still be retained as a part
of the documentation for the main software project to support traceability of
requirements. The outcomes of a prototyping project represent the justication
for revising the requirements specication or a design decision.
Prototypes can also be useful during testing of components or systems with
well dened inputs or outputs, particularly if a test suite is developed for the
prototype. In principle a production system should have the same outputs as
the earlier prototype for any given input, so a prototype can be used as a test
oracle for the production system (sometimes called a reference implementation). Throw-away
Prototypes in Testing
(139)
Figure 6.3 illustrates this process. Input from the prototype test set is passed
to both the prototype and the production system. These resulting outputs are
then compared and a report is produced describing any dierences. Dierences
between outputs between the two implementations should be investigated and
resolved - the cause could be a defect in either implementation.
6.4.2 Evaluating New Technology
As discussed in the previous section, many software products are based on ex-
isting frameworks which provide the core functionality, encouraging software
re-use. Table 6.2 describes a number of popular frameworks (the range of
frameworks is constantly evolving). Evaluating new
technology (140) The use of new or unfamiliar (to the development team) technologies rep-
resents two sources of uncertainty (and hence risk) to a software project:
100
101
prototype test set
(input)
prototype
production
system
output
comparison
dierence report
Figure 6.3: using prototypes during testing
Common Object
Request Broker
Architecture
(CORBA)
is a specication for messaging passing between
distributed services, implemented in a number of
languages including Java and C.
Knopersh implements the OSGi component management
specication
Apache Axis a suite of tools and libraries for implementing web
services as specied by teh Web Service Denition
Language(WSDL), including a SOAP
2
protocol
library
Globus developed as a toolkit for deploying Grid computing
applications. The fourth and fth versions of globus
Web Service Resource Framework (WSRF)
Java Messaging
Service
communication occurs between components by
allocating messages to queuess, which are then
accessed and processed by other components
Table 6.2: a selection of software frameworks
it can be dicult to select an appropriate framework from a range of
competing products, each developed around a number of (often implicit
and hidden) assumptions;
it may be unclear how to implement a particular feature or technique
in a chosen software project, or resolve a deciency identied with the
framework.
A prototype development which uses the new technology can help address
both of these issues, without diverting too many resources from the main de-
velopment eort. A prototype project can be used:
to evaluate a number of competing products, by implementing a small
number of key features for the main system on each of the candidate
platforms
to isolate and resolve defects in a software system; and
for developer training.
Figure 6.4 illustrates an example of using a prototype to resolve a defect
identied during the development of the BranchClient component, supplied for
the branch library system. The defect was identied during preliminary testing
of the search books use case. Some documents are held electronically by the
library (PhD and MRes theses, for example), so it was decided these would be
directly retrievable via the branch library system. The electronic documents are
stored in a MySQL
3
database. A developer noticed that not all of the electronic
documents were being downloaded to the users machine. Evaluating new
technology (141) The development process follows the same structure as for other prototype
projects. To identify the cause of the defect, a prototype was developed which
uses a shell client to the DBMS to upload a series of les directly (isolating the
DBMS from the branch application). Inspection of the database and the DBMS
logs revealed that some of the les were not uploaded because they are bigger
than the default maximum packet size for the database (16mb). To remedy
the problem, a recommendation was made that the maximum packet size is
doubled.
6.4.3 Proof of Concept
A prototype can also be useful for demonstrating the feasibility of a new concept
or idea. Proof of concept demonstrators are often used to investigate speculative
features for a new system or as part of research projects. The outcomes from the
process provide insights into the benets and risks of a potential investment dur-
ing the early stages (initiation phase in RUP) of a software development project.
3
http://www.mysql.com
102
decide objectives
dene prototype
scope
design and
implement
evaluate
acceptable?
high
risk
low
risk
main project
time
why are web application
attachments not being uploaded
into the database?
application which uploads a series
of attachments with dierent
sizes, formats etc.
implement as a shell script using
MySQLadmin client, inspect
system logs.
MySQL connection packet sizes
are set to 16MB by default.Some
attachments are larger than this.
set max packet size to 32mb
acceptable?
Figure 6.4: prototyping process for evaluating new technology
In some cases, the prototype can provide a basis for further development. For
example, the management of the branch library system project might choose to
deploy a single branch library system in one department, before committing all
the resources necessary for a university wide system.
6.4.4 User Interface Prototyping
User interfaces present a particular problem for requirements gathering because
the specication for the design can be dicult to express. In addition, the
development of rich user interfaces can be extremely time consuming for a
development project
4
.
Prototyping of user interfaces is a natural solution to this problem, and
it can also be used to represent the functionality of the underlying system.
There are a variety of CASE tools available for developing a prototype user
interface, particularly graphical user interfaces, such as the NetBeans IDE
5
for
developing Java swing user interfaces, Microsofts Visual Basic programming
language
6
for developing Windows applications and Adobes Dreamweaver
7
for
web applications. A screen shot from a NetBeans development in shown in
Figure 6.5. CASE Tools for UI
prototyping (142) Developing a graphical user interface using a CASE tool may mean that
the client is able to make changes to the layout and functionality themselves.
Recording these changes can help to understand the clients mental model of the
4
in my (highly limited, subjective) experience of projects it can consume well over 50% of
resources
5
http://www.netbeans.org
6
http://msdn.microsoft.com/en-us/vbasic
7
http://www.adobe.com/products/dreamweaver
103
Figure 6.5: the netbeans GUI designer
underlying functionality of the system, because the changes may be a reection
of how the client believes the system functions, or should function.
Depending on the CASE tool, the prototype user interface may eventually
be developed into the user interface for the nal product. However, using CASE
tools to develop user interfaces can mean that the user interface code is poorly
structured and doesnt relate well to the functions of the underlying system.
This can make maintenance costs for alterations to the user interface more
costly later on in a project.
6.4.5 Rapid Application Development (RAD)
Many business processes are primarily collecting, processing and analysing data.
Automation of such processes often results in an information system
8
with a
recognisable structure:
a data model of the information to be managed;
a functional layer for editing data and generating reports; and
a user interface for entering data and presenting reports.
The common architecture of this class of systems mean that much of the core
functionality can be pre-dened in a software framework or platform, consisting
of:
a database management system (DBMS) congured for the required data
model, and supporting a query language, typically some avour of Struc-
tured Query Language (SQL);
8
there are far broader denitions of information systems which encompass pre-digital elec-
tronic information processing technology.
104
a report generator links to oce applications and CASE tools
a GUI builder for designing and implementing the user interface; and
a fourth generation programming language (4GL) for constructing appli-
cations.
Rapid Application Development (RAD) is a software development method
which exploits the characteristic features of information systems in order to
reduce software development eort Martin [1991]. The system is developed
iteratively as a series of prototypes. The system is within a software framework,
so the overall amount of source code to be written should be reduced because
much of the core functionality is pre-provided. In addition, RAD encourages
software re-use (and design for re-usability) so new components developed for
one project should be available for others.
Since much of the core functionality of the system is pre-determined, re-
quirements processes for RAD instead focus on:
understanding current business processes;
establishing the data model for the underlying system;
the information needs of the various users (and who supplies it); and
the necessary organisational changes to t the new system.
More recently, Enterprise Resource Planning (ERP) platforms such as SAP
9
,
Oracle E-business Suite
10
or SAGE
11
and web application frameworks such as
Ruby on Rails
12
(for the Ruby language) or CakePHP
13
have been promoted
for developing applications in a similar way to RAD. An ERP framework vendor
may also oer consultancy services for the conguration of the framework for
a clients application, rather than just selling the framework itself. The vendor
may also oer to train and accredit developers to work on their framework with
other clients.
Since much of the functionality for these systems has already been im-
plemented by the vendor, development focuses on conguring and tuning the
selected components for the target organisation. The term conguration engi-
neering or construction by conguration has been used to describe this process
Sommerville [2005].
The constraints imposed by RAD methods means that there are several
trade-os for development and associated risks:
9
http://www.sap.com
10
http://www.oracle.com/us/products/applications/ebusiness
11
http://http://www.sage.com/
12
http://www.rubyonrails.org/
13
http://www.cakephp.org/
105
code is cheaper to development, but may be less ecient. For exam-
ple, the framework may not implement the most ecient algorithms for
performing a pre-dened processing task;
functionality is quicker to generate, but underlying code may be poorly
structured, increasing maintenance costs;
re-engineering applications for a dierent platform may present challenges.
This can cause vendor lock in for the client, preventing eective compe-
tition for services; and
an organisation may struggle to adapt to the new system; Frameworks
have to be designed with at least some minimal assumptions about how
any organisation functions. These assumptions may not t the culture of
a particular organisation.
6.4.6 Incremental Prototypes
In some cases, the requirements for a system may be so poorly understood
that the only way to make any progress is to adopt prototyping as the main
focus of development eort. This approach is common in many research en-
vironments, where the expected result of the development activity is unknown
and the primary outcome is new knowledge, rather than the software itself. In
these situations, the software is developed in a number of prototype iterations,
and the specication is rened gradually each time as the requirements become
better understood.
Incremental prototyping does carry risks, not least because it can be used as
a justication for low quality software development processes. A consequence
of a continually changing application is that the overall structure may not be
maintained, making long term maintenance and future changes more costly, as
well as making non-functional requirements harder to implement and defects
harder to identify and remove.
In addition, as the software base becomes larger and more complex, it may
be necessary to initiate a number of iterations in parallel, making change man-
agement more complex. As a consequence, documentation and other accompa-
nying artefacts (such as test suites) may not be maintained, or abandoned all
together. Eventually, the entire system may need to be re-implemented anyway,
costing much of the supposedly saved eort and resources.
Many agile software development methods advocate disciplined software
practices to address the risks associated with software quality of incremental
prototyping. Section 7.7 describes the Extreme Programming software develop-
ment process and associated practices.
106
requirements outcomes
throw-away
high risk, poorly
understood
requirements
executable prototype;
better understanding of
requirements
incremental
well understood, low
risk requirements
application for end user
Figure 6.6: throw-away vs incremental prototyping
6.5 Summary
Software prototyping can be used for a variety of purposes in a software develop-
ment process, from resolving a short term uncertainty to adoption as the main
development activity itself. Figure 6.6 contrasts these two extremes in terms of
the approach to risk management and the resulting outcomes. Throw-away vs.
Incremental (143)
Throw-away prototyping addresses the highest risk, poorly understood re-
quirements for a software project rst, with better understood requirements
implemented in the main software development process. The outcome is po-
tentially a executable prototype, but more importantly the lessons learned for
the prototyping process. Incremental prototyping addresses the well understood
requirements for a software project rst, since these should be the cheapest to
implement in the initial version. Higher risk requirements should become better
understood ,as more functionality is added to the prototype in successive itera-
tions. The outcome of incremental prototyping is the system to be delivered to
the end user.
Prototyping approaches can also be dierentiated by their longevity, as il-
lustrated in Figure 6.7. The longevity of the prototype should be reected in
the eort and resources devoted to the quality during the prototyping process. Longevity of
prototypes (144)
Throw-away prototypes have very short life-cycles as the prototypes them-
selves are far less important than the lessons learned from the prototyping pro-
cess. Demonstrators are often anticipated to be short-lived artefacts, but may
time
short long
throw-away
demonstrator/
proof of concept
incremental
evaluation user interface
Rapid Application
Development
Figure 6.7: longevity of dierent types of prototype
107
go on to be part of a software project for a period of time, at least until there
is opportunity to re-implement the software following more rigourous develop-
ment standards. The rst steps during elaboration and construction phases of
a project based on a demonstrator may be to engage in a period of cleaning
up the architecture and code base before further features are added.
User interfaces can be developed most eectively with the involvement of
the client as a series of prototypes. Finally rapidly developed incremental pro-
totypes form the basis of the main software project, so last as long as it does.
This approach to software development implies considerable risk, that can be
managed to some extent by adopting disciplined practices from agile methods. Key Point (145)
108
Chapter 7
Advanced Software Process
Models
Recommended Reading
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, ninth edition, 2010.
Chapter 3
Ivar Jacobson, Grady Booch, and James Rumbaugh. The Unied Software
Development Process. Object Technology Series. Addison Wesley, One
Jacob Way, Reading, Massachusetts 01867, 1999.
a complete guide to the software process by the original authors.
Kent Beck and Cynthia Andres. Extreme Programming Explained. XP Se-
ries. Addison Wesley/Pearson Education, second edition, February 2005.
http://www.extremeprogramming.org
7.1 Introduction
Recall the waterfall model of software development introduced in Chapter 1
and illustrated in Figure 1.5. The model describes a collection of activities
undertaken successively by a software development team that collectively result
in a software product. The key activities during software development are the
specication of requirements, development of the product, validation of the
product against the requirements and then subsequent evolution. The features
of a software development process can be discerned from the associated artefacts
that are produced along the way. These include:
the problem denition and requirements specication document;
109
design documentation, including architectural models, behaviour descrip-
tions and prototyping reports;
test plans and schedules;
software components and the complete system;
acceptance test reports; and
user and maintenance documentation.
Adopting a software process model helps a project manager to control de-
velopment eorts by their team and therefore manage the risks aecting the
project. The waterfall model addresses risk through: Waterfall: risk
management (147)
monitoring progress to project milestones;
planning the entire project schedule before resources are committed;
top-down specication, design and implementation; and
compartmentalised work eorts.
However, there are limitations to approaching software development in this
way: Whats wrong with
the waterfall model?
(148)
requirements elicitation must be idealised;
high risk problems are deferred until late in the life cycle;
later identication of mistakes in earlier activities causes feedback; and
the eort and resources required for evolution are under-emphasised.
We have already seen how it is often easier to make progress during re-
quirements gathering if clients are presented with an early possible solution in
the form of a prototype. Strictly following the waterfall model makes this dif-
cult, because design and development of solutions should not begin until the
requirements document is complete and signed o.
Adopting the waterfall model also means that risks associated with the later
stages of the life-cycle cannot be addressed at all until earlier activities are
complete. A considerable amount of eort may be wasted on establishing a
mature requirements specication that cannot be implemented, for example.
Acceptance testing late in a project may uncover mismatches between the re-
quirements specication document and what the client really wanted.
Feedback occurs because of attempts to address the two problems described
above. Changes must be made to the project documentation as mistakes are
uncovered during design, development and acceptance testing. In principle,
110
problem denition
requirements
analysis &
specication
design
implementation
verication &
validation
delivery &
operation
evolution &
maintenance
problem statement
specication document
system design document
deployable software product
acceptance test report
deployed or distributed product
Figure 7.1: the waterfall SDP with feedback
further work will need to be suspended until the changes have worked their way
through the process to the latest activities and the revised milestones signed
o. Figure 7.1 illustrates the waterfall model with this eect. Each activity now
has an upward owing arrow, illustrating the potential for later development to
require changes to earlier artefacts. Feedback in the
waterfall process
(149)
For example, should acceptance testing reveal a missing must have feature
for the system, this will need to be added to the requirements document. The
design and implementation will then need to be updated to contain the feature
and the acceptance test re-started. In practice this either means that the project
ends up looping endlessly without making real progress, or the documentation
for the project becomes increasingly out of date.
Many software projects do not begin from an empty code base, but occur
as the evolution of a part of a larger system, either to x defects or to add new
features. Varying estimates of maintenance eort range from 65% to 75% of a
software projects resources. Figure 7.2 shows that all of the previously described
activities for a software engineering project (problem denition, requirements
specication and so on) may occur during the software evolution phase. Software evolution
(150)
Projects of this type have been categorised as browneld developments, anal-
ogous to a project occurring in the construction industry on land that has already
been occupied by previous buildings (the opposite type of project is green eld)
[Hopkins and Jenkins, 2008]. Browneld construction projects are constrained
by the presence of legacy artefacts from the previous construction, for example
infrastructure (water, gas or sewage pipes, electricity or communication cabling)
or old foundations. These artefacts may be expensive or impossible to remove
or relocate, or may disrupt services to other buildings in the locality, so the new
111
evolution &
maintenance
problem denition
requirements
specication
design
implementation
verication &
validation
delivery &
operation
Figure 7.2: a close up view of the software evolution activity
building on the browneld site must be designed to accommodate them. Browneld (151)
The analogy transfers neatly into the domain of software engineering. The
presence of pre-existing legacy software infrastructures constrains the develop-
ment and future evolution of components. Even worse, other projects may be
occurring simultaneously that cause other parts of the legacy infrastructure to
evolve as well!
7.2 V-Model
We need to investigate some alternatives that better address the risks aecting
software projects, given the limitations we have identied in the waterfall model.
One limitation of the waterfall model is that is defers management of high
risk requirements uncertainty (i.e. what does the client really want) until late
in the software life-cycle during acceptance testing. The v-model of software
development is an adaptation of the waterfall model that emphasises verication
and validation activities during the software life-cycle. Verication and valida-
tion (V&V) are given particular denitions in the ISO 9000 quality management
system
1
: Verication and
validation (152)
verication is the process of ensuring that technically the development is
progressing correctly. All deliverables should be checked both for internal
consistency and conformity with previous deliverables.
validation is the process of ensuring that the product being developed is
what the user wants.
1
http://www.iso.org
112
business analysis
user
requirements
system design
component
design
implementation
(coding)
component
testing
system testing
acceptance
testing
review/
evaluation
validate
verify
decompose
into more
detail
assemble
into larger
components
Figure 7.3: the V software development model
So, verication activities are used to determine if we are building the product
right, i.e. does the complete product satisfy the formal requirements specica-
tion. Validation activities ask the broader question of whether we are building
the right product for the customer, regardless of what the formal requirements
specication document says.
Figure 7.3 illustrate the V-model of software development with (V&V) ac-
tivities made explicit during the software life-cycle. The model is a waterfall,
but shaped as a V, with development activities on the left hand side and V&V
activities on the right. Development begins in the upper left hand side of the
model with the analysis, requirements specication, design and implementation
activities already discussed. The development proceeds by decomposing the
development problem into ner levels of granularity. V-model (153)
Each of these activities is matched by a V&V activity on the right hand side
of the V. Component and system designs are veried during unit and system
testing to demonstrate that the system satises its specication. As the system
is assembled into larger units, validation activities are undertaken. Note that the
V-model approach requires test plans to be developed alongside each stage of
development. V&V activities are then managed using the previously developed
plans.
7.3 Spiral Model
Although the V-model makes the relationship between development and V&V
processes explicit, the risks associated with uncertain requirements may still be
unaddressed until relatively late in the software life-cycle.
The spiral model is a semi-iterative software development process framework
proposed by Boehm [1988]. The spiral model is similar to the waterfall, in that
the relationship between major phase (requirements specication, design and
113
plan next
phase
determine objectives,
alternatives and
constraints
evaluate alternative,
identify and resolve
risks
develop and verify next
level product
review
risk
analysis
prototype 1
simulations, models benchmarks
concept of
operations
requirements and
life-cycle plans
risk
analysis
prototype 2
software
requirements
requirements
validation
development
plan
risk
analysis
prototype 3
product
design
design verication and
validation
integration
and test
plans
risk
analysis
operational
prototype
detailed
design
code
unit test
integration
test
acceptance
test service
Figure 7.4: the spiral model showing activities
so on) are assumed to be linear. However, the individual phases are treated as
successive iterations of the software process, with the same activities occurring
in each iteration.
In particular, the spiral model emphasises on-going: Features of the spiral
model (154)
planning to review progress and set objectives
risk analysis and management
prototyping to resolve uncertainty
V&V driven development
Figure 7.4 illustrates the spiral process model (re-drawn from Sommerville
[2007]). The software process is organised into a spiral to illustrate the re-
occurrence of activities during each iteration. Work begins at the centre of
the spiral and moves outwards in successive iterations. The spiral is divided
into quadrants, with similar activities taking place in the quadrant during each
iteration. The spiral model
(155) Objectives are decided for at the start of each iteration, along with the iden-
tication of major alternative options for progress and any constraints (budget,
technology, etc.) aecting the project. Next a risk analysis is performed for
the various options identied. A prototype is developed to address uncertainties
identied during risk analysis.
114
production
design
requirements
feasibility
plan next
phase
determine objectives,
alternatives and
constraints
evaluate alternative,
identify and resolve
risks
develop and verify next
level product
Figure 7.5: the phases of a software development organised into a spiral
A period of development and verication is then initiated for the main soft-
ware development. Depending on the iteration of the spiral, activities here can
range from the specication of requirements to the execution of an acceptance
test with the client. Notice that regardless of the iteration, the development
eort is concluded by one or more V&V activities. Requirements specication,
for example, in the second iteration is matched by requirements validation.
Finally, a period of planning takes place to prepare for the next iteration.
The outcome of the planning phase is a plan document for the next iteration.
Figure 7.5 illustrates a simplied view of the spiral model showing how each
iteration is actually an activity in a linear software development model. From
this perspective, the rst iteration of the spiral model is a feasibility study,
resulting in an early prototype, a business plan and a Concept of Operations. Iterations of the spiral
model (156)
During the requirements iteration, requirements gathering activities occur
and the prototype is developed to resolve identied requirements risks. The
result is a requirements specication document and a development plan. The
design iteration leads to the development of a software design document, an
implementation schedule and test plan. During the nal iteration, the software
system is actually implemented, tested and delivered.
We havent talked much about specic software development practices for
the spiral process model. Instead, the model can be thought of as a framework
describing process management rather than a specic development model. In
particular, the spiral model allocates explicit phases of development for risk
115
analysis and quality assurance. The spiral model as a
framework (157) Many dierent practices can be incorporated into the spiral process in each
iteration, including rapid prototyping, formal methods and the requirements
elicitation and analysis techniques we have already seen in Chapter 2. The
particular choice of practices or methods to be used is informed by the risk
analysis phase of the spiral.
7.4 Iterative Models
Some of the limitations of linear models of software development have already
been discussed in Section 7.1. In particular, the resolution of requirements risks
often occurs late in the software life-cycle because validation of requirements
occurs immediately prior to deployment. At this point much of the budget for
a project may have already been committed, entailing the risk that the wrong
system (for the clients needs) will have been developed.
The previous discussion assumed that the unaddressed risk concerned incor-
rectly specied requirements, i.e. the development team were unable to discover
or accurately record what the client wanted the system to do. However, even if
the requirements are well established at the start of the project, they may be sub-
ject to change during a lengthy project life-cycle due to broader environmental
and subsequent requirements pressures.
Environmental pressures refer to the context or market for which the software
is being developed. Some examples of environmental pressures are: Environmental
pressures for change
(158)
rapid technological change. Computing technology evolves so rapidly that
the software may be obsolete even before it is delivered due to the intro-
duction of competing products to the market place by competitors. This
phenomenon has been described as perfect obsolescence where well de-
veloped software becomes obsolete due to earlier market penetration of a
competitor.
2
demand for return on investment. The quicker a software product is
delivered, the sooner investors can begin to recover the cost of investment,
and hopefully a prot.
limited software shelf life. There may be a deliberate policy by the devel-
oping organisation or client to only use the software for a relatively short
period of time, perhaps as an interim measure until a more comprehensive
solution is delivered by another development project.
throw-away value software. Sometimes, software is deliberately developed
speculatively to be discarded once the life-cycle is complete. Examples
2
a colleague of mine claims that betamax video tape is an example of perfect obsolescence
116
include the prototyping processes described in Chapter 6 and the develop-
ment of software in the physical sciences domain [Morris, 2008, Sanders
and Kelly, 2008, Howden, 1982, Miller, 2006].
Changes in the context of software development cause subsequent pressure
for changes to the requirements specication such that: Requirements
pressures (159)
1. rapid technological change causes feature competition.
2. customers demand the inclusion of new features in the system.
3. the requirements specication lacks stability.
Linear software process model life cycles often last too long to respond to
the rapid changes in software and computing technology. We have already seen
in the previous section how an iterative approach to software development can
be used to manage risk within individual activities. This can be extended further
by making the entire approach to software development iterative.
Iterative models are characterised by: Characteristics of
iterative models (160)
incremental releases delivered to the customer or market at the end of
each relatively short development cycles;
early delivery of software to the client for review and feedback;
deadline planning emphasizing what can be delivered within the current
cycle of development, rather than trying to estimate how long it will take
to deliver the complete functionality;
development cycles directed by changes in the software context expressed
as changes to the softwares requirements specication; and
concurrent software development activities within each cycle.
7.5 More on the Rational Unied Process
We have already begun to investigate one iterative model, so lets take a more
detailed look at the release cycles of the Rational Unied Process (RUP). Recall
that the RUP is an iterative software development process explicitly for object
oriented systems. The development process is driven by use cases which de-
scribe the functional requirements, or features, for the system, which in turn
dictates the system architecture. We looked in some detail at the inception and
elaboration phases of the RUP model, so lets now consider the construction and
transition phases. Construction phase of
RUP (161) Figure 7.6 illustrates the inputs and outputs of the construction phase. The
construction phase is dominated by detailed system and component design,
117
implementation and unit testing. The purpose of the phase is to prepare a
release of the software for delivery to the client. The inputs come directly from
the elaboration phase of the process. The outputs are:
a design document containing the collection of models developed from the
use cases and domain model, following the method described in Chapter
5;
an architectural model of the system illustrating the components, pack-
ages and classes, and the relationships between them. The architectural
model should indicate the relationship with external libraries and compo-
nents, but not detail their design;
a test plan and test suite for the system. A test plan describes the col-
lection of test cases to be applied to the system and a testing strategy
describing the approach to testing and integrating components. The test
suite is a harness for executing the automated aspects of the test plan.
the implemented deliverable that will be the release for this iteration of
the process; and
any accompanying user documentation for the delivered system, e.g. in-
stallation procedures, quick start guides or reference manuals.
Transition phase of
RUP (162)
Figure 7.7 illustrates the nal, transition phase of the RUP cycle. The
phase is concerned with deploying the software system within its organisational
context, or distribution to customers. Installation, user training and beta testing
according to the test plan takes place during the transition phase. Legacy
systems or previous versions of the new software may need to be removed from
the organisation in parallel whilst causing minimal disruption. The inputs are
the same as the outputs from the construction phase.
We have now considered the separate phases of a single RUP cycle in detail.
Now lets looks at how progress between phases and cycles is monitored in
RUP. Figure 7.8 shows a number of cycles of the RUP process, separated by
releases of the software. The decision to release a new version of the software is
taken during the transition phase, when the features agreed for the cycle have
construction
domain model
use cases
non-functional requirements
project schedule
risk management plan
design document
architectural model
test plan and suite
deliverable implementation
user documentation
Figure 7.6: construction phase of the RUP
118
transition
design document
architectural model
test plan and suite
deliverable implementation
user documentation
maintenance report
trained users
accepted system
Figure 7.7: transition phase of the RUP
cycle 1 cycle 2 cycle 3
inception elaboration construction transition
cycle 1
release
internal
milestones
lifecycle
objective
lifecycle
architecture
operational
capability
product
release
Figure 7.8: milestones and releases within the Rational Unied Process model
been implemented, along with associated use case or system non-functional
requirements. Milestones and
Releases in RUP (163)
The gure also shows the collective phases of the rst RUP cycle. The
phases are divided into a number of milestones. Milestones are pre-dened ob-
jectives set in the project plan that must be met before the project can proceed.
The gure shows a number of pre-dened life-cycle milestones separating the
phases of the cycle, which are passed when each of the outputs identied in
Figures 1.7, 1.9, 7.6 and 7.7 are satisfactorily delivered.
Figure 7.9 illustrates the phases of subsequent cycles of the RUP model.
We have already seen in Chapter 2 that large software projects can be divided
into smaller increments by prioritising the desired features of the system (e.g.
using the MoSCoW rules). The gure shows a succession of cycles of the RUP
model delivering incremental releases. Subsequent cycles in
RUP (164)
As can be seen in the gure, the inception phase occurs at the beginning
of the rst cycle only, when the business case and preliminary requirements for
the system are established. In addition, the elaboration phase in the rst cycle
119
cycle 1 cycle 2 cycle 3
inception elaboration construction transition
cycle 1
elaboration construction transition
elaboration construction transition
elaboration construction transition
cycle 2
elaboration construction transition
cycle 3
release 1
release 2
release 3
Figure 7.9: subsequent cycles of the Rational Unied Process model
is substantially larger than in later cycles because the bulk of requirements and
overall architecture of the system should be established at this point.
Subsequent cycles in the development begin with the release from the pre-
vious cycle and the collection of un-implemented use cases identied during the
elaboration phase. A further sub-set of use cases is selected for implementation
or revision, according to the priorities established in the project plan. The use
cases are then developed in more detail and the design and implementation of
the previous release are revised to incorporate them. The system is then tested
and released as for the rst cycle. Notice that further use cases may be iden-
tied during elaboration as details are added to currently un-implemented use
cases and further requirements gathering takes place.
The RUP model assumes that the overall concept of the system can be
established at this stage of the project, since inception and early elaboration
activities are not intended to be re-visited. This has been called anarchitectural
centricapproach to software development, in which development is directed by
the use cases identied for the system. Unfortunately, this means that the
software should still have a relatively stable set of functional requirements at
the start of the software process.
7.6 Agile Methods
Agile methods refers to a class of particularly light weight, iterative, rapid
software development models. Agile methods focus on the delivery of the soft-
ware product as quickly as possible so that evaluation, feedback and subsequent
120
revisions can be undertaken.
Agile methods bear some similarity to rapid prototyping as a software de-
velopment model. However, agile methods also characterised by principles and
practices that require a disciplined approach to software development in order
to manage the risks associated with rapid prototyping. Agile methods are char-
acterised by: Agile methods (165)
incremental delivery of working software to the customer, with releases as
often as 1-3 weeks;
customer involvement throughout a project, for continual feedback and
resolution of uncertainties. This often means that a representative of the
customer is a member of the project team and is co-located with the
developers;
small project teams to reduce communication overhead. Larger develop-
ment eorts must be divided into smaller teams;
reduced software overheads, with less emphasis on formal modelling or
documentation;
an emphasis on working code over design. Proponents of agile methods
argue that the design of a system is best developed gradually as the
problem becomes better understood. In addition, the feasibility of a design
is best demonstrated in working code;
the automation of tasks where possible, but in particular for unit testing,
defect tracking, conguration management, documentation and software
artifact build and deployment;
light-weight documentation in order to reduce the risk that the documen-
tation becomes out of date. In addition, source should be written to be
self documenting as far as possible to make further documentation unnec-
essary. That is, the source code should be suciently clear that further
explanatory notes are not needed; and
value of people over processes. Agile advocates argue that individuals
and the communications between them are more important than rigid
adherence to particular processes and tools.
However, agile methods are themselves prone to risks due to the assumptions
implicit in the principles adopted: Risks of agile methods
(166)
lack of customer engagement. This may be because the customer or
doesnt prioritise the project. Alternatively, it may not be possible to
identify a suitable representative of the customer, if for example, the
development is a speculative eort, without a pre-identied market or
need;
121
stakeholder conict. There may be many dierent stakeholders for a
project with conicting requirements for the software. The customer rep-
resentative may not convey this complexity to the software project team;
contract denition is usually simpler when there is a well-dened software
product to be delivered to the customer. However, agile methods deliver
software incrementally with no pre-dened end-goal. This risk can be
mitigated by using incremental contracts, however, this itself can add
overhead to the project (since each iteration must be contracted) and the
development team cannot be condent of a stable income stream;
loss of organisational memory (how we do things around here) due to
a lack of documentation and compartmentalisation of agile teams. As a
consequence, mistakes may be repeated in several parts of an organisation;
poor code quality because software is developed rapidly without applica-
tion of professional discipline. Several agile methods propose constant
refactoring and test rst coding to mitigate this risk; and
developer cooperation/team cohesion. Agile methods are characterised by
small groups of people working very closely together. The eectiveness of
the group may be limited by personality conicts or tensions within the
group.
Some agile methods
(167)
Table 7.1 lists some agile software development methods. This section de-
scribes the specic practices of one agile method, XP, in detail. Many of the
practices are also adopted by other agile methods, which You can nd out further
information on from the recommended reading.
7.7 Extreme Programming
Rules and practices of
XP (168)
Table 7.2 summaries the agile rules and practices incorporated into the XP
method, categorised by four types of activity: planning, designing, coding and
testing.
scrum
crystal clear
lean
feature driven development
adaptive software development
extreme programming (XP)
Table 7.1: some agile software development methods
122
planning for each release
on a weekly basis
user stories
project velocity
designing simplicity
prototyping
coding pair programming
standards
frequent integrations and builds
constant refactoring
testing automated testing
test rst coding
Table 7.2: extreme programming practices and rules
7.7.1 Planning and Specication
Figure 7.10 illustrates the concurrent ow of activities during an XP iteration,
i.e. activities occur in parallel. The current iteration is the central focus of an
XP development. The iteration is managed through release planning, which is
informed by:
a collection of user stories describing desired, which represent the require-
ments for the development;
the project velocity which gives an estimation of current progress; and
estimates of development time derived from spike prototyping.
The XP process
model (169)
The result of release planning is a release plan which will be used to direct
eorts during a single iteration, typically between one and three weeks. The
plan identies the user stories to be implemented in the current iteration and
an anticipated delivery date.
Planning within an iteration occurs on a weekly basis. Iteration planning
meetings take place amongst the whole development team - some agile advo-
cates have argued that iteration planning should be conducted standing up to
make things happen more quickly. During iteration planning, progress against
the release plan is measured and the list of identied defects (bugs) reviewed.
Technical risks aecting the project are identied for investigation during spike
prototyping. If necessary, the release plan is revised to accommodate delays or
faster progress.
User stories are similar to the use case scenarios described in 2, except they
tend to be briefer, and contain less detail. They describe the use of a particular
feature of a system from the perspective of a user. Figure 7.11 illustrates a user
story for the branch library system. User stories (170)
3
http://www.extremeprogramming.org
123
124
iteration
user stories
architectural
spike
spike
prototyping
release
planning
acceptance
testing
small
releases
system
metaphor
new user stories,
project velocity
release plan
defects,
next iteration
latest version
condent
estimates
uncertain
estimates
customer
approval
requirements
test scenarios
Figure 7.10: overview of the XP process (re-drawn from Wells
3
)
Keepers
As the branch administrator, I need to be able
to be able to manage who is and who can keep
books within the department. Book keepers
can only be members of academic sta.
Estimate: 2 days
Figure 7.11: an example XP user story
User stories are usually hand written and brief, consisting of only two or
three sentences and possibly a sketch of associated user interface features or
process ows. If stories need more than this amount of information, they should
probably be divided into two or three smaller descriptions.
The descriptions are written on small pieces of card
4
which are displayed on
a wall in the project teams location. User story cards can be arranged on the
wall to visually represent dierent aspects of the project, for example:
the system functionality or architecture by grouping related stories;
the projects progress by separating completed and uncompleted stories;
the projects exposure to risk by grouping stories by priority; or
the objective of the current iteration by grouping the in progress cards.
User stories are typically developed in collaboration with the project cus-
tomer, either during an initial elaboration iteration, or as a result of discovering
new stories during development and acceptance testing. Of key importance, the
system feature should be described in a way that the user and customer can
understand. In particular, no technical information concerning implementation
details is included on the card.
User stories are used to develop acceptance tests for a system and as a basis
or more detailed specication. The more detailed requirements for a system are
expressed as story tasks, derived from user stories. Tasks describe the function-
ality that will need to be implemented in order to realize the user story (and
thus satisfy the related acceptance tests). The tasks for the user story given in
Figure 7.11 are:
1. Search for users and check status ( 0 days already done in search users)
2. Add an academic sta member as a keeper (1 day)
3. Remove a keeper (1 day)
The relationship between stories and tasks is many-many rather one-many.
Typically a story will be realised by a number of tasks. However, some tasks
will re-occur in dierent stories. These duplications need to be resolved during
story elaboration.
Once the set of tasks to be implemented is established they must be allocated
amongst the project team. This can be done by following several dierent
strategies:
the team or team manager can select the most appropriately developer;
4
For some reason, many references assert they have to be 5x3in!
125
time
person hours
Figure 7.12: an example project velocity
developers can volunteer for tasks; or
tasks can be assigned at random.
Each approach has advantages and disadvantages. For example, asking de-
velopers to volunteer for tasks may mean that high risk tasks are not considered
until late in the iteration. Alternatively, assigning tasks based on the compe-
tency of developers may mean that in-experienced members of sta do not learn
new skills.
Once tasks are assigned, developers then provide an estimate of how long
they think the task will take to implement, typically measured in 1-3 days. If a
task is estimated as taking longer than this it should be reviewed and possibly
divided into a larger number of smaller tasks. Alternatively, tasks that are too
trivial should be grouped together. The aggregate of task time can then be
used to compute the total time for implementing the user stories for iteration.
The task estimates can be used to calculate the velocity of a project by sum-
ming the project progress on completed user stories and comparing this against
the person-hours of eort expended so far. The velocity gives an indication of
estimation accuracy for user stories, as well as the likelihood of a project meeting
the estimated release date. Project velocity (171)
Figure 7.12 illustrates a project velocity for a project that has begun to fall
behind schedule. Advocates of agile methods argue that progress on software
projects is governed by four variables contained in the equation below (note that
the relationship is only approximate): Managing delays
(172)
126
available time cost scope quality
The cost of a project can be computed from the number of developers
working in the team over the iteration (likely to be the dominant budget factor).
The time is calculated as described above from the story tasks. The scope of a
project is dened by the user stories selected for implementation in an iteration.
Finally, the quality of software can be dened by metrics such as defect rate, or
mean time to failure.
The implication of the equation is that there are four options for a develop-
ment team should their project experience delays:
postpone the release date to allow more time for development;
increase the budget to bring in more developers to the team;
compromise on quality assurance by reducing testing and defect correction
eorts; or
reduce the scope by delaying some user stories to the next iteration.
Postponing a release date may mean delaying the point when a customer
sees an update to the system and provides feedback, increasing the risk that
the system development may diverge from their needs. Increasing the budget
for a project can be politically dicult if an organisation has already invested
substantially. In addition, adding more developers to a project may not actually
have any eect at all on the schedule, or may even make it worse. Brooks
famously referred to this as the Mythical Man Month [Brooks, 1995].
On the other side of the equation, compromising on quality risks failure for
the entire project because in the rush to complete all agreed features, defects
may be introduced that make the system unworkable. Reducing project scope
by delaying some of the stories to be implemented to the next iteration is often
the most professional approach, since the customer is more likely to receive a
(at least partially) functioning system on the scheduled release date.
7.7.2 Testing and Coding
The rst step when implementing a user story or task is for the developer to
derive acceptance test cases for the story, in agreement with the customer.
This means that test cases are developed before the features of the story are
implemented. An implication of this approach is that the system should initially
fail the new test cases, because the relevant features have not been implemented.
This test rst approach to development extends to the implementation of
individual software components. Before implementing a component, the devel-
oper species the component interface and then develops a number of test cases
to exercise it. This forces the developer to design components to be testable, i.e.
127
<<TestCase>>
TestBoing
testBoingMethodOne()
testBoingMethodTwo()
Boing
boingMethodOne()
boingMethodTwo()
Target
boingMethodOne()
boingMethodTwo()
barMethod()
otherMethod()
anotherMethod()
Foo
barMethod()
<<TestCase>>
TestFoo
testBarMethod()
Figure 7.13: test rst development
exposing the necessary functionality to demonstrate that a component passes
or fails a test case. Test rst development
and automation (173) Figure 7.13 illustrates the arrangement of test harness, interface and target
component in a UML class diagram. First, the interface for the component
is specied as a collection of publicly accessible methods., then a test case is
implemented against the interface. Finally, the component itself is implemented.
If the component is to implement an additional interface, then the process is
repeated. Note that the test cases are only implemented against the methods
declared in the interfaces, not the component itself.
Test cases are best implemented within an automated test harness frame-
work. There is a family of *Unit testing frameworks for dierent programming
languages, for example JUnit
5
for Java, CppUnit
6
for C++, PyUnit
7
for python
and even fUnit
8
for Fortran 90.
Test rst development shifts the problem of writing correct code to one of
writing complete test cases. Assuming the test cases are complete, once all
test cases are passed, the new feature can be integrated into the main system.
However, writing complete test cases is an extremely challenging activity that
requires considerable discipline. Writing complete test cases does not necessarily
mean writing exhaustive test cases. There is an excellent anecdote on this issue,
entitledif you have 10,000,000 test cases, you probably missed one
9
. We will
return to the problem of writing good test cases later on.
During integration, the automated test cases are added to a test suite that
can be automatically executed each time the complete system is re-built. This
requires:
5
http://www.junit.org
6
http://cppunit.sourceforge.net
7
http://pyunit.sourceforge.net
8
http://nasarb.rubyforge.org/funit
9
http://horningtales.blogspot.com/2006/09/exhaustive-testing.html
128
time
cost
defects discovered
(a) at the end of the lifecycle
time
cost
defects discovered
(b) as discovered
Figure 7.14: cost of xing defects in XP, (redrawn from Beck and Andres [2005])
the management of source code for both the system and the test cases in
a version control repository, such as Subversion
10
; and
the development of an automated build, deployment and test execution
script for the complete system. Again, a number of frameworks are avail-
able for developing build scripts, including Apache Ant
11
or the *nix make
utility.
In agile projects, component build, integration and testing occurs frequently
(at least once a day) so that progress towards completion of the current iteration
can be measured and used for planning. Beck argues that it should be possible
to automatically build a software system within 10 minutes [Beck and Andres,
2005].
Frequent automated testing means that the introduction of defects into
the system is detected earlier, reducing the cost of correction. Figure 7.14(a)
illustrates the introduction of several defects into a system in which testing
occurs late in the software cycle. The cost of correcting the defect grows over
time as the defects become embedded in the system (the development team may
even implement features that depend on the defect). Figure 7.14(b) illustrates
the same collection of defects and the reduced cost of detecting and xing
defects as they are introduced into the system. Fixing defects (174)
The use of automated test harnesses also reduces the likelihood that de-
fects are re-introduced into the system. Defects are either demonstrated by an
existing test case, or when an error is reported by users, the presence of the re-
sponsible defect should rst be demonstrated by implementing a new test case.
Automated suites of test cases can be executed very cheaply as regression tests
to demonstrate that previously xed defects have not been re-introduced.
10
http://subversion.tigris.org
11
http://ant.apache.org
129
A consequence of frequent integration, testing and feedback is that the
software source code will be subject to continuous inspection and alteration.
Fixing defects is often an ideally opportunity to refactor (clean-up) a component
implementation. Refactoring activities include: Constant refactoring
(175)
improving test case completeness;
improving the design by reducing coupling between components and in-
creasing internal cohesion;
improving the readability of code, by ensuring consistency of identiers
for example; and
providing source code documentation.
Pair programming is a technique for combining source code inspections with
the development activity itself. Pairs of programmers sit at a single terminal
and work on one problem: one (the pilot) controls the mouse and keyboard;
the other (the navigator) observes the work, identies mistakes and suggests
corrections. Pair programming
(176) Collaborative work on development improves code quality, because the code
is reviewed as it is written - defects are detected before they are even fully
implemented. The practice does however require the developers to be open to
criticism of their work by colleagues, but also be able to deliver criticism in a
constructive way. Pair programming also requires discipline, because it can be
tempting for one member of the pair to dominate the work. Alternatively, the
navigator may lose concentration quicker than the pilot, so it can be useful to
rotate roles frequently so that both members of the pair are engaged in the
work.
There are several alternative strategies for allocating team members to pairs,
from random allocation to pairing experienced developers with newer members
of the team. The optimal arrangement will to a certain extent depend on the
personalities and dynamics within the team - some people just dont work well
together.
7.8 Prototyping, Design and Architecture
Unusually, we have left a discussion of the role of software design and architec-
ture in a software method until the end. Many agile methods have an ambivalent
relationship with the notion of software design, instead arguing that a systems
design will emerge as the customers requirements become clearer. The key
design principles for XP are simplicity, i.e. designs that are as easy as possible
to comprehend for both the customer and new members of the project team;
and small up-front design, i.e. avoid committing to large design solutions early
in a software development. Simplicity in design
(177)
130
In general, XP places less emphasis on designs that attempt to anticipate
future change, since this can introduce unnecessary complexity. However, de-
signs can be adopted to accommodate future change, by for example, adhering
to principles of low coupling between and high cohesion within components. In
addition, continual refactoring allows design to be reviewed and re-implemented
if necessary.
The use of a spike prototype can be used to resolve high risk issues aect-
ing a project. The risks can be caused by uncertainty regarding the system
architecture or estimates for implementing a user story.
Spike prototyping is similar to the prototyping process described in Section
6.4.1. The prototype is developed rapidly, with the conclusions of the activ-
ity fed back into the development process for the main system. The spike
prototype can be developed by a single member of the project team working
alone without applying the usual XP practices such as re-factoring and pair pro-
gramming. However, the prototype should be discarded and the functionality
re-implemented as part of the main development eort, once the risk represented
by the design issue has been resolved. Spike prototyping
(178) In fact, as can be seen from Figure 7.10 the start of an XP development
is informed by an initial spike prototyping phase in which the system metaphor
is established. System metaphors are similar to architectural patterns. The
metaphor should be used to identify the key components of the system archi-
tecture in an accessible manner. System metaphor
(179)
7.9 Summary
We have reviewed the problems of linear software process models, in particular
the challenge of uncertain and unstable requirements. We have reviewed a
number of iterative software models from the Rational Unied Process to the
Extreme Agile method. A common thread through all these dierent process
models, is that professional software development is concerned with reducing risk
and requires a rigorously disciplined approach to planning and development.
131
132
Chapter 8
Formal Methods in Software
Engineering
Recommended Reading
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, eighth edition, 2007.
Section 10.8
John B. Wordsworth. Getting the best from formal methods. Information
and Software Technology, 41:10271032, 1999.
Robert A. Glass. The mystery of formal methods disuse. Communications
of the ACM, 47(8):1517, August 2004.
Janet Barnes, Randy Johnson, David Cooper, and Bill Everett. Engineer-
ing the tokeneer enclave protection software. In Proceedings of the 1st
IEEE International Symposium on Secure Software Engineering, Washing-
ton DC, March 2006.
Jonathan P. Bowen and Michael G. Hinchey. Ten commandments of
formal methods. Computer, 28(4):5663, 1995.
Donald MacKenzie. Mechanizing Proof: Computing, Risk and Trust.
The MIT Press, Massachusetts Institute of Technology, Cambridge, Mas-
sachusetts 02142, 2001.
J. Warmer and A. Kleppe, editors. The Object Constraint Language.
Object Technology Series. Addison-Wesley, second edition, 2003.
Very good tutorials on OCL at:
http://atlanmod.emn.fr/atldemo/oclturorial/
http://www.csci.csusb.edu/dick/samples/ocl.html
133
Wordsworth reviews progress made in the use of formal methods in the
period between 1985 and 1999 and suggests reasons for lack of widespread use
of formal methods. The paper proposes ways to inltrate formal methods into
software development. The Glass paper responds to this by suggesting that
there may be a problem with formal approaches to software development if they
have to be inltrated into work practices.
Barnes et al describes a sizable eort at formally specifying a security control
system in Z. However, the report documents only limited uses of formal proofs
concerning the correctness of the resulting design.
Mackenzie is a sociologist with an interest in the history of computing. The
book is a history of the tussle in software engineering, computing science and
mathematics over the nature of proof and its role in system development.
8.1 Introduction
Certain problem domains require higher assurance as to the correctness of a
software system. Some types of problem domain demand high assurance systems
are: The need for formal
specications (181)
real time systems are developed to monitor and eect changes in their en-
vironment. Software developed for real time systems must be guaranteed
to respond to stimuli in a timely manner. Examples include Controller
Area Network (CAN) bus controllers in automotives and auto-pilot sys-
tems in aircraft;
safety critical systems are developed to operate in hostile environments,
in which failure may result in serious harm to human users or damage to
or even complete loss of the system. Examples include control systems
on space craft (which are extremely dicult to repair once in operation)
and nuclear power station protection systems; and
security systems are developed to protect high value resources from ma-
licious threats such as tampering or eaves-dropping. Examples include
Automatic Teller Machines, voting systems and building access control
systems. Alternatively, selected components of a system may be devel-
oped against security criteria. Examples include security kernels [Klein
et al., 2009] and voting systems [Cansel et al., 2006, Storer and Lock,
2009].
Of course, many systems may need to be assured against multiple criteria.
A y-by-wire controller in aircraft, for example, is an example of both a real
time and safety critical system. Recent research has demonstrated the security
vulnerabilities of CAN based systems [Koscher et al., 2010].
High assurance problem domains are characterised by the need for a low
defect rate, implying the need for:
134
problem denition
requirements
specication
system
specication
design
implementation
user requirements
formal specication
formal model
proof
proof
renement
Figure 8.1: separation of elicitation and specication in the software process
a precise description of a systems characteristics for verication; and
a rigourous method for assessing the system against the specication.
So far we have used a collection of semi-formal notations from UML for
specifying and designing the features of a system. These include: Approaches to
specication (182)
natural language to give early use case descriptions and scenarios;
structured language as an intermediate step to pseudo code and graphical
notations; and
diagrams including use case, activity, sequence and class diagrams from
UML.
In addition to these, mathematical notations can be used to give precise
meaning to specications, and can sometimes be directly translated into imple-
mentation code.
8.2 Formal Specication in Software Development
Figure 8.1 illustrates a waterfall software process containing a number of activi-
ties we are already familiar with from Chapters 1 and 7. However, an additional
step has been introduced between requirements specication and system design. Re-visiting the
Software Process
(183)
In this revised process:
the requirements specication describes the desired state of the world
after a system is implemented, i.e. once the customers problem has been
solved;
135
the system specication describes what the system should do to solve the
customers problem; and
the design describes how the system satises the specication.
Using formal methods, each of these stages of software development occurs
as a forward transformation of intermediate software products. Sometimes this
process is described as top-down renement because the process begins with
an abstract specication to which greater detail is gradually added as design
decisions are made.
Transformations may be performed manually by software developers or au-
tomatically using tools such as model generators or compilers. Rather than
performing validation at the end of the waterfall, each intermediate transforma-
tion is veried by:
inspections;
testing and model checking; or
mathematical proof techniques.
Both testing and mathematical proofs are approaches to verifying the cor-
rectness of the transformations between stages of the software development
process. However, the large number of potential inputs to a software system
mitigates against complete testing, and thus oering strong assurance of cor-
rectness via this method. Formal methods are intended to give stronger guar-
antees of the correctness of transformation by oering proof that one artifact is
a faithful representation of another.
Given the potential advantage of using methods that formally provide for
correct software, it is perhaps surprising that such approaches do not have a
wider acceptance by software developers. Unfortunately, despite the attraction,
there are inherent limits to the use of formal methods in software development.
Accidental limitations of formal methods refer to current obstacles to there
use that may be mitigated by future developments, including: Accidental limitations
of formal methods
(184)
Skills
Tools
Scale and performance
Intrinsic limitations refer to the inherent characteristics of formal methods
that can only be partially remedied by future progress in the area: Intrinsic limitations
(185)
The use of mathematical notations exacerbates the problem of require-
ments validation, because the specication is presented in a language that
136
a customer may struggle to comprehend. As a consequence, achieving a
shared understanding between customer and developer of what the system
needs to do becomes harder and makes sign o of the specication more
dicult to achieve.
To mitigate this problem, formal specications can be accompanied by
natural language explanations of their meaning and intent. Meaning is
a natural language description of what the specication says; intent is
the aspect of the problem that the specier believes they are address-
ing. As with all documentation, however, there is a risk that the formal
specication may evolve faster than the documentation;
Similarly, formal methods do not address the problem of requirements
validation (notice in Figure 8.1 that there is no reverse arrow from system
specication to requirements specication). In one sense, formal methods
shift the problem of verifying a design and implementation to one of
verifying the specication with respect to the customers needs. As a
consequence, the developed system still needs to be validated through
acceptance testing processes.
The pre-dominance of re-usable software libraries makes the pure top down
renement approach of formal methods dicult to apply, particularly at
the more detailed levels of design and implementation. As discussed in
Section 7.1, specication is constrained by the design of pre-existing soft-
ware infrastructure. Customer requirements may need to be adapted to
t within these constraints.
The complexity and scale of a typical software program demands the use
of automated tools to produce the transformations between stages of re-
nement and/or the corresponding proofs of correctness. Such tools are
themselves complex software programs, subject to defects, so the assur-
ance gained is only as good as that of the tool which produced it.
In summary, all of these limitations can mean signicant costs for a software
development project that adopts formal methods. Formal specications should
be used when they are appropriate, i.e. they are benecial to the software
development task.
8.3 Using Formal Specications
There are two main approaches to formal specication:
process algebras describe the legal behaviours of a system and the tran-
sitions between them over time. The formal language is used to specify
the legal traces of sequences of events for a process. Process algebras
137
process algebras
Hoare Logic
Communicating Sequential Processes (CSP) and
numerous dialects
state algebras
Vienna Development Method (VDM)
Z (after Zermelo-Fraenkel Set Theory, with types)
Object Constraint Language (OCL)
B (renement method)
Table 8.1: some formal method notations
usually need some representation of time, which can be either discrete or
continuous; and
state algebras are used to describe the legal states of a system and the
transitions between them. The formal language is typically used to in-
dicate the state maintained by the system and the state of the system
before and after discrete operations.
Some formal methods, such as Circus [Woodcock and Cavalcanti, 2001],
combine both process and state algebra notations. Table 8.1 lists some of the
most popular formal method notations. Approaches to Formal
Specication (186) We will focus on state based algebras during this lecture. In general, state
based algebraic specication proceeds by identifying the:
State based algebraic
specication (187)
high level components to be specied;
internal state of the component that must be exposed in the specication;
legal combinations of internal state values for the component. This is the
set of conditions that must always be true about an implementation of
the specication and is called the state invariant;
signatures of operations on the component, including the inputs and out-
puts; and
the pre and post conditions for each operation, i.e. what state the com-
ponent must be in before the operation is invoked, and what state it must
be in afterwards.
8.4 The Object Constraint Language
In principle, we could formally express the specication of an object oriented
system by writing out all the possible legal states. We could, for example, draw
UML object diagrams for every possible combination of object relationships and
attribute values that we wish to allow in the system. However, the specication
138
would quickly become extremely verbose for any non-trivial system. And indeed,
would negate the need for a corresponding implementation!
A far better alternative is to express the legal combinations of relationships
and attributes as constraints. A constraint is a boolean assertion about a system
design that can be evaluated (to either true or false) on the real system when
it is executed. If it can be demonstrated that all of the constraints are or (even
better) will always be satised by the implementation (by being evaluated to
true), then the system implementation can be said to satisfy its specication.
We have already seen several examples of constraints in the UML diagrams
developed in Chapters 2, 3 and 4: Constraint techniques
in UML (188)
multiplicities on relationships restrict the number of instances of a class
that can be involved in an association;
guards can be used on activity and sequence diagrams to control the ow
of events; and
notes can be used to informally describe more complex constraints.
The Object Constraint Language (OCL) is an extension to the UML which
can be used to formally specify the more complex constraints on an object
oriented system. OCL is useful when it is not feasible or sensible to express
constraints using multiplicities or by re-structuring the system.
OCL can be used with a number of UML diagram types, but for these
lectures we will mainly look at using OCL for describing constraints about: Constraints in OCL
(189)
the invariant legal states of relationships and attribute values on class
diagrams. Invariants are assertions that must always be true about a
system;
the pre-conditions about the system which must be satised before oper-
ations are invoked; and
the post conditions which must be satised when an operation terminates.
Note that this means we do not use OCL to alter the state of a running
object oriented system in the way that we can with imperative languages like
Java or C++. Instead, OCL is used to declare how the implementation must
behave if it is to satisfy its specication.
8.4.1 Writing Constraints
OCL syntax uses the ASCII character set. This makes the notation more verbose
than similar languages, such as Z, but also generally easier to interpret.
OCL constraints are constructed from smaller building blocks called expres-
sions. Expressions are evaluated to simpler value types when a specication is
checked. An OCL constraint is an expression that, when evaluated, results in a
Boolean value of either true or false.
139
Types and Values
Types in OCL include: Expressions and types
(190)
Boolean: {true,false}
Integer: ...,-1, 0, 1,...
Real : ...,-0.1,...,0.0,...,0.243,...
String : ...,"hello","worRld",...
UML classes: Book, Borrower...
Collection: of values of the above types
Comments
Good formal specications should be accompanied by comments containing nat-
ural language explanations of what the constraints assert. This can ease the task
of explaining (and debugging) a formal specication. In OCL documentation
can be provided by annotate constraints with comments: Comments (191)
-- OCL only has inline comments like this.
these are the same as inline comments in Java:
// Comments like this in Java
Contexts and Identiers
We will use the class diagram in Figure 8.2 to illustrate the construction and use
of dierent types of constraint on a UML class diagram. The gure illustrates
a design for a coursework management system. Students are registered for
particular courses. Each course has a number of coursework assignments that a
student completes by making a submission. Notice the submission-coursework
relationship is an example of the abstraction-occurrence design pattern. Running example
(192) A constraint must be associated with a particular context on the class dia-
gram. The context is the starting class, operation or attribute from which other
parts of the constraint are evaluated. The identier of the context is preceded
by the context keyword. In addition, the type of the constraint must also be
specied.
The types of constraint we will use are either invariants (keyword inv), oper-
ational pre-conditions (pre) and operational post-conditions (post). Constraint
types are denoted after the context identier and before the constraint expres-
sion. Two equivalent invariant constraints are: Expression context
and type (193)
140
141
C
o
u
r
s
e
t
i
t
l
e
:
S
t
r
i
n
g
s
t
a
r
t
:
D
a
t
e
e
n
d
:
D
a
t
e
S
t
u
d
e
n
t
s
u
r
n
a
m
e
:
S
t
r
i
n
g
f
o
r
e
n
a
m
e
:
S
t
r
i
n
g
i
s
M
a
t
r
i
c
u
l
a
t
e
d
:
B
o
o
l
e
a
n
i
D
:
S
t
r
i
n
g
a
g
e
:
I
n
t
e
g
e
r
g
e
t
M
a
t
r
i
c
u
l
a
t
i
o
n
(
)
:
S
t
r
i
n
g
R
e
g
i
s
t
r
a
t
i
o
n
f
i
n
a
l
G
r
a
d
e
:
S
t
r
i
n
g
c
o
m
p
l
e
t
e
d
:
B
o
o
l
e
a
n
r
e
g
i
s
t
e
r
e
d
:
D
a
t
e
S
u
b
m
i
s
s
i
o
n
m
a
r
k
:
I
n
t
e
g
e
r
c
o
m
m
e
n
t
s
:
S
t
r
i
n
g
s
u
b
m
i
t
t
e
d
:
D
a
t
e
c
o
u
n
t
:
i
n
t
c
o
m
p
l
e
t
e
:
B
o
o
l
e
a
n
s
u
b
m
i
t
(
d
a
t
e
:
D
a
t
e
,
f
i
l
e
:
F
i
l
e
)
:
v
o
i
d
a
s
s
e
s
s
(
d
a
t
e
:
D
a
t
e
,
c
o
m
m
e
n
t
s
:
S
t
r
i
n
g
,

m
a
r
k
:
I
n
t
e
g
e
r
)
:
v
o
i
d
C
o
u
r
s
e
W
o
r
k
t
y
p
e
:
W
o
r
k
T
y
p
e
d
e
s
c
r
i
p
t
i
o
n
:
S
t
r
i
n
g
m
a
r
k
:
I
n
t
e
g
e
r
w
e
i
g
h
t
:
R
e
a
l
d
u
e
:
D
a
t
e
<
<
e
n
u
m
e
r
a
t
i
o
n
>
>
W
o
r
k
T
y
p
e
G
R
O
U
P
I
N
D
I
V
I
D
U
A
L
*
*
*
*
*
p
r
e

r
e
q
u
i
s
i
t
e
*
a
n
t
i

r
e
q
u
i
s
i
t
e
*
Figure 8.2: running example coursework management system.
Student
surname:String
forename:String
isMatriculated:Boolean
iD:String
age:Integer
getMatriculation():String
{iD.size()=8}
(a) next to the appropri-
ate class
--iDs have a fixed format
{iD.size()=8}
Student
surname:String
forename:String
isMatriculated:Boolean
iD:String
age:Integer
getMatriculation():String
(b) in a note associated with the context
Figure 8.3: placing constraints directly on the class diagram
context Student inv: iD.size ()=8
and:
context Student ::iD:String inv: size ()=8
Constraints can also be placed directly on a class diagram. Figure 8.3 il-
lustrates two options for annotating class diagrams with constraints. In Figure
8.3(a), the constraint is placed next to the associated context class. In Figure
8.3(b) the constraint is placed in a note associated with the context class.
Identiers are used in constraints to navigate across a class diagram. Iden-
tiers can be used to refer to attributes or to associations with other classes.
For example, consider the (incomplete) constraints shown below: Labels and navigation
(194)
attributes can be referenced directly in their own context (i.e. from within
the same class as the context) or from other classes:
context Student inv: surname
context Registration inv: finalGrade ...
context Registration inv: student.surname ...
associations can be referenced from a local to a remote context:
context Registration inv: course ...
context Course inv: registrations ...
context Submission inv: registration.finalGrade ...
Several intermediate association labels can be used together to navigate
across a class diagram if necessary. For example, we can navigate from the
Submission context, to the Registration of the student who made the submission,
to the Course the submission was for, to the collection of Coursework that all
students must submit for a course:
142
context Submission inv:
registration.course.courseWork ...
Figure 8.4 illustrates the navigation of the class diagram made by this series
of identiers. Navigating the class
diagram (195)
Operators
Just as in imperative programming languages, operators are used to combine
literal values and sub-expressions into expressions. The operators available in
OCL are:
comparison Comparison operators
(196)
equality (the same as == in Java, note that this is not assignment):
4.0 = 4.0
players.size() = 11
inequality (the same as the != operator in Java):
course1 <> course2
less than: <
Less than or equal to: <=
greater than: >
greater than or equal to: >=
Read comparisons from left to right.
arithmetic (following the same rules concerning integers and oats as other
languages):
4 * 3.0 / 2 + 3 - 5
logical
conjunction (same as && in Java):
x > 4 and 4 > 3
disjunction (same as || in Java):
x > 4 or 3 > 4 + 5
negation (same as ! in Java):
x > 4 or not 3 > 4 - 3
implication (true, unless it is raining and the grass is not wet):
rainingToday implies wetGrass
143
144
C
o
u
r
s
e
t
i
t
l
e
:
S
t
r
i
n
g
s
t
a
r
t
:
D
a
t
e
e
n
d
:
D
a
t
e
R
e
g
i
s
t
r
a
t
i
o
n
f
i
n
a
l
G
r
a
d
e
:
S
t
r
i
n
g
c
o
m
p
l
e
t
e
d
:
B
o
o
l
e
a
n
r
e
g
i
s
t
e
r
e
d
:
D
a
t
e
S
u
b
m
i
s
s
i
o
n
m
a
r
k
:
I
n
t
e
g
e
r
c
o
m
m
e
n
t
s
:
S
t
r
i
n
g
s
u
b
m
i
t
t
e
d
:
D
a
t
e
c
o
u
n
t
:
i
n
t
c
o
m
p
l
e
t
e
:
B
o
o
l
e
a
n
s
u
b
m
i
t
(
d
a
t
e
:
D
a
t
e
,
f
i
l
e
:
F
i
l
e
)
:
v
o
i
d
a
s
s
e
s
s
(
d
a
t
e
:
D
a
t
e
,
c
o
m
m
e
n
t
s
:
S
t
r
i
n
g
,

m
a
r
k
:
I
n
t
e
g
e
r
)
:
v
o
i
d
C
o
u
r
s
e
W
o
r
k
t
y
p
e
:
W
o
r
k
T
y
p
e
d
e
s
c
r
i
p
t
i
o
n
:
S
t
r
i
n
g
m
a
r
k
:
I
n
t
e
g
e
r
w
e
i
g
h
t
:
R
e
a
l
d
u
e
:
D
a
t
e
*
*
*
*
*
p
r
e

r
e
q
u
i
s
i
t
e
*
a
n
t
i

r
e
q
u
i
s
i
t
e
Figure 8.4: navigating the class diagram
Strings
String values have a number of pre-dened operations that can be useful for
many constraints: Strings (198)
literals
"Storer"
"Requirements Engineering"
length:
"Software Engineering ".size()
sub-strings:
"Software ". substring (0,1) = "S"
as attributes:
title.size() < 100
UNIVERSITY_NAME = "University of Isla"
Putting It All Together
We have now covered enough of the OCL notation to consider some example
constraints that are appropriate for the course management system in Figure
8.2. Examples (199)
-- surname field must be less than 100 characters
-- in length
context Student
inv: surname.size() < 100
-- a submission cannot be given a higher mark
-- than set for the course work.
context Submission
inv: mark <= courseWork.mark
-- a student must be registered on a course
-- before it starts
context Registration
inv: date.before(course.start)
-- all coursework must be submitted before
-- the end of the course
context Submission
inv: submitted.before(registration.course.end)
;
Note that we are embedding organisational policy into the system specica-
tion in the constraint below - that coursework will not be accepted for marking
after the due date unless the student has an extension.
145
-- all coursework must be submitted before
-- the due date , unless the student obtains an
-- extension
context Submission
inv: submitted.before(courswork.due) or hasExtension
Accessing a null valued association (even if it has an arity of 1) results in
an empty set - this does not mean that nalGrade is an empty length string.
-- an item of course work must be associated
-- with a course.
context CourseWork
inv: not course ->isEmpty
The constraint below may not be necessary if submissions are not created
until the student makes a submission. Formal specication requires iterative
development to get right, just like other software development methods. Re-
dundant constraints can be removed once the problem domain is better under-
stood.
-- coursework cannot be marked if it has not been
-- submitted.
context Submission
inv: submitted ->isEmpty implies
mark ->isEmpty and comments ->isEmpty
-- a grade cannot be assigned until the student
-- completes the course.
context Registration
inv: completed = false implies finalGrade ->isEmpty
8.5 Collections
The navigation of an association with multiplicity greater than one is evaluated
to a collection of instances of the remote class type. For example, navigating
the registered association between Student and Course will give the collection
of courses a student is registered for. If we imagine the navigation occurring at
runtime, then we might display the collection of courses for a particular student
as: Collections (200)
registered = {Software_Design ,
Requirements_Engineering}
Just as in other programming languages, there are a number of dierent
types of collection.
Collection (or bag)
Sets
Ordered sets
146
Sequences
These have properties equivalent to the mathematical terms. Confusingly,
Lethbridge and Lagani`ere [2005] denote a sequence with a {ordered} association
decoration.
The ClassName.allInstances() operation gives all the instances of a class in
the model. For example:
context Course
inv: allInstances () = {Software_Design ,
Requirements_Engineering ,...}
Collection Properties
All collections, regardless of type, have a number of common properties. Collection properties
(201) Collection properties can be:
information about the current state of the collection; or
other collections of the elements of the collection themselves.
Collection properties are operations on the collection, accessed using the ->
symbol. Some properties are:
collection ->isEmpty () : Boolean
which asserts whether the collection is empty or not
collection ->size() : Integer
which asserts the current size of the collection, for example:
context Student inv:
registered ->size() < 20
asserts that no student can be registered on more than one course. Note
that:
(Collection.size() = 0) = Collection.isEmpty ()
should always hold.
More Complex
Properties (202)
collection1:T->intersection(collection2:T): Collection:T
Gives a set containing only values that are in collection and collection2.
This is the same as:
collection1 collection2
147
collection1:T->union(collection2:T): Collection:T
Gives a set containing all values in collection1 and collection2. This is the
same as:
collection1 collection2
collection:T->select(v:T | b(v) ): Collection:T!
Selects every element v of collection for which b(v) is true. This is the
same as:
{v : T|v collection b(v)}
collection:T->forAll(v:T | b(v)): Boolean!
Asserts that b(v) holds for every element of collection This is the same
as:
v : T b(v)
collection:T->exists(v:T | b(v) ): Boolean
Asserts that b(v) is true for at least one element of collection. This is
the same as:
v : T b(v)
Some example uses of properties are given below, together with a comment
describing their meaning. Example properties
(203)
-- selects all students whose surname is McAdam
-- note this is not a constraint.
Student.allInstances ()
->select(s:Student| s.surname =" McAdam ")
-- Asserts that all students must be over eighteen
context Student
inv: allInstances()->forAll(s | s.age >=18)
-- A course cannot be both an anti -requisite and
-- a pre -requisite for another course.
context Course
inv: prerequisite ->union(
anti -requisite)->isEmpty
148
-- only submissions for group coursework are
-- shared.
context CourseWork
inv: type=INDIVIDUAL implies
submissions ->forAll(s1,s2 |
s1.registration <> s2.registration
implies s1 <> s2)
Properties that are also collections can be chained together.
8.6 Constraints on Operations
As for classes and attributes, operations can also be the context for a constraint.
Operational constraints are useful for expressing the pre and post conditions of
the operation. The constraint shown below illustrates how to use OCL to denote
operational constraints. Constraints on
operations (204)
context Student :: getMatriculation (): String
let initial:String = surname.substring (0,1)
pre: isMatriculated = true
post: result = iD.concat(initial)
The example illustrates several new features of constraints:
an operation is denoted as a context using the double colon :: symbol,
followed by the operations signature, just as for attributes;
variables can be used to represent intermediate expressions in more com-
plex constraints using the let keyword, particularly where the same ex-
pression is used in several places. In the example above, the variable
initial is asserted as being equal to the rst character of the students
surname when the operation is invoked. Note that variable identiers are
asserted as being equal in value to the expression, rather than being an
assignment;
pre conditions specify the situation before an operation can be invoked
using the pre keyword. In the example, the pre-condition constraint states
that a student must be matriculated before the getMatriculation() oper-
ation can be invoked; and
post conditions specify the state the system must be in after an operation
has been invoked, and the return value from the operation, based on the
state of the system before the operation was invoked and any input values.
The post condition in the example (denoted using the post keyword) states
that the return value (result) of the operation must be the students ID
value appended with the rst letter of their surname.
Note that the operational constraints do not control how the operation is
invoked, only what specication the implementation must satisfy.
149
A larger example of an operational constraint is shown below: Large example (205)
context Registration :: calculateGrade (): String
pre: completed=true
let finalMark:Real =
submissions ->collect(
s | s.mark*s.courseWork.weight)->sum()
let totalMark:Real =
course.courseWork ->collect(
c | c.mark*c.weight)->sum()
let percent:Real = finalMark/totalMark
The collect property is a variant of select that returns a collection which is
the result of applying the collect expression on each element in the collection.
In the example, the application of collect collects the weighted mark of each
item of coursework associated with a registration instance.
The sum property can be used on collections of integers and reals, giving the
sum of all elements in the collection. In the example, the sum property is used to
obtain the students (associated with the registration for the course) nal mark.
post:
if finalPercent >= .8
then result = "A"
else if percent < .8 and percent >= .7
then result = "B"
else if percent < .7 and percent >= .6
then result = "C"
else if percent < .6 and percent >= .5
then result = "D"
else result = "E"
The constraint is used to specify the calculateGrade() operation which trans-
lates a percentage mark into a grade in the range "A" to "E".
The examples shown below introduces some more features of OCL which
are useful when specifying the changes in system state which occur when an
operation is invoked.
-- whenever a new submission instance is created
-- the number of attempted submissions should be 0
context Submission ::count:Integer
init: 0
The constraint shows the use of the init keyword to assert the initial value
of an attribute when an instance of the class is constructed (or when the class
is loaded in the case of class attributes). In the example, the count attribute is
initialised to 0 for the number of times a student has submitted the same item
of coursework.
-- pre and post conditions for submitting
150
-- course work
context Submission :: submit(date: Date , file:File)
pre: date.before(courseWork.date)
post: completed = true and count = count@pre +1
The constraint shows the use of notation for using the state of an attribute
before an operation is invoked within a constraint for the state of the attribute
after the operation has completed using the @pre decorating of the attribute
identier. In the example, the post condition states that the count attribute
for the submission instance after the operation is completed is asserted to be
one plus the value of the count attribute immediately before the operation was
invoked.
-- define value of derived attribute
-- a submission is considered complete if the
-- mark is greater than 25%
context Submission :: complete:Boolean
derive: marks / courseWork.marks > .20
The derive keyword is used to declare the value of a derived attribute. A
similar invariant constraint is:
context Submission
inv: complete = (marks / courseWork.marks > .20)
However, note that a derived value is calculated by the OCL engine. An
invariant is checked against a value that is calculated by the implementation.
8.7 Model Driven Development
Formal descriptions of constraints can provide substantial benets in clarifying
the specication for a software system, particularly if the formal constraints are
accompanied by natural language descriptions of their intent. However, the real
power of formal specications can be leveraged when they are used to drive
software development and verication processes.
During model driven development (sometimes referred to as model driven
architecture), software developers concentrate of specifying models of what soft-
ware is supposed to do, rather than implementing the behaviour directly. The
key artifact in a model driven development is a Platform Independent Model
of a software system. For example, an abstract PIM could be developed using
UML class diagrams annotated with OCL constraints. A PIM model can be Model driven
development (207) automatically:
checked for problems including, syntax errors, consistency between con-
straints and redundant constraints;
checked against an instance, or snapshot model of the system; and
transformed into an implementation for a given target platform.
151
platform
independent
model
platform
specific
model 3
platform
specific
model 2
platform
specific
model 1
code 3
code 2
code 1
Figure 8.5: model driven development
There are several tools available for developing and validating PIMs built in
UML/OCL, for example: Model driven
development with
UML and OCL (208) OCL Environment (OCLE), which we will use in Workshop 8.10:
http://lci.cs.ubbcluj.ro/ocle/
OCL Tool for Precise UML Specications (Octopus) which appears to
be no longer supported:
http://octopus.sourceforge.net/
Model Development Tools-OCL (MDT-OCL), part of the eclipse model
development tools framework:
http://www.eclipse.org/modeling/mdt/?project=ocl
DresdenOCL:
http://www.dresden-ocl.org/index.php/DresdenOCL
Most tools are provided as a plug-in to the Eclipse IDE. Cabot and Teniente
[2006] provide a survey of MDA tools, including those supporting UML/OCL.
Most UML/OCL tools also provide mechanisms for deriving executable ob-
ject oriented programs from a PIM. Figure 8.5 illustrates the general transfor-
mations that are performed on a platform independent specication model to
generate an executable implementation. Initially, the PIM is transformed into a
platform specic model (PSM). Transformations are specied by a mapping or
platform denition model describing how the PIM should be instantiated in a
PSM.
Abstract data types specied in the PIM are translated into equivalent types
available on the target architecture. For example, the abstract Date type for an
152
portability the model is suciently abstract to be
automatically translated into dierent
implementations for dierent object oriented
platforms
interoperability system components can be composed at the
abstract model level and then deployed to
particular platforms
maintainability system evolution only requires changes to the
model since implementations can just be
regenerated from the model
Table 8.2: benets of model driven development
attribute on a UML class diagram might be translated to the java.util.Date
type on a UML class diagram of a Java program design.
Finally, the PSM is transformed into executable code, for example into a
collection of Java source code les. Any OCL constraints could be translated
into Java assert() statements, or similar validation chunks of code, either at
the beginning or end of a method body.
Model driven development has several benets for the software development
process, as summarised in Table 8.2. Benets of model
driven development
(209)
8.8 Summary
Formal methods and notations are used in problem domains where high as-
surance as to the correctness of a system with respect to its specication is
required. However, formal methods do not solve the problem of ensuring that
the specication itself is correct with regard to the real needs of the customer.
The cost and time commitments required to follow formal development meth-
ods can mitigate against their use, particularly when the problem domain itself
is rapidly evolving.
OCL is a declarative specication language used to express constraints that
evaluate to true or false, it cannot be used to aect the state of an object ori-
ented program. OCL can be used to specify program invariants and operational
pre and post-conditions on class diagrams.
153
8.9 Exercises
1. The class diagram in Figure 8.6 shows two classes extracted from a (very
simplied) Library system.
Reader
name:String
id:String
category:ReaderCategory
Book
title:String
id:String
status:BookStatus
<<enum>>
ReaderCategory
STUDENT
STAFF
<<enum>>
BookStatus
NORMAL
SHORT_LOAN
RESTRICTED
borrower loan
Figure 8.6: library system
(a) Write OCL constraints for the following rules:
i. A books title is restricted to no more than 25 characters.
ii. If a books status is currently restricted then nobody can borrow
it.
(b) The Library has rules for borrowing books based on the category of
the reader:
student readers are permitted to have a maximum of 10 loans
at any given time; and
sta readers are permitted to have up to 20 normal loans and 5
short loans at any given time.
i. Write these rules as OCL constraints.
ii. Consider how you might express these rules diagrammatically
using subclasses of Reader and Book.
(c) The Library changes its rules for student readers so that they are
permitted a maximum of 10 loans, not more than 3 of which can be
short loans.
i. Write OCL constraints to express these new rules.
ii. Is it possible to express these extended rules diagrammatically?
2. The class diagram in Figure 8.7 is for a company project management
database.
It focuses on the association between company sta and proposals for
new projects that they are involved in reviewing (association: reviewers/
154
StaffMember
name:String
iD:Integer
category:StaffCategory
group:DevGroup
Proposal
title:String
iD:Integer
group:DevGroup
DevGroup
FINANCE
SALES
MARKETING
StaffCategory
DEVELOPER
TEAM_LEADER
PROJECT_MANAGER
approvedBy approved
0..1 *
reviewers reviewerOf
3..5 0..6
Figure 8.7: project proposals
reviewerOf) and which member of sta approves a project, if it goes ahead
(approvedBy/ approverOf).
(a) Identify the constraints that are imposed on this model by the two
associations given.
(b) It is company policy that no Proposal may be reviewed by a sta
member who is a member of the same development group (develop-
Group) that submitted the proposal. Express this rule in OCL.
(c) It is also company policy that every team of reviewers for a proposal
must include at least one team leader. Express this rule in OCL.
(d) Following the review process a project may be approved but only by
a project manager. Express this constraint in OCL.
3. The class diagram in Figure 8.8 is extracted from the class diagram for
an electronic voting system.
(a) Explain the constraints that are imposed on the relationships between
the classes in the system.
(b) Give a natural language explanation of the OCL statement associated
with the Election class.
(c) An election description is something like Election of a Member of
Parliament to serve in the constituency of Kirkcaldy and Cowden-
beath. Write an OCL constraint to restrict the length of the election
description to 500 characters.
(d) The number of votes cast in the election should be the same as the
number of voters on the marked roll. Express this rule in OCL.
(e) A voter should only be able to cast at most one vote per election.
Express this rule in OCL.
155
E
l
e
c
t
i
o
n
d
e
s
c
r
i
p
t
i
o
n
:
S
t
r
i
n
g
V
o
t
e
r
s
u
r
n
a
m
e
:
S
t
r
i
n
g
f
i
r
s
t
N
a
m
e
:
S
t
r
i
n
g
d
a
t
e
O
f
B
i
r
t
h
:
D
a
t
e
e
l
e
c
t
o
r
a
l
R
e
g
i
s
t
e
r
C
o
d
e
:
S
t
r
i
n
g
V
o
t
e
E
l
e
c
t
o
r
a
t
e
M
a
r
k
e
d
R
o
l
l
T
h
e

s
e
t

o
f

v
o
t
e
r
s
w
h
o

p
a
r
t
i
c
i
p
a
t
e
d
i
n

a
n

e
l
e
c
t
i
o
n
T
h
e

s
e
t

o
f

v
o
t
e
r
s
e
l
i
g
i
b
l
e

t
o

p
a
r
t
i
c
i
p
a
t
e
i
n

a
n

e
l
e
c
t
i
o
n
.
p
a
r
t
i
c
i
p
a
n
t
s
e
l
e
c
t
o
r
a
t
e
0
.
.
*
0
.
.
*
1
.
.
*
v
o
t
e
r
s
0
.
.
*
v
o
t
e
r
s
{
p
a
r
t
i
c
i
p
a
n
t
s
.
v
o
t
e
r
s

>
s
i
z
e

<
=

e
l
e
c
t
o
r
a
t
e
.
v
o
t
e
r
s

>
s
i
z
e
}
Figure 8.8: voting system
4. Read the following papers
156
Mountain
name:String
elevation:Double
prominence:Double
location:OSGrid
Route
distance:Double
<<enumeration>>
Classification
MUNRO
CORBETT
GRAHAM
Guide
name:String
yearsExperience:int
<<enumeration>>
Qualification
TRAINEE
MOUNTAINEER
INSTRUCTOR
Party
startDate:Date
Walker
name:String
0..* 0..*
0..*
1..6
0..*
0..*
0..*
0..*
qualification
walkers
guide
route
mountains
classification
Figure 8.9: mountain walks system domain model
John B. Wordsworth. Getting the best from formal methods. Infor-
mation and Software Technology, 41:10271032, 1999.
Robert A. Glass. The mystery of formal methods disuse. Commu-
nications of the ACM, 47(8):1517, August 2004.
Do you think the approach advocated by Wordsworth is acceptable/work-
able? Is Glass critique of the approach valid? Explain your answer.
5. An outdoor travel company is developing a system for managing guided
walks amongst the mountains of Scotland. The class diagram in Figure
8.9 shows part of the domain model for the system.
(a) Explain the constraints that are imposed on the relationships between
the classes in the system.
(b) All walks are to last for one day only, so it has been decided to limit
all routes distances to 30 miles or less. Express this rule in OCL.
(c) The travel company maintains safety rules concerning the qualica-
tions of guides on routes. In particular, any route that includes at
least one Munro must have a guide who is qualied as an instructor.
Express this rule in OCL.
(d) During development the company realizes that the party-guide-walker
constraints should be adapted to allow for larger parties. Parties can
now consist of up to 30 walkers. There must still be at least one
guide for every six walkers in a party. There must still be at least
one suitably qualied guide, according to the rule specied in part
5c, to lead the party.
157
Explain how you would adapt the model dened so far (both the
UML and the OCL) to accommodate the new arrangement, and
express any new OCL constraints required.
(e) A colleague proposes to replace the Classication and Qualication
enumeration classes in the class diagram with sub-classes of Moun-
tain and Guide respectively. For example, the Classication enumer-
ation will be replaced with three sub-classes of Mountain (Munro,
Corbett and Graham). Your colleague argues that this approach
will improve clarity in the diagram and reduce the number of OCL
constraints required.
State whether you agree with this approach and justify your argu-
ment.
158
8.10 Workshop: Model Driven Development
This workshop gives an introduction to model driven development using a light-
weight tool, OCL-Environment (OCLE). OCLE is a pure Java application that
can be run from a terminal or from within Eclipse. You can nd out more about
OCLE from the project webpage.
1
8.10.1 Setup
Download a copy of OCLE from Moodle:
http://fims.moodle.gla.ac.uk/file.php/128/workshops/ocle.zip
The bundle includes the user manual and some example projects that come
with the distributions.
Extract the archive into your workspace. From now on, this tutorial will
assume that you have extracted the archive to a the directory path:
/users/level3/l3tws/workspace/ocle -2.0.4
You will need to adapt this path to your own circumstances. Open the start
up script le:
/users/level3/l3tws/workspace/ocle -2.0.4/ run_linux.sh
and change line 5 of the le to:
OCLE_HOME =/users/level3/l3tws/workspace/ocle -2.0.4
Save the modied script. Execute this start up script from the OCLE_HOME
directory:
./ run_linux.sh
This should start the OCLE application. Notice that the application GUI
is split into four panels as shown in Figure 8.10. The top left panel contains
navigation trees for examining projects and models. The panel directly below it
is used to show the properties of a selected element (class, operation, attribute,
object and so on). The panel along the bottom of the application window is
used to show output. This panel is divided into tabs for:
LOG, which records user actions;
Messages, where compilation errors are shown;
OCL output, where the result of evaluating an OCL expression is shown;
Evaluation which shows where a constraint is violated in a UML model;
and
Search results.
1
http://lci.cs.ubbcluj.ro/ocle/
159
Figure 8.10: the OCLE application after start up
Finally, there is a panel for editing UML models and constraint les.
You will also need to download and extract the StudentLifeElipse project
archive from Moodle. The archive contains a class diagram and collaboration
diagram for the coursework submission part of the StudentLifeElipse application.
8.10.2 Exploring a Project
The rst step when developing a software application using OCLE is to create a
new project, which will store the UML models, OCL constraint les and snapshot
object diagrams of the system. Together, these artifacts can be used to generate
Java source code for the application that can be compiled and executed.
Creating UML models in OCL is essentially the same as doing so in Ar-
goUML, Umbrello and many other UML diagram editors, so we wont focus on
this in OCLE. Instead, we will use a pre-prepared model of the StudentLifeElipse
project used as an example during lectures. To open the project, choose the:
Project Open
menu item or choose from the tool bar. Then navigate to the le:
studentlifeelipse/studentlifeelipse.oepr
160
Figure 8.11: the OCLE environment after loading the StudentLifeElipse project
in the archive for the StudentLifeElipse project downloaded during setup.
Click Open for the selected le. OCLE will load the project and associated
model and constraint les. The GUI should look something like Figure 8.11.
You should see the following message in the LOG tab:
Activated UML model StudentLifeElipse
Activated project studentlifeelipse
Notice there are three tabs on the navigation panel on the left hand side of
the GUI, for Project, User Model and Meta Model. We will be working with
the User Model and Project tabs.
You can open the UML class diagram which describes the StudentLifeElipse
project by selecting the User Model tab (which displays the project as a hierar-
chical tree) and then double clicking on the Main class diagram node (directly
beneath the root). A class diagram will appear in the main window, showing the
classes of the StudentElipseCycle project and the relationships between them.
Figure 8.12 shows the OCLE application with the class diagram open.
There is also an instance diagram which describes a snaphshot usage of
the application with some objects in the context of the University of St Glas-
burgh. The StudentLifeElipse model and constraints can be checked against the
instance diagram. To open the instance diagram expand the Collaboration
icon in the User Model tab (you may have to scroll down the model tree) and
161
162
Figure 8.12: the StudentLifeElipse class diagram
double click on the UofStGlasburgh instance model icon. Figure 8.13 shows
the instance diagram containing two students, and a submission for an exercise
for an object oriented software engineering course.
The constraints that have been specied so far are contained in the le:
studentlifeelipse/studentlifeelipseModelLevel.bcr
the extension is short for business model constraints. The constraint le
is automatically loaded with the project. To open the le, double click the
studentlifeelipseModelLevel.bcr le under the Project tab. You may have
to open the Constraints node in the project hierarchy. Figure 8.14 shows the
constraints le open in the editor.
8.10.3 Checking Constraints
The constraint le needs to be compiled before it can be checked against the
UML model. Choose the:
Tools Compile active le
menu item. Alternatively, click on the button marked with the icon on
the tool bar. You should see the following message in the LOG tab.
Compiling ... successfully completed
Now validate the model against the constraints. Choose the:
Tools Check model
menu item. You should see the following messages (with adjusted path
name) in the LOG tab:
Opened file /users/level3/l3tws/ocle_2 .0/ Temporary/
Diagrams/UofStGlasburgh.xml.
13 evaluations requested.
13 have been performed , 1 problem(s) found. Please check
the Evaluation tab.
This indicates that each object in the model was checked against the in-
variant constraints in the active OCL le. One evaluation is conducted per
invariant constraint, per instance. There are ve invariant constraints for the
student context and ve student instances (giving ten evaluations). There is also
one constraint each for Course, Coursework and Submission, with one instance
of each in the model, giving a total of 13 evaluations.
Notice that OCLE has reported a problem with one of the instances. Clicking
on the Evaluation tab and expanding the Errors tree reveals the problem, as
shown in Figure 8.15. The gure shows that an evaluation failed for one of the
instances of student.
Double clicking on the:
163
164
Figure 8.13: the UoStGlasburgh instance model
165
Figure 8.14: the StudentLifeElipse constraints le
Figure 8.15: an error reported in the UoStGlasburgh model
Rule failed for context "student2:Object"
highlights the invariant that has been violated in the OCL le. The con-
straint is a (rather ugly) way of saying that an iD string must only contain digits.
Looking at the instance student2 on the diagram shows that the students ma-
triculation string (0865566BT) has been used for their iD.
8.10.4 Modifying the Snapshot
We need to correct the instance diagram for the University of St Glasburgh. To
do this, go to the User Model tab, right click on the student2 instance and
choose Edit Object. A dialog will appear showing the current state of the
object. Remove the last two characters from the iD attribute value and click
OK. Go back to the constraint le and re-compile it and re-evaluate the model,
following the same steps as above.
You should now get the message in the LOG tab:
13 evaluations requested.
13 have been performed , 0 problem(s) found.
Model appears to be correct according to the selected
rules.
stating that the model now passes all the constraint evaluations.
8.10.5 Adding More Constraints
Go back to the constraint le and add the following constraints:
1. A course title must be no more than 50 characters in length.
166
2. A student cannot have an empty surname if the forename is not empty.
3. A submission is not complete unless it has a mark
4. A submission cannot have a comment if no mark is assigned.
5. A student cannot make a submission for a course they are not registered
on.
6. A student cannot register twice for the same course.
8.10.6 Generating Source Code
You can generate Java source code from the model which will include the OCL
constraints as validation code. After compiling the constraints le, choose the:
Tools Generate code...
menu item. Set the output destination directory and then click Next and
Ok. Open one of the generated source code les. You will see that invariant
constraints are contained in an inner class as methods that can be invoked by
a checker.
8.10.7 Extensions
The OCLE archive contains a number of example projects in the:
OCLE_HOME/help/examples
directory. Try exploring and altering some of these projects. You can also
try implementing the models from the exercises in OCLE.
167
168
Chapter 9
Documentation and Technical
Writing
Recommended Reading
Recommended reading
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, ninth edition, 2010.
Chapter 30 (online)
9.1 General Considerations
Some questions to consider when producing written documentation include: Considerations
Who are your audience, what can you expect them to know?
What are the key concepts you want to convey?
How widely disseminated will the work be?
What will be the nal format?
There are several types of software documentation. Types of software doc-
umentation
project or software process documentation describes the processes under-
taken by the project team and some of their outputs, including the project
organisation and schedules, test plans and acceptance test reports;
product documentation describes the underlying software application or
component, including the requirements specication, design description,
and source code comments;
maintenance documentation describes the status of a systemand includes
release notes describing what has changed in the system since the previous
release, and defect tracking reports; and
169
user documentation, which provides information on how to install, con-
gure, administer and use a system. User documentation may include a
tutorial or guided tour of a systems features for getting started, as well as
a complete reference manual for the systems feature set.
9.2 Structuring Documentation
Any technical document will follow a broadly standard pattern, as follows: Structuring a technical
document or paper
1. Meta data
2. Abstract or executive summary
3. Introduction
4. Main body section 1
5. Main body section 2
6. ...
7. Summary and or Conclusions
8. References
9. Appendices
This basic patterns is generally applicable regardless of the size of the doc-
ument, or whether the high level sections are called parts, chapters or sections.
However, the structure of a document does need to reect the contents of the
document. It is not useful to slavishly follow this pattern if this results in awk-
wardly structured prose. The basic template for technical documentation is a
good place to start when writing documentation, but it should be expected that
the document structure will change as the target of the documentation process
is better understood. Each of the parts of the
Meta data is information attached to a document to support indexing, archiv-
ing and subsequent searching and retrieval. Depending on the document type,
meta data can include the: Metadata
title;
names of the author(s);
date of publication;
owning or sponsoring organization(s);
170
contracted organization(s);
identier;
revision number of version;
sensitivity or clearance level, public or condential for example;
document status, preliminary, draft or nal for example;
revision schedule;
revision history;
keywords; and/or
related documentation.
MAny organisations provide templates for their documents to encourage
standardization. The L
A
T
E
X preparation system also provides standard macros
for specifying document title, author and so on.
The abstract provides summary of the contents of the paper, describing the
motivation and noting the key results or ndings. Abstract
The Introduction is the rst top level section sets the scene, and explains
how the paper will progress. The introduction should be used to provide a
foundation for the rest of the paper. This includes: Introduction
a justication for the work described in the document. This should explain
the motivation or purpose for writing the document. A typical way of
introducing the documents motivation is a sentence beginning withThis
paper argues that... or This report concerns...;
the key denitions and concepts necessary to understand the rest of the
document;
references to earlier or companion documents necessary to understand the
concepts of this document; and
a nal sub section of the introduction explaining the structure of the rest
of the document. This section of the document usually begins with a
sentence such as Section 2 describes the current state of the art in the
chicken plucking industry. Section 3 then relates these developments to
the growth of fox populations...
171
1. Introduction
2. Experimental Design
(a) Setup 1
(b) Setup 2
3. Results
(a) Results 1
(b) Results 2
4. Discussion
5. Related Work
6. Conclusion
(a) experiment report
1. Introduction
2. Domain Model
3. Use cases
(a) Sub-system 1
(b) Sub-system 2
(c) Sub-system 3
(d) ...
4. Non-functional
Requirements
5. Unresolved Issues
6. Summary
(b) requirements specication
Figure 9.1: sample structures for two types of technical document
The Main Body consists of one or more high level sections, developing the
detailed arguments and/or content of the paper. Sections should be used to
represent signicant breaks in the content of argument contained in the pa-
per. A paper reporting empirical results might have sections on related work,
experimental design and results. Each paragraph within a section should build
on the prose contained in the previous one(s). Figure 9.1 illustrates example
structures for two documents, a report of an experiment (Figure 9.1(a)) and a
requirements specication (Figure 9.1(b)). Main body
The Conclusion or summary, along with the abstract, may be the most read
part of a paper. The section should: Summary and or con-
clusions
contain a summary of key points made in the paper;
describe the main results of the paper;
make a concluding argument; and/or
state what the wider consequences or implications of the contents of the
main sections are.
A conclusion may also describe the next steps to be undertaken in the work
(sometimes this is in a separate section or sub-section calledFuture Work).
172
References Almost all work builds on that published by others. The references
contain a list of sources used in the documentation as supporting evidence, or
of related interest.
The appropriate use of the work of others in your own documents is very
challenging. You must cite the work you have referred to in producing your
own report. However, it is also in-appropriate to quote at length from a source
without explanation or analysis, even if you provide a citation.
If you wish to refer to another authors work, you should provide a short Refering to related
work summary in your own words which makes clear:
what the relevant contents of the reference are; and
how it relates to your work.
For example, to note a case study on open source software development, I
might write:
Rosenberg has reported on the experiences of the Open Source
Applications Foundation (OSAF) work on the Chandler project [Rosen-
berg, 2007].
Quotations taken from another source should only be used if you wish to say
something about the exact wording the author has used. For example, I might
write: Using quotations
Sommerville denes Software Engineering asthe principles, meth-
ods, techniques and tools for the specication, development, man-
agement and evolution of software systems [Sommerville, 2010].
Note the inclusion of management and evolution of software sys-
tems in the denition, reecting a recognition that software systems
may have very long shelf lives.
The mark of good academic writing is how it critically analyses and relates
relevant literature, not simply reports it.
There are numerous standard citation and reference styles, Citation style
including the:
Harvard style (author-year in parentheses);
the American Psychological Association (APA) style; and
the footnote/endnote styles.
The Harvard style is useful for an expert to quickly resolve which paper or
document is being referred to. However, the endnote/footnote approaches tend
to be less disruptive to the documents narrative.
Whichever standard you choose, the most important thing is to be con-
sistent. It is good practice to use reference management systems to ensure
consistency of referencing style. Examples are:
173
Endnote
1
for Microsofts Word word processor; and
BibTeX
2
for the L
A
T
E
X type-setting system.
The natbib package for L
A
T
E
X/BibTeX provides a exible mechanism for
incorporating references into documents as needed.
The Appendices of a document contain the things that many of a documents
readers dont need to know in order to understand the main sections. This may
include: Appendices
tabulation of raw measurement data;
tool conguration details;
a glossary;
a list of acronyms;
a bibliography of further reading . Note that this is dierent from a list
of references;
detailed mathematical proofs;
test data; and/or
a reference guide.
9.3 Quality Assurance and Documentation
Software documentation should be considered as a maintenance process, rather
than the generation of a one-o document. This is because of: Why review documen-
tation?
changes in the artifact to be documented (the requirements specication,
software design, source code implementation, of the project team, for
example);
changes in the scope and level of detail in the document, as its purpose
is better understood by its authors;
the need to integrate style from multiple authors. As new content is added
to a document by dierent authors, a periodic revision must take place to
ensure a consistent style throughout the whole document; and
the discovery and correction of defects.
1
http://www.endnote.com
2
http://www.bibtex.org/
174
Consequently, software documentation is a continuous process alongside
other software development activities. The principle objective of the process
is keeping the software documentation relevant to the software project, and
therefore retaining its value. There are several strategies for maintaining the
relevance of documentation. Keeping documenta-
tion relevant
Dont produce more documentation than you can eectively maintain.
Producing copious amounts of outdated (and therefore uninformative)
documentation is a waste of eort. Instead, prioritise what information
needs to be formally documented.
Integrate the cost of maintaining documentation into your project plan.
There is a trade-o to be made between the extra cost of maintaining
and communicating information without good documentation and the
on-going cost of maintaining the information.
Explicitly plan the review schedule for documentation to be within the
life-cycle of change for the underlying artifact. For example:
user documentation should be updated as each new function is added
to a system;
defect tracking documentation should be updated as bugs are as-
signed and corrected; and
software design documentation should be updated due to changes in
the source code.
Keep documentation close to source of change. This means that any
discrepencies between the artifact and the associated documentation will
be more evident and easier to detect and correct. In some cases, it is
possible to completely unify the documentation and the target artifact.
There are two approaches to this:
generate the documentation from the product, using documentation
generators such as Doxygen
3
or JavaDoc
4
; or
generate the product from the documentation, using model driven
development techniques (See Section 8.7).
Notice that both approaches observe the princple dont repeat yourself.
The documentation and the underlying artifact are automatically changed
together.
3
http://www.doxygen.org/
4
http://www.oracle.com/technetwork/java/javase/documentation/
index-jsp-135444.html
175
You should expect to revise a document several times before it reaches an
acceptable state for distribution outside of the project. The document should
pass through several drafts: Revising documenta-
tion stages
the document plan is an outline of what the structure and contents of
the document will be. A document plan can be specied in varying levels
of detail, from rst order section headings, through to the contents of
individual paragraphs. It may be possible to divide the writing of the
documents dierent sections between several dierent authors based on
the plan. Further more detailed section plans may be prepared by the
individual authors;
the rst draft should contain all content so far identied that might be
relevant to the documents topic. The rst draft does not have to have a
consistent style, or be particularly well written. The purpose is to get an
understanding of the overall scope and direction of the documents prose.
If the document has been written by several dierent authors it is good
practice to appoint a single author to integrate the dierent parts. When
the rst draft is completed, it can be circulated for comment within the
project team. At this stage, comments should focus on the structure and
overall content of the document, rather than providing detailed comment
on style, language, grammar or spelling issues;
for second and subsequent drafts, changes can be made based on feedback
from other members of the project team, the language and structure
is revised and improved, irrelevant content is removed and new content
that has been identied as missing is added. Each new draft of the
document may be circulated for further comment. The changes made to
the document are recorded in the revision log, along with the reason for
change;
a release of a document is published and/or circulated outside of the
project team when the quality assurance team for the document are sat-
ised that it is acceptable. A release version of a document may not
contain all of the meta-data recorded during its preparation. The revision
schedule and log may be omitted for example.
In summary, dont be tempted to circulate a write-once document outside
of a project team. Take the time to get documentation right.
As discussed, documentation is subject to continual change. This can cause
confusion between dierent versions of documents regarding what changes have
been eected. Consequently, it is useful to maintain: Revision schedules and
logs
a revision schedule, which records
when a document will be reviewed and why,
176
who will do the review and who will integrate changes; and
a revision log, which records:
what changes were made to a document,
when they were made,
who made them and
the reason for the change.
A document should be read several times during a review to check for mis-
takes during a review. Some of the checks can automated, particularly for
spelling and at least partially for grammar. Some tips for eective document
review are: Reviewing documenta-
tion
read each sentence in the document slowly and out loud. Saying the
content of a document helps to make the content literal;
consider what a literal interpretation of the sentence would mean;
share the reviewing process amongst the team, so that each author reviews
something they didnt write. This avoid mistakes being missed because
the author skims content they think is correct; and
experiment with collaborative writing, particularly for key sections of a
document such as an abstract or the conclusions. Thinking through the
expression of a phrase within a group allows the use of a much greater
vocabulary.
A wiki can be an extremely powerful tool for collaborative software docu-
mentation. Typical features of a wiki include: Using wikis for docu-
mentation
change tracking, when what and by whom;
document partition into pages;
cross-referencing; and
artifact integration (via plugins).
Most technical documentation is written in English. Consequently, there is a
temptation to use metaphors, analogies, slang or colloquialisms which are native
to English in order to improve understanding of the concepts being explained.
Examples of such idioms include: Improving (simplify-
ing) language
The Internet is like a spiders web
Is it really? So you can get tangled up in it? Does it have regular geometric
patterns?
177
Eckythump!
Crikey.
The chap had pan fried.
He died.
I am Hank Marvin!
Quite hungry.
The PC was just bog standard
Do you mean the PC was equipped with a 1GHz x86 processor, 1GB of
DDM2 RAM and a 30GB SATA hard disk?
However, many readers of technical documents do not read English as a rst
language and may not be familiar with the target of a particular idiom.
Similarly, it can be tempting to hedge, for example: Hedging
It would seem to be case that the mouse ran into the hole
can be simplied to:
It is the case that the mouse ran into the hole.
which can also be simplied to:
The mouse ran into the hole.
As can be seen, removing hedges doesnt reduce the meaning of the sen-
tence, but it does simplify the meaning and reduce the word count.
Finally, it can be tempting to propose how the reader should react to the
contents of a document, for example: Asserting/assuming
It is well known that...
It is clear from the graph that...
You will be able to see...
It is interesting that...
It is indisputable that...
It is obvious that...
It cannot be argued that...
178
However, this may annoy a reader if the document doesnt cause the an-
ticipated reaction. For example, stating that a concept is obvious may make
a reader assume you the author thinks they are stupid if they nd the concept
challenging.
Consequently, simplicity is a good guideline for writing high quality technical
documentation.
Some tips for simplifying language are: Guidelines for simplify-
ing language
keep sentences to short statements. Break long sentences with many
clauses into shorter statements that make the same argument. This makes
the overall argument easier to follow because it can be read in smaller
chunks;
employ a consistent style, grammar and spelling. For example, it matters
less whether the British or American spelling of through (thru) is used,
than that it is used consistently. If an organization does have a policy of
one spelling form over another, then use it;
maintain a bijective relationship between terms and their denition. This
means that every term you dene has a only one meaning, which is not
dened by any other term. It can be particularly tempting to use several
terms interchangably for the same denition, particularly when:
several dierent authors have used dierent terms for the same def-
inition; or (even worse)
dierent terms with dierent meanings are used interchangably.
For example, The termsthe Internetandthe World Wide Webare often
used to refer to the same thing, despite their accepted denitions referring
to dierent technologies. Documents containing the sentence the terms
X and Y will be used interchangably throughout this document can be
improved by ensuring the denition is consistent.
dene acronyms and use them consistently (and dene them in a consis-
tent way). For example The World Wide Web (WWW) emerged in the
early 1990s as a collection of technologies centered around the Hyper-Text
Transfer Protocol (HTTP) and Hyper-Text Markup Language (HTML).;
dont repeat points without a good reason. The document should be
structured so that each statement, paragraph and section follows natu-
rally from the information contained its immediate predecessor. Forward
referencing (See Section 4.5 for an explanation of this argument)is often
an indication of poor structure in a document; and
refer to and describe all gures, tables and other oating artifacts in-
cluded in the paper in the main text. In addition, all oating artifacts
179
should appear as close as possible to where they are rst referenced. Ide-
ally, a gure should appear on the same page as where it is rst referenced,
or on the following page. The contents of each gure and table should
be explained in the main text. If the content does not appear to need a
description or reference, it probably isnt relevant to the topic.
Technical documentation should only contain descriptions in the third per-
son, passive voice. This means that: Third person, passive
voice
the narrator of a description is not present in the description, so the words
I and we are not used; and
the subject is the focus of a sentence rather than the object.
For example:
I began the experiment by installing Windows XP on my lap-
top.
vs.
The experiment was initiated by installation of Windows XP
on the laptop.
One exception to this is that it is sometimes acceptable to use I or we
in the introduction or conclusions to a document, particularly if the purpose of
the document is to state the authors opinion on a technical matter (sometimes
called a position paper). However, this approach does annoy some readers
generally speaking, only professors get away with it.
9.4 Summary
180
Chapter 10
Project Management
Recommended Reading
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, ninth edition, 2010.
Chapter 22
Stephanie Ludi. Student Survival Guide to Managing Group Projects
2.5, 2.5 edition, 2006. Available at http://www.se.rit.edu/~sal/
SEmanual/TableOfContents.html.
10.1 Working in Groups
Many software engineering projects are beyond the capabilities of a single soft-
ware engineer to deliver within a reasonable time-scale. Consequently, software
project teams must be organised, with an appropriate structure to address the
particular problem the project poses. This section discusses how to organise a
software project team.
10.1.1 Types of Team Organisation
There are numerous models for organizing a software development team. For
example, in the chief programmer model authority resides in single team leader
(chief programmer). The model was originally proposed by Brooks [1995], to
replicate the structure of medical surgery team led by a senior surgeon. Chief programmer
team model Information and control is organised top-down and follows well dened paths.
Each member of the team has well-dened roles for which they have explicit
training and expertise.
A dis-advantage of the approach is that it can cause teams to be inexible
when new situations or skill-requirements emerge, since the team organisation
is dedicated to addressing a particular problem structure.
181
At the other extreme, the laissez-faire model provides much more individual
freedom to the members of the team to contribute to the project in their own
way. Roles within the team are not rigidly dened. Instead, each team member
investigates the project problem, and works out for themselves how they will
contribute to the project goals, based on their own preferences and skills. The
team provides a forum for discussion, communication,coordination (and hope-
fully) agreement amongst team members, rather than as a means of directing
eorts. Rules and conventions within the team emerge over time. Laissez-faire (MUD)
model A colleague used to describe laissez-faire as being like a Multi-User Dungeon
computer game (now called massively multi-player), because all the players have
dierent skills, abilities and personal goals. The players will cooperate in order
to achieve common goals (e.g. reaching the next level), but do so by bringing
their personal skills to the team voluntarily.
A laissez-faire approach is commonly adopted in open source projects, either
to get the project started, or as a mechanism for continuing support when a
vendor has decided to divest a product. Raymond [2001] has described the
eect of voluntary contributions to open source projects.
In the role based model, the team is built around a set of roles. Roles
can be either long-lived or created to handle specic tasks. Consequently, the
assignment of roles to team members can also be exible, depending on the
circumstances of a project. Some roles, such as project manager may persist
for the duration of the project, and only ever be assigned to a single person.
Other roles may rotate within the group, e.g. quality assurance, or be assigned
for specic tasks, requirements capture team, for example. Role based (sports
team) model Despite the exibility, role based teams tend to have clearly dened mech-
anisms for making decisions, either democratically or through a management
system. The authority for decisions may be distributed amongst dierent mem-
bers of the teams for dierent aspects of the project. The general manager
might allocate roles, for example, but the requirements manager might decide
how best to document specications.
Regardless of the exact structure of a team, a number of software develop-
ment team roles tend to re-occur. These include: Roles in a software de-
velopment team
manager;
customer contact;
secretary;
toolsmith;
librarian;
quality assuror; and
conguration manager.
182
As well as other individual or team roles for particular task e.g., requirements
capture team, testing manager, design lead. Notice that these roles may have
varying durations within a software development life-cycle.
10.1.2 Deciding on and Documenting Group Organisation
In order to decide on how to organise your team, you should: consider an Team organisation
roles individuals:
attributes;
skills;
personality;
circumstances; and
professional development aims.
Roles can be dened by the tasks they are required to undertake. Roles and
team members can be assigned exibly, i.e remember that:
more than one role can be assigned to a team member; and
more than one team member can be assigned to the same role.
You should expect to have regular, planned meetings with clear objectives.
At minimum your team should aim to meet once a week, at the same time and
in the same place. Establishing a regular meeting time and venue means that
the meeting process will become established more quickly. Resources that you
will need for the meeting will also be available.
In addition, you should decide how and when your team will communicate
with each other. Your organisational plan document should have Team organisation
communication explicit statements about:
what must be communicated;
when and how often;
by whom;
to whom; and
by what means.
You can check the completeness of your document by asking questions about
the contingencies that the team has made for when things go wrong. For
example, can you answer the question:
183
I cant make the next meeting. Who should I tell? How much
advance notice? Email or note?
If you cant answer the question, then you should think about extending
your group organisation document to accomodate such situations.
You should develop your group organisation document as your discussions
progress. The plan should also evolve over the life-time of the project, as your
understanding of your team mates improves; and the organisational culture of
your team emerges. Organisational culture can be described as the way we do
things around here, and is often implicit in much of the work of an organisation.
Explicitly documenting practices can help new members of the team to integrate
more quickly with the work eort.
The structure of the plan should be as follows: Structure of the
Group Organisation
Document
1. Roles
Who does what?
2. Authority
Who decides? How are decisions taken?
3. Communication
Where and when will you meet? How will you communicate otherwise?
4. Information management
Where is information kept? How and when will it distributed? Who can
use it?
5. Organisational risks
What are the threats to team success arising from the way you organise
the group?
A template for the group organisation document is available on Moodle.
184
10.2 Using Trac for Project Planning
This tutorial goes through the basic steps of conguring and using Trac
1
for
the PSD coursework in semester 1. Trac is a congurable web based issue
tracking and management tool which integrates with subversion. Trac organises
issue tracking around tickets that describe features to be implemented, bugs
to be xed or tasks to be completed. The Trac system also integrates with
the Subversion version control system, so we will also set up a version control
repository in anticipation of the lectures on change management. You can nd
out more about Trac from the online documentation wiki available on the project
website.
Important: the instructions for this workshop will work, provided you follow
them exactly. Be careful to type in the commands exactly as they are given.
The tutorial will assume that you are a level 3 student with username l3tws and
are a member of PSD team Z, meaning you are a member of the unix group
psd311z on the Trac server. You will need to substitute your user id and group
label for these respectively. If you are in level M and a member of team blue for
example, then your label will be psdm11blue.
10.2.1 Logging into the Trac Server
Trac is hosted on the server hoved.dcs.gla.ac.uk. You can nd your groups
Trac site by visiting the URL:
http://hoved.dcs.gla.ac.uk/psd311z/trac
Obviously, you havent set Trac up just yet, so it wont work right away!
The rst thing you need to do is log in to hoved using your active directory
credentials using a command prompt.
If you are using a Linux distribution (e.g. in the Level 3 laboratory), open a
terminal application and type:
]# ssh -l l3tws hoved.dcs.gla.ac.uk
l3tws@hoved s password:
Last login: Wed Oct 20 16:57:51 2010 from misima
Dept. of Computing Science hoved
]#
If you are using a Windows machine (e.g. in the Level M laboratory)
then you should start the putty application from the start menu button Start
Menuputtyputty. Then, enter the host name to connect to in the dialogue
as hoved.dcs.gla.ac.uk and click Ok. A dialogue box will open asking whether
you want to accept the remote machines credentials, so click Ok. A command
prompt will start and ask for your username and password. If you enter these
correctly, you should be logged into the Trac server.
1
http://trac.edgewall.org
185
The ]# symbol means a command prompt in the notes. Output from the
terminal is indicated on lines without a command prompt.
10.2.2 Setting up the Site
Change to the directory that has been created to store your teams Trac (you
can use the tab key to auto-complete command and le path names):
]# cd /extra/psd311z/
Now create a subversion repository to store your deliverables in.
]# svnadmin create repos
This creates a repository at path location /extra/psd311z/repos. You can
examine the repository directory listing by typing:
]# ls repos
conf db format hooks locks README.txt
Your subversion repository will also need to be readable by other for the
Apache web server to access it (this is the default). To make the repository
write-able, you need to modify the group ownership and permissions of the
repos directory.
]# chgrp -R wwwpsd311z repos
]# chmod -R g+rw repos
Well return to using Subversion for change management later in the semester.
Now create a Trac repository in the directory by typing the command:
]# mkdir /extra/psd311z/trac
]# cd /extra/psd311z/trac
]# trac -admin ./ initenv
and then providing answers to the prompted questions:
Project Name PSD Team Z
Database connection string sqlite:db/trac.db
Repository type svn
Path to repository /extra/psd311z/repos
The admin tool will then create the basic layout of the Trac in the current
directory.
The next step is to congure access to the site for the web server on hoved.
To do this, you need to make the database directory in your Trac accessible to
the Apache daemon:
]# chgrp -R wwwpsd311z db
]# chmod -R g+rw db
186
Also, you need to create user accounts for each of the members of the
team so that they can login. The prompt will ask you to enter a username and
password.
]# cd /extra/psd311z/
]# htpasswd -c team.htpasswd l3tws
New password:
Re- type new password:
Adding password f or user l3tws
You only need the -c option the rst time you create an account. You may
need to set the password le to be readable by your group, if you each create
your passwords from your own accounts. To do this, type:
]# chmod g+rw team.htpasswd
in your teams trac directory.
Try visiting the URL for your Trac site again in a browser. If all went well,
you should see the front page of the Trac website, similar to Figure 10.1.
Figure 10.1: the front page of Trac
Finally, we need to set up Trac so that it can be administered from the
web interface, rather than the command line client. Returning to the command
187
prompt, start the Trac administration command line client trac-admin in the
Trac directory:
]# cd /extra/psd311z/trac
]# trac -admin ./
Trac ]#
Whenever you are using the trac-admin client you can get help with the
available commands by typing help, producing a list commands and the syntax
of their arguments.
To view the current permissions for a user, type:
Trac #] permission list
User Action
-----------------------------
tws BROWSER_VIEW
tws CHANGESET_VIEW
tws CONFIG_VIEW
tws EMAIL_VIEW
tws FILE_VIEW
[... snip ...]
tws WIKI_VIEW
Available actions:
BROWSER_VIEW , CHANGESET_VIEW ,[snip ...]
To set administrative privileges for a user, type:
Trac #] permission add l3tws TRAC_ADMIN
This gives the specied user full administrative privileges in the Trac system
- so use them carefully!
You can log out of the Trac admin console by typing:
Trac #] exit
10.2.3 Creating and Viewing Tickets
You can explore the various menu options on the web interface at this stage,
including:
the Wiki for maintaining documentation;
the Timeline which reports project events in Trac;
the Roadmap which summarises tickets by milestone;
a link to Browse Source, which presents a view of your subversion repos-
itory;
a collection of customisable queries for View Tickets;
188
a form for creating a New Ticket;
a general Search feature for all of the content in Trac; and
an Admin screen for conguring milestones, components, priorities and
other features of Trac.
Try creating a ticket in Trac (Click on New Ticket. Tickets are descriptions
of small packages of work to be completed by the team. Tickets can be:
associated with project milestones;
associated with particular versions and/or components of the project;
given a type (defect, task etc.);
given le attachments;
assigned to team members for completion;
prioritised, updated with further information (e.g. the cause of a defect);
and
marked as completed.
The ticket can be altered at any time by clicking on View Tickets Active
Tickets and selecting the ticket to edit. Each time the ticket is edited, the
change is recorded in the tickets history.
10.2.4 Customising Trac to Fit your Project
Once you are comfortable with the features of tickets, you need to customise
the features of the ticket creation form to t your project.
First, start setting up project milestones to match those of the PSD course.
To do this, click on the Roadmap button on the top right of the window. This
lists the current milestones set for the project, labelled milestone1, milestone2,
milestone3 and milestone4: not very interesting!
Click on the rst default milestone, milestone1, and then choose the Delete
milestone button. A dialogue box will ask if you wish to re-assign tickets
associated with milestone1 to another milestone. This is convenient if you
have already added tickets, but since track is currently empty, you can just go
ahead and click Delete milestone to conrm. Repeat this process for the other
milestones listed in the Roadmap.
Next, create a new milestone by clicking on the Add new milestone button
in the Roadmap window. A web form should appear, similar to that shown in
Figure 10.2. Fill in the web-form for the D4 deliverable, with a due date of 1
st
Dec, 2011. You can also add a description to the milestone if you wish. Click
189
Figure 10.2: adding a milestone to the Trac
Add milestone when you are ready to conrm. You can view the newly added
milestone by clicking on the Roadmap button as before.
Returning to the Trac website, you can open one of the tickets you created
earlier (e.g. by browsing through View Tickets Active Tickets) and change
the tickets milestone to the deliverable milestone you just created. If you now
browse to the Roadmap menu option, you can see that the hand in milestone
now has a progress tracker and the due date we just set. Try creating a few
more tickets for the milestone and setting some of them as complete. You can
use the Roadmap presentation as a progress tracker for your project.
Try conguring other aspects of Trac from the Admin window (selected
from the Trac window menu). For example, you could change the prioritisation
scheme for tickets to t with the MoSCoW approach illustrated in Table 2.4 of
the notes. To do this, choose AdminPriorities. Click the check box next to
each priority level listed and then choose Remove selected items. Next add
each of the four priority types from the Moscow Rules, so that you should see
a screen similar to Figure 10.3.
190
Figure 10.3: conguring Trac with the MoSCoW rules.
You should also alter the list of components in the project to t with the
dierent groups of functions you have identied in your requirements specica-
tion as the project proceeds. Once you are satised with the conguration, add
tickets to your Trac for the tasks you identied in your project plan.
10.2.5 Extending Trac
This section describes some optional extra activities that you may try with your
Trac deployment. Both extensions require you to edit the le /extra/psd311z/trac/conf/trac.ini
using a command line editor such as vi or nano. The le contains congura-
tion details for Trac. Every conguration option is a name/value pair of the
form name=value. Conguration options are grouped into sections with headers
labelled [like this].
Enabling Plugins for Gantt and Dependency Charts
Several plugins have been installed on the Trac server to support the generation
of Gantt and dependency charts.
JsGantt
2
for Gantt charts
2
http://trac-hacks.org/wiki/TracJsGanttPlugin
191
MasterTickets
3
for dependency charts
To enable these plugins, edit the conguration le, so that it contains the
following lines:
[components]
tracjsgantt .* = enabled
mastertickets .* = enabled
[ticket -custom]
finish = text
finish.label = Expected finish (YYYY -MM-DD)?
finish.order = 5
estimate.label = Estimated hours?
estimate = integer
blocking = text
blocking.label = Blocking
blockedby = text
blockedby.label = Blocked By
[trac -jsgantt]
date_format = %Y-%m-%d
fields.finish = finish
fields.estimate = estimate
[mastertickets]
dot_path =/usr/bin/dot
Now access one of the tickets you have created. The ticket form should
have extra elds for specifying the:
nish date (note the awkward format);
the estimated duration (in hours, not counting weekends and assuming
an eight hour day);
a comma separated list of ticket ids blocked by this ticket; and
a comma separated list of tickets this ticket is blocked by.
Try creating (or altering) new ticket with some of these features lled in.
You can then view the dependency graph between tasks by clicking on the
Depgraph button in the top right hand corner of the window.
You can also view a Gantt chart version of your tasks by creating a wiki
page and embedding a Gantt chart widget. To do this click on the Wiki button
in the menu and then click Edit this page. Scroll to the bottom of the editable
content and type
[wiki:Gantt]
3
http://trac-hacks.org/wiki/MasterTicketsPlugin
192
This creates an internal link to the wiki page Gantt inside Trac. Click
Submit changes, and you will be taken back to the newly edited front page.
Of course, the Gantt page doesnt exist yet, because we havent created it.
To do this, click on the Gantt link you have just created at the bottom of the
start page and then choose Create this page. You can now add content to the
page called Gantt. To insert a Gantt Chart of your tasks, insert the following
text anywhere on the page:
[[ TracJSGanttChart ()]]
and click Submit changes. If all goes well, you should have a Gantt chart
displayed on the page, similar to Figure 10.4.
Figure 10.4: embedding a Gantt chart in Trac
Appearance
There are a number of customisation options available in the le conf/trac.ini,
including for example, an option for setting the project logo, logging options
193
and conguring email notications. Its a good idea to make a backup copy of
this le before you make any changes.
You can set the logo that appears on the front page of your Trac site, by
changing the [header logo] src eld to the universitys crest:
http://www.gla.ac.uk/0t4/generic/images/logo_print.gif
194
Chapter 11
Testing and Assurance of Large
Scale, Complex Software Based
Systems
Recommended Reading
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, ninth edition, 2010.
Chapter 8
Emil Obreshkov. Software release build process and components in AT-
LAS oine. In Conference on Computing in High Energy and Nuclear
Physics 2010, Taipei, Taiwan, October 2010.
11.1 Introduction
During the Object Oriented Software Engineering (OOSE) Course, we investi-
gated some core concepts in software testing, including: Concepts from the
OOSE course:
reasons for testing;
eectiveness vs. eciency;
failure, defects and errors;
dierent types of defect;
the software testing process;
black and white box testing;
input equivalence partitions;
unit and integration testing;
195
#components
#test cases
Figure 11.1: combinatorial explosion in software testing
the test-report-x cycle; and
managing automated testing with JUnit.
If any of these terms are unfamiliar to you, should review the OOSE course
notes as a priority
1
.
In this series of lectures, we are going to extend this discussion to consider
the application of the principles of testing to large scale software based sys-
tems. This section considers some general issues concerned with the testing
of large scale systems; Section 11.2 describes the testing of non-functional or
emergent properties of systems; and Section 11.3 discusses the management
of test programmes within large teams of software developers over potentially
lengthy periods of time.
Recall from the OOSE course that planning for software testing means iden-
tifying a trade-o between:
maximising the test coverage of a system to increase the number of defects
discovered; and
minimising the cost of conducting testing per defect discovered.
In addition, recall the problem of combinatorial explosion in software testing.
The greater the number of possible input parameters to a system, the harder
it becomes to ensure high coverage of a system. Figure 11.1 illustrates the
problem of combinatorial explosion in software testing. Combinatorial ex-
plosion in software
testing
As the number of modules (lines of code, functions, classes, components
or sub-systems) in a system increases linearly, the complexity of the system
1
http://fims.moodle.gla.ac.uk/course/view.php?id=163
196
will increase exponentially because of the potential dependencies between those
modules. Consequently, the number of combinations of modules and their po-
tential combinations of inputs also increases exponentially.
The diculty of scaling eective testing quickly becomes apparent for large
scale systems. The issue of scale and complexity can aect a software project
in many dierent ways: Dening scale and
complexity in software
systems
computational scale and complexity;
number of software modules and inter-dependencies (see OOSE);
number of software platforms;
variations in build and conguration of deployments;
duration and variation in inputs;
software development team(s) size, location and experience;
number of geographic locations and network connections; and
number and variation in users.
Lets examine some particular aspects of scale and complexity in testing with
some case studies.
Large scale software development eorts, consisting of hundreds of thou-
sands, or millions of lines of code, are often divided amongst one or more teams
of developers. Each team of developers is given responsibility for the devel-
opment, testing and delivery of one or more sub-systems within the overall
development eort. These heterogeneous software projects may be populated Heterogeneous soft-
ware projects by:
dierent business units within a single organisation;
business units from dierent subsidiaries within the same umbrella organ-
isation, such as a multi-national company; or
project teams within dierent organisations brought together as part of a
consortia.
Signicantly, the greater the variation in organisational culture (i.e. the
dierent outlooks, social backgrounds and management styles) between the dif-
ferent teams working on the project, the harder it can be to develop a consistent
test programme for a software project. Each organisation will develop and de-
liver its own test plan, even though there may be agreed standards, natural
variation will occur, so it becomes harder to acheive a consistent and coherent
software quality for the overall system.
197
The ATLAS particle physics project (based at the Large Hadron Collider at
CERN) is supported by a large scale software project [Obreshkov, 2010]. The
project is characterised by (approximately): Example: the ATLAS
Project
7 million source lines of code;
10 major sub-projects;
multiple platforms, languages, compilers and congurations;
500 developers;
3000 users (scientists and engineers); and
40 countries.
The project team have developed an extensive build and test infrastruc-
ture for managing the collaborative software eort. This infrastructure includes
several dierent test stagings: Testing the ATLAS
Software
ATLAS Testing Nightly
ATLAS Run Time Tester
ATLAS Nightly Build
Full Chain Test
Tier0 Chain Test
Big Chain Test
SampleA Test
Note that:
testing is integrated as far as possible into the build process for the entire
project toolset;
individual tests are developed at the discretion of module users and de-
velopers;
ATN Test results re-
port
Socio-technical systems (sometimes called computer-based systems) incor-
porate both computer software and hardware, the computer systems users, and
the surrounding organizational and cultural practices. Consequently, the sys-
tem boundary is drawn around the organisation as a whole: the software and
hardware systems are just some of the components to be considered in the
overall system. This perspective introduces socio-technical issues of scale and
complexity for testing a system.
198
From a socio-technical perspective, the organisation as a whole must be
tested when a new software system is introduced, and not just the software
itself (although this remains important). Introducing a new software system will
cause the rest of the organisation to evolve in response. Consequently, the whole
system must be tested for potential defects which have been introduced by
the system evolution. Unfortunately, testing socio-technical systems eectively
is challenging for several reasons: Challenges testing
socio-technical sys-
tems
the members of the organisation may not be available to take part in tests;
obtaining realistic test scenarios may not be practical;
identifying and covering the real working practices; and
the organisation may evolve independently of the system.
Sometimes referred to as joint systems in military contexts, or coalitions
of systems in more recent literature, systems-of-systems represent the extreme
end of the scale for challenges in software testing. A system of system repre-
sents multiple heterogeneous semi-autonomous systems that cooperate or are
coordinated to produce emergent eects. Examples include electronic stock ex-
changes, military coordination systems (across multiple arms of a military or
dierent militaries) air trac control systems and supply chain control systems.
Signicantly, the system-of-systems is not under the control of any one actor.
Individual systems may evolve independently of neighbouring systems and the
overall system-of-systems. Testing a system-of-systems is extremely challenging
because: Systems-of-systems
each of the member systems will have dierent cultures and practices;
the system cannot be isolated or congured for a test;
one of the member systems may evolve during a test; and
the expected outputs for the system are not easy to dene.
In summary, increasing scale in a software or computer based system reduces
the coverage and eectiveness of testing eorts, even if a proportionate number
of resources are applied to testing.
11.2 Testing Non-functional Requirements
Recall from Chapter 2 that non-functional requirements describe emergent char-
acteristics or properties of the overall system that must be measured to be sat-
ised rather than observed as a provided feature as for functional requirements.
Consequently, non-functional requirements cannot typically be checked for in
199
the design documentation; they can only be tested once an implementation of a
system has been realised. The implementation tested may be the nal system,
or a prototype. Alternatively, it may be possible to build a model from which
the characteristics of the nal system can be approximated. An advantage of
testing non-functional requirements is that they may act as an aggregate for
more complex functional properties that are too complex to test individually.
In one sense, developing tests for non-functional requirements is the same
as conducting a scientic experiment. The tester formulates a hypothesis con-
cerning the system under test (the requirement), and then constructs an ex-
periment to determine whether the hypothesis is satised. A well formulated
non-functional requirement should state the: Information needed to
test non-functional re-
quirements
property of the system to be measured;
metric to be used;
operating conditions in which the requirement must be satised; and
threshold the system behaviour must exceed to satisfy the requirement.
There are dierent classes of testing for non-functional requirements, de-
scribed in the following sub-sections.
11.2.1 Reliability, Safety and Security Testing
The reliability of a system is the extent to which a system performs according
to its specication. Reliability testing
Metrics include:
probability of failure on demandprovides an estimate of the probability of
failure each time a system is accessed;
mean time to failure, indicating how long it takes for a software system to
fail. This is a useful metric for systems where access for repairs is dicult
or expensive, such as space based systems. Ideally, the mean time to
failure should be greater than the mission time for such systems; and
down time per year, indicating how much time can be lost to system
outages over a year. This is useful for high demand, continuous use
systems, such as high volume transaction processing. Payment systems,
for example, are often designed to have down times of less than a few
seconds per year.
The operation of many systems occurs in conditions which are potentially
harmful to the system or to humans who operate or depend on the system.
These dangers may arise from an adverse environment in which the system
operates, or the nature of the system itself, should it malfunction.Examples of
software used in safety critical contexts include: Examples of safety
critical contexts
200
automatic pilots for transportation, suc has aeroplanes;
equipment used in the operation of particle beam radiotherapy equip-
ment;
space based technology, such as satelites, space craft and planetary rovers;
and
nuclear power station management systems.
These systems are called safety critical because a principle concern for the
system design and evaluation process is to gain concern that the operation of
the system will not cause the system or its users harm. If software is used to
control the systems behaviour then assurance must also be gained about its
safety.
Testing the safety of a system is concerned with the development of test
cases which demonstrate that harm will not be caused in the adverse environ-
ment in which the system will be used.
Methods for testing the safety of a system include: Methods for testing
system safety
model driven development, which allows implementation software and test
suites to be generated automatically from platform independent models.
Test cases are derived from assertions about legal and illegal states for the
software model (see Chapter 8 for more information on the use of formal
methods in software engineering);
Cleanroom development which uses automated and statistical methods to
select test cases for execution, and is used to calculate an estimate of a
software systems pfd, and a condence in the estimate; and
Hazard and Operability Study (HAZOPS)derived from chemical engineer-
ing and similar activities. For software, a HAZOPS like process can be used
to identify ows of information between software components. Questions
can then be asked about the ows of information, such as what happens
when the information is incorrect, or arrives too early.
The emphasis in the use of formal methods for testing is to gain accurate
measurements as to the reliability of a system, to provide input into a safety
case. Safety cases are justications that a system meets its safety requirements.
In contrast, the purpose of a HAZOPS is to explore the consequences of a failure
in one or more components for the rest of an information system. HAZOPS
are used to gain assurance as to the reliability and safety of a system in the
presence of failures.
As well as being adverse, a system environment may also be considered
hostile. A hostile environment is assumed to contain active agents (sometimes
called threats or attackers) whose goal is to deliberately penetrate, subvert
201
and/or sabotage the deployed system. Examples of systems deployed in hostile
environments include: Examples of systems
operating in hostile en-
vironments
electronic voting systems threatened by agents who wish to subvert the
political result of an election;
automated teller machine cash dispensers which are threatened by thieves
who would like to gain access to their administrative user interfaces in
order to steal money;
friendorfoe detection systems on automated weapon systems, which
are threatened by enemies who wish to trick them into ring on friendly
aircraft, or not ring on hostile aircraft;
digital rights management systems, threatened by copyright pirates who
wish to make unauthorised copies of digital media for re-sale;
network security systems such as rewalls threatened by attackers who
wish to gain unauthorised access to vulnerable services on remote servers;
and
authentication systems threatened by attackers who wish gain unautho-
rised access to information resources.
Distributed systems in particular (or their components), are often considered
to operate in hostile environments, because some or all of the other network
participants are not known to the system itself.
System threats actively search for vulnerabilities, defects in the system that
can be exploited. Consequently, it is necessary in these contexts to conduct
tests to gain assurance that the system is resistant to such attacks. Security
testing metrics include: Security testing met-
rics
attacker capabilities or knowledge required to penetrate the system;
time and resources to penetration, giving an estimate of how long it would
take an adversary, and how much resource would need to be applied in
order to penetrate a system. The idea comes from assessments used for
physical safes which are given a time and resource rating;
unpatched vulnerabilities per line of code;
patches issued per year;
successful penetrations per year;
attack surface exposure.
Methods for security testing include: Security testing meth-
ods
202
vulnerability testing including:
SQL injection testing;
port scanning;
fuzz testing, in which a software system is supplied with unusual or
malformed (fuzzed) inputs that may cause the system to behave in
unexpected (and insecure) ways. Fuzz testing is a way of checking
the extent to which inputs are validated before they are passed on to
business logic code. Fuzz testing is an eective means of detecting
buer-overow vulnerabilities, for example;
and
penetration testing, in which a red team or attack team is tasked with
gaining unauthorised access to the resources protected by a system, equipped
with the same resources expected of an attacker. Penetration testers may
concentrate on technical vulnerabilities or also engage in social engineering
to gain access to a system.
11.2.2 Performance Testing
Performance testing is concerned with assessing how a system copes with dif-
ferent rates of input. Performance testing
throughput the amount of transactions that the system can process in
a given time;
demand the maximum rate of transactions that the system can process;
and
response the average or maximum length of time taken to respond to a
transaction request.
11.2.3 Threshold Testing
Once a property and metric has been identied, there are two types of test that
can be performed with respect to the threshold. Types of threshold
testing
limit testing is concerned with demonstrating that a system behaves nor-
mally within a required limit; and
stress testing is concerned with discovering what happens when a partic-
ular limit is breached.
203
Limit testing is used to demonstrate that a system behaves as expected
within required operating limits. Conversely, stress testing is used to discover
how a system behaves beyond the operating limits specied. Typcially, stress
tests are used to demonstrate that a system continues to behaves reliably or
predictably when operating outside of normal limits. For example, a systems
response to excessive demand may be revert to a safe mode oering only a
limited service to its clients. During the 9/11 terrorist attacks, for example, the
BBCs News Website experienced unusually high requests from users attempting
to obtain uptodate information. The site reverted to a simpler appearance with
less images and video, which required less bandwidth to transmit.
Alternatively, it may be required that the system performs a graceful safe
shutdown, rather than fail completely. Database servers, for example, are often
equipped with Uninteruptable Power Supplies (UPS) which are essentially large
battery packs. If a power loss is experienced, the battery power is used while
the server completes any outstanding transactions on the database and then
initiates a system shutdown.
11.3 Managing Testing within Teams
The testing process for a large system should begin alongside the requirements
elaboration stage of a software development project, as use cases and their cor-
responding scenarios are developed. As for other aspects of large scale software
development, software testing is a typically a collaborative eort within a team.
For larger software projects, software testing may be the responsibility of
one or more quality assurance, or test teams. The role of these test teams
is to develop tests againsts the system and component specications provided
by requirements, design and implementation teams, according to organizational
standards. This arrangement reects a key principle of testing within teams: it
is better to have someone else test your implementation.
It is also a good idea to make one person responsible for ensuring that soft-
ware testing and other quality assurance activities get done. Quality assurance
is not always a popular role, but it is an important one in producing high quality
software products.
As for other aspects of a software project, the test programme needs to be
agreed and documented so that it can be shared with others. A project test
plan complements a requirements specication by documenting the steps that
will be taken to demonstrate that the nal system design and implementation
satses its specication. A test plan consists of: Contents of a test plan
a policy for implementing and documenting unit tests, including general
test procedures;
unit test cases describing the testing of the smallest functional modules
of the system (typically individual classes);
204
defect tests acceptance tests
goal discover defects to be
remedied
demonstrate that the system meets
its specication
derived
from
architecture and design
documents
requirements specication
Table 11.1: defect vs accceptance testing
integration tests and strategy, describing the order in which units are
integrated into sub-systems and tested;
a regression test schedule for unit and integration tests;
acceptance test cases, describing the test cases that have been derived
from the overall system requirements specication; and
an acceptance test demonstration plan.
The use of unit and integration tests for defect testing are describing in the
OOSE lecture notes. The following sections discuss other aspects of a software
team project plan necessary to complete an acceptance test demonstration.
11.3.1 Developing Acceptance Tests
The purpose of acceptance or validation testing is to demonstrate that a sys-
tem meets the requirements of the customer. In contrast, defect testing, as
described during the OOSE course is used to discover defects to improve the
quality of a system. Defect testing is often based on component specications
and internal system design information. Table 11.1 summarises the dierence
between acceptance and defect testing. Acceptance vs. defect-
ing testing Acceptance tests are derived from the overall system specication, including
in particular the systems the use cases, scenarios and non-functional require-
ments. Table 11.2 illustrates the mapping from the parts of a use case to a test
case: Deriving acceptance
tests from use cases
the use case description identies the system boundary object to be in-
teracted with during testing
pre-conditions are used to guide the pre-test setup of the system under
test, including the construction of any xtures for unit tests;
post-conditions are used to describe the situations in which the test case
is passed or failed, depending on provided inputs; and
use cases scenarios can be used to dene the set of inputs for a test
case. Collectively, these inputs are known as the test case test data set.
205
use case test case
description system xture and interface
scenarios test data set
pre-conditions pre-test setup state
post-conditions test-pass conditions
non-functional
requirements
properties and metrics for non-functional tests
priority regression test plan
Table 11.2: derivng acceptance tests from use cases
Identier TC5.2.1
Use case add keeper
Scenario primary
Setup System initialised with data/test-users.db and
data/test-books.db
Interface src/uk/ac/glasgow/minder/MinderSystem
Includes TC5.1.1 (login primary)
TC5.5.1 (search for user primary)
Procedure JUnit Test Case:
src/uk/ac/glasgow/minder/tests/accept/keeper-admin/
AddKeeperPrimary
Inputs searchString="Singer, J" confirm=true
Outcome user Singer is set as a keeper
Figure 11.2: documenting acceptance tests
Scenarios describe the dierent routes through the activities of a use
case, depending on the inputs supplied and the state of the system. If a
comprehensive set of scenarios has been developed, then a corresponding
set of test cases (one per scenario) should provide good coverage of the
system functionality.
Elements of a test data set may be shared between dierent use cases. Documenting accep-
tance tests example
Figure 11.3 illustrates a second example of a test case document, this time of
the key information to be documented for testing non-functional requirements.
Each piece of information is mapped directly from the add keeper use case for
the branch library management system. In the example, the documented test
case is implemented as an automated JUnit test case. The test is conducted
against a facade interface (MinderSystem) which would normally be interacted
with from the user interface. Documentation for
testing non-functional
requirements
206
Identier TC-NF-2
Use case system-wide
Requirement NF 2
Property Demand
Metric Concurrent users
Threshold >= 5
Setup System initialised with data/test-users.db and
data/test-books.db
Interface src/uk/ac/glasgow/minder/MinderSystem
Included TC5.1.1 (login primary)
Procedure JUnit Test Case:
src/uk/ac/glasgow/minder/tests/accept/nf/Demand2
Figure 11.3: documentation test cases for non-functional requirements
11.3.2 Regression Testing
As has already been discussed, the purpose of defect testing is to discover
defects in a software program. Software test cases may be developed as part of
the implementation process (following test rst coding practices, for example)
or when a failure is observed by a user and needs to be documented. It can
be tempting to discard a test case once it is successfully passed by the system.
However, it is not unusual for previously removed defects to be re-introduced
into a system as the software evolves. Regression testing is used to determine
whether a change in the software has resulted in the introduction of a defect.
The regression testing process is shown below. Regression testing
1. Commit new version of software
2. Build and congure
3. Select regression tests to execute
priority
randomly
source of change
4. Conduct test.
5. Open tickets associated with failed tests, due to:
changed requirements
re-introduced defects
As we have discussed, eective testing is expensive, so conducting regression
tests also adds to this costs. It is not always practical to re-run every test case
207
each time a software system is changed. The use of automated testing can ease
this problem, but there are still practical limits. The testing strategy adopted
by the ATLAS team illustrates this issue. Even though the tests are largely
automated, not all tests are run each time a commit is made. However, there
are periodic builds and tests of the entire tool chain for the project when major
versions are released. Similarly, the project is allowed to proceed even though
not all tests will pass for each build of a an individual package.
11.3.3 Conducting Acceptance Test Demonstrations
Some guidelines for conducting acceptance tests are: Acceptance test
demonstrations
Similar to prototype demonstrations, except that:
requirements are to demonstrated as realised rather than explored;
and
a fully functional and interactive system is employed.
Stick strictly within the limits of the system requirements.
Plan and practice the demonstration within the agreed time limit.
Ensure that key use cases are demonstrated satisfactorily.
Record the results of the demonstration.
Be prepared to vary the demonstration at the discretion of the customer
(within the requirements of the system).
11.3.4 Evaluating Test Plans
There are several dierent approaches to evaluating the eectiveness of test
programmes: Evaluating test plans
Document and software inspections;
Statistical analysis; and
Mutation testing.
11.4 Summary
In summary, issues of scale and complexity constrain eective testing of large
scale systems more than eciency. Testing emergent properties rather than
functional features provides a means of evaluating the overall behaviour of a
system, when testing individual components eectively is impractical. An al-
ternative strategy is to automate as much of the testing process as possible to
reduce testing costs.
208
Bibliography
Kent Beck and Cynthia Andres. Extreme Programming Explained. XP Series.
Addison Wesley/Pearson Education, second edition, February 2005.
Kent Beck and Ward Cunningham. A laboratory for teaching object oriented
thinking. ACM SIGPLAN Notices, 24(10):16, October 1989.
Herbert D. Benington. Production of large computer programs. Annals of the
History of Computing, 5(4):350361, October 1983.
Simon Bennett, Steve McRobb, and Ray Farmer. Object Oriented Systems
Analysis and Design Using UML. McGraw Hill, Shoppenhangers Road, Maid-
enhead, Berkshire, SL6 2QL, third edition, 2006.
Barry W. Boehm. A spiral model of software development and enhancement.
ACM Sigsoft Software Engineering Notes, 11(4):1424, August 1988.
Grady Booch. Object oriented design. ACM SIGAda Ada Letters, 1(3):6476,
March/April 1982.
Pierre Bourque and Robert Dupuis, editors. Guide to the Software Engineering
Body of Knowledge, 2004 Edition. IEEE Computer Society, Los Alamitos,
California, March 2005.
Frederick P. Brooks, Jr. The Mythical Man-Month. Addison Wesley, ninth
edition, 1995. ISBN 0-201-83595-9.
Jordi Cabot and Ernest Teniente. Constraint support in MDA tools: a survey.
In Jan P. Nytun, Andreas Prinz, and Merete S. Tveit, editors, Automatic
Generation of Modelling Tools. European Conference on Model-Driven Ar-
chitecture 2006, volume 4066 of Lecture Notes in Computer Science, pages
256267. Springer Verlag, 2006.
Dominique Cansel, J Paul Gibson, and Dominique Mery. Renement: a con-
structive approach to formal software design for a secure e-voting interface.
In 1st International Workshop on Formal Methods for Interactive Systems,
Macau SAR China, October 2006.
209
Darren Dalcher. Disaster in london the LAS case study. In Proceedings of the
IEEE Conference and Workshop on Engineering of Computer-Based Systems,
ECBS 99, pages 4152, Nashville, TN, USA, March 1999. IEEE Computer
Society Press.
Khaled El Emam and A. G unes

Ay Koru. A replicated survey of IT software


project failures. IEEE Software, 25(5):8490, September/October 2008.
Anthony Finkelstein and John Dowell. A comedy of errors: the london ambu-
lance service case study. In Proceedings of the Eighth International Workshop
on Software Specication and Design, pages 24, Washington, DC, USA,
1996. IEEE Computer Society Press.
Robert L. Glass. Software runaways some surprising ndings. The DATA BASE
for Advances in Information Systems, 28(3):1619, Summer 1997.
Ron Gould. Independent review of the Scottish Parliamentary and local gov-
ernment elections 3 may 2007. The Electoral Commission, Trevelyan House,
Great Peter Street, London, SW1P, October 2007.
Richard Hopkins and Kevin Jenkins. Eating the IT Elephant: Moving from
Greeneld Development to Browneld. IBM Press, 2008.
William E. Howden. Validation of scientic programs. Computing Surveys, 14
(2):193227, June 1982.
Gerwin Klein, Kevin Elphinstone, Gernot Heiser, June Andronick, David Cock,
Philip Derrin, Dhammika Elkaduwe, Kai Engelhardt, Rafal Kolanski, Michael
Norrish, Thomas Sewell, Harvey Tuch, and Simon Winwood. seL4: Formal
verication of an OS kernel. In , editor, To appear 22nd ACM Symposium
on Principles of Operating Systems (SOSP), pages , Big Sky, MT, USA,
October 2009.
Karl Koscher, Alexei Czeskis, Franziska Roesner, Shwetak Patel, Tadayoshi
Kohno, Stephen Checkoway, Damon McCoy, Brian Kantor, Danny Ander-
son, Hovav Shacham, and Stefan Savage. Experimental security analysis of a
modern automobile. In 31st IEEE Symposium on Security and Privacy, pages
447462, Berkeley/Oakland California, USA, May 2010. IEEE Computer So-
ciety.
Philippe Kruchten. Rational Objectory Process. Rational Software Corporation,
4.1 edition, September 1997.
Timothy C. Lethbridge and Robert Lagani`ere. Object-Oriented Software En-
gineering. McGraw Hill, Shoppenhangers Road, Maidenhead, Berkshire,
SL62QL, second edition, 2005. Practical Software Development using UML
and Java.
210
Russell Lock, Tim Storer, Natalie Harvey, Conrad Hughes, and Ian Sommerville.
Observations of the Scottish elections 2007. Transforming Government: Peo-
ple, Process and Policy, 2(2):104118, 2008.
James Martin. Rapid Application Development. Macmillan, 886 Third Avenue,
New York, New York 10022, 1991.
Greg Miller. Scientic publishing: A scientists nightmare: Software problem
leads to ve retractions. Science, 314(5807):18561857, 2006.
Chris Morris. Some lessons learned reviewing scientic code. In , editor,
SECSE08, volume of , pages , Leipzig Germany, May 2008. , .
B. T. Mynatt. Software Engineering with Student Project Guidance. Prentice-
Hall, 1990.
Peter Naur and Brian Randell, editors. Report on a conference sponsored by
the NATO Science Committee, Garmisch, Germany

1968 1968.
Emil Obreshkov. Software release build process and components in ATLAS
oine. In Conference on Computing in High Energy and Nuclear Physics
2010, Taipei, Taiwan, October 2010.
Eric S. Raymond. The cathedral and the bazaar: musings on linux and open
source by an accidental revolutionary. Information Research, 6(4), 2001. URL
http://www.tuxedo.org/~esr/writings/cathedral-bazaar/.
RC. The rational unied process. white paper TP026B, The Rational Corpora-
tion, 2003.
Bruce Robinson. Limited horizons, limited inuence: Information technology the
london ambulance service. In Proceedings of the International Symposium on
Technology and Society Technical Expertise and Public Decisions, pages 506
514. IEEE Computer Society Press, June 1996.
Scott Rosenberg. Dreaming in Code. Crown, 2007.
James Rumbaugh, Michael R. Blaha, William Premerlani, Frederick Eddy, and
William Lorensen. Object Oriented Modelling and Design. Prentice-Hall
International, Englewood Clis, New Jersey, rst edition, October 1991.
Rebecca Sanders and Diane Kelly. Dealing with risk in scientic software devel-
opment. IEEE Computer Software, 25, 2008.
Ian Sommerville. Software construction by conguration: Challenges for soft-
ware engineering research. In Proceedings of the 21st IEEE International
Conference on Software Maintenance, Budapest, Hungary, September 2005.
IEEE Computer Society.
211
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, eighth edition, 2007.
Ian Sommerville. Software Engineering. International computer science.
Addison-Wesley, ninth edition, 2010.
South West Thames Regional Health Authority. Report of the inquiry into the
london ambulance service. South West Thames Regional Health Authority,
February 1993.
Tim Storer and Russell Lock. Accuracy: The fundamental requirement for
voting systems. In Proceedings of the The Third International Conference on
Availability, Reliability and Security, ARES 2008, pages 374379, Fukuoka,
Japan, March 2009. IEEE Computer Society.
U.S. CFTC/SEC. Findings regarding the market events of May 6, 2010. report
of the stas of the CFTC and SEC to the joint advisory committee on emerg-
ing regulatory issues. U.S. Commodity Futures Trading Commission. Three
Lafayette Centre, 1155 21st Street, NW Washington, D.C. 20581. U.S. Se-
curities & Exchange Commission 100 F Street, NE Washington, D.C. 20549,
September 2010.
Stephen Viller and Ian Sommerville. Ethnographically informed analysis for
software engineers. International Journal of Human-Computer Studies, 53
(1):169196, 2000.
Jim Woodcock and Ana Cavalcanti. A concurrent language for renement. In
Andrew Buttereld, Glenn Strong, and Claus Pahl, editors, 5th Irish Workshop
on Formal Methods, IWFM 2001, Workshops in Computing, Ireland, Dublin,
July 2001. British Computer Society.
212
Appendix A
Use Case Description Template
A collection of LaTeX macros have been dened for a use case description
template in the latex style package usecasedescription. The source le for the
macros is available at.
http://fims.moodle.ac.uk/course/view.php?id=128...
The basic template is an environment that can be included in a L
A
T
E
X doc-
ument as shown below:
%...
\usepackage{usecasedescription}
%...
\begin{document}
%...
\begin{UseCaseTemplate}
\UseCaseLabel {}
\UseCaseDescription {}
\UseCaseRationale {}
\UseCasePriority {}
\UseCaseStatus {}
\UseCaseActors {}
\UseCaseExtensions {}
\UseCaseIncludes {}
\UseCaseConditions {}
\UseCaseNonFunctionalRequirements {}
\UseCaseScenarios {}
\UseCaseRisks {}
\UseCaseUserInterface {}
\end{UseCaseTemplate}
The template appearance and usage is illustrated on the next page:
213
Use case the use case label as appears on the use case diagram
Description a brief textual description of the activity that occurs during the
use case, accompanied by an activity diagram or pseudo code
as appropriate
Rationale a justication of the use case based on evidence gathered during
requirements elicitation
Priority MoSCoW categorisation of the use case
Status the status of the use case (e.g. implemented, not elaborated)
and any changes that have been made to it
Actors a list of the actors associated with this use case as shown on
the use case diagram
actor 1
actor 2
...
Extensions a list of the use cases that extend this use case as shown on the
use case diagram
use case 1
use case 2
...
Includes a list of use cases included by this use case, as shown on the
use case diagram
use case 3
use case 4
...
Conditions a list of pre and post conditions
pre condition 1
pre condition 2
post condition 1
...
214
Non-
Functional
Requirements
a list of categorised, use case specic non-functional require-
ments
security
user interface
...
Scenarios a list of all the scenarios produced for this use case. Include key
scenarios in the requirements document appendix
primary:
alternative 1:
alternative 2:
...
Risks a list of use case specic risks, referencing more detailed risk
descriptions in the risk management plan.
risk 1.1
risk 2.5
risk 3.1.1
...
User Interface user interface requirements relevant to this use case
215

You might also like