2012 Quality Assurance Introduction to Part II › ~lutteroth › teachings › ... · Christof...
Transcript of 2012 Quality Assurance Introduction to Part II › ~lutteroth › teachings › ... · Christof...
/2012
254
11/09/
Quality AssuranceIntroduction to Part II
SO
FTE
NG
Introduction to Part II
eala
nd Part II - Lecture 1
klan
d | N
ew Z
eve
rsity
of A
uck
The
Uni
v
1
Christof Lutteroth/2012 • From Berlin, Germany
254
11/09/
y• Some years ago this was the first lecture given by me
(you can watch the old lectures on video)M h i t t HCI SE t l
SO
FTE
NG
• My research interests: HCI, SE tools, …• Contact details:
christof@cs auckland ac nz
eala
nd
[email protected] 373-7599 84478Office: 303 - 494 (4th level CompSci building)
klan
d | N
ew Z
e
• If you have questions, come to my office at any time
vers
ity o
f Auc
kTh
e U
niv
2
/2012
254
11/09/
SO
FTE
NG
Introduction to Part II
eala
nd
Introduction to Part II
klan
d | N
ew Z
e
Quality means doing it right h i l ki
vers
ity o
f Auc
k when no one is looking(Henry Ford)
The
Uni
v
3
Why not just Dynamic Detection of Defects?
/2012
Detection of Defects?• First half mostly about dynamic detection of defects
254
11/09/
y y• Can be time consuming, costly, complicated…but is
necessary!!!R i ( ti ll ) i t l d
SO
FTE
NG
• Requires a (partially) running system already. What if we don’t have it yet?
• Usually in the implementation stage of a project
eala
nd
Usually in the implementation stage of a project.What if the defect has its origin in the specification or design?
klan
d | N
ew Z
e
• What if our test cases contain defects?
vers
ity o
f Auc
k
How can we avoid defects in the first place?
The
Uni
v
4
p
Static Detection of Defects/2012
• If we cannot avoid defects, detect them as early as
254
11/09/
, ypossible
• “Static” means before runtime
SO
FTE
NG
• Most compilers detect many type errors (type systems), other tools detect even more errors
eala
nd
• The more specification we give, the more we can verify; formal specification languages (e.g. Z, Alloy, H C l l s)
klan
d | N
ew Z
e Hoare Calculus)• Sad result from theory:
some errors cannot be detected statically!!!
vers
ity o
f Auc
k some errors cannot be detected statically!!!• But we can be “conservative”:
prohibit even code that might be an error
The
Uni
v
5
prohibit even code that might be an error
Best Practices/2012 • Avoiding the mistakes that cause defects by “doing
254
11/09/
g y gthe right thing” – Software development processes:
how to undertake a software project
SO
FTE
NG
how to undertake a software project– Software tools:
use the best suitable tools to get the best results
eala
nd
use the best suitable tools to get the best results– Design & coding guidelines:
how to avoid design/programming mistakes
klan
d | N
ew Z
e
• Learn from other’s experience & mistakes (not as effective as learning from own mistakes, but
)
vers
ity o
f Auc
k saves time )• But: what works for others does not necessarily work
for you (nothing can replace your own experience)
The
Uni
v
6
for you (nothing can replace your own experience)
/2012
254
11/09/
SO
FTE
NG
Software Development
eala
nd
Processes
klan
d | N
ew Z
e
“I love it when a plan
vers
ity o
f Auc
k pcomes together! “
The
Uni
v
7
eXtreme Programming (XP)
/2012
(XP) 2
5411/09/
SO
FTE
NG
Don Wells
eala
ndkl
and
| New
Ze
• Generic plan of how to conduct a project
vers
ity o
f Auc
k conduct a project• 12 best practices
R li s h il n f db k
The
Uni
v
8
• Relies heavily on feedback about the software
Rational Unified Process (RUP)
/2012
(RUP) 2
5411/09/
SO
FTE
NG
ea
land
klan
d | N
ew Z
eve
rsity
of A
uck
• Comprehensive process framework
The
Uni
v
9Giles Lewis
• Comprehensive process framework• Used esp. For large projects
/2012
254
11/09/
SO
FTE
NG
Software Development Tools
eala
nd
Software Development Tools
klan
d | N
ew Z
e
First we shape our tools and th t l h
vers
ity o
f Auc
k then our tools shape us(Marshall McLuhan)
The
Uni
v
10
Software Tools/2012 • Humans are necessary for creative,
254
11/09/
yintelligent tasks
• Tools can support such tasksI d ti it ith f l
SO
FTE
NG
– Increase productivity with useful functionality
– Guide the developer (e g context help)
eala
nd
Guide the developer (e.g. context help)– Avoid defects
H f h hl
klan
d | N
ew Z
e • Humans are not necessary for highly repetitive, routine work
• Tools can automate such tasks
vers
ity o
f Auc
k • Tools can automate such tasks– Increase productivity; more time for
creative work
The
Uni
v
11– Avoid defects introduced by the human factor
Modeling tools/2012
g 2
5411/09/
SO
FTE
NG
ea
land
klan
d | N
ew Z
eve
rsity
of A
uck
The
Uni
v
12
GUI Builders/2012
254
11/09/
SO
FTE
NG
ea
land
klan
d | N
ew Z
eve
rsity
of A
uck
The
Uni
v
13
Version Control Systems/2012
y
• Technology to manage changes that several
254
11/09/
gy g gdevelopers do on a common repository
• Changes create new version of the changed files
SO
FTE
NG
• Old versions are always accessibleDevelopers
eala
nd WorkingCopy Repository
Developers
klan
d | N
ew Z
e y p y
Version 5Working
vers
ity o
f Auc
k
Version 2Version 3
Version 4Copy
W ki
The
Uni
v
14Version 1Working
Copy
Version Control SystemsExample: Subversion
/2012
Example: Subversion 2
5411/09/
SO
FTE
NG
ea
land
klan
d | N
ew Z
eve
rsity
of A
uck
The
Uni
v
15
Build ToolsExample: make
/2012
Example: make 2
5411/09/ all: calc
calc: main o math o
Dependency graph
SO
FTE
NG
calc: main.o math.o g++ main.o math.o -o calc calc
eala
nd
main.o: main.cpp g++ -c main.cpp
main.o math.o
klan
d | N
ew Z
e
math.o: math.cpp math.hg++ -c math.cpp
vers
ity o
f Auc
k
clean: rm * o
main.cpp math.hmath.cpp
The
Uni
v
16
rm .o
Documentation ToolsExample: JavaDoc
/2012
Example: JavaDocpublic class Stack {/**
254
11/09/ /
* Pushes an item on to * the top of this stack. * @param item the item to be pushed.
SO
FTE
NG
*/ public void push(Objec item){
this.elements.add(item);}
eala
nd
/** * Removes the object at the top* of this stack and returns that * object
klan
d | N
ew Z
e object. * @return The object at the top * of this stack. * @exception NoSuchElementException
vers
ity o
f Auc
k * if this stack is empty. */
public Object pop() throws NoSuchElementException {
The
Uni
v
17
throws NoSuchElementException { // ...
} }
Generators/2012
JSPGeneration of a web UI
254
11/09/
GeneratorJSP
JSPJSP
SO
FTE
NG
JSP
Generation of Java classes
eala
nd Generator
ClassClass
Class
klan
d | N
ew Z
e
Class
Generation of language parsers
vers
ity o
f Auc
k Generation of language parsers
GeneratorSource code
for parserLanguagegrammar
The
Uni
v
18
grammar
/2012
254
11/09/
SO
FTE
NG
Coding Principles
eala
nd
Coding Principles
klan
d | N
ew Z
e
“Use the source, Luke”
vers
ity o
f Auc
k ,
The
Uni
v
19
Coding Style/2012
g y 2
5411/09/
SO
FTE
NG
ea
land
main(a,b){while((a=getchar())+1)
putchar((b=64^a&223)
klan
d | N
ew Z
e putchar((b=64 a&223)&&b<27?a&96
|(b+12)%26+1:a);}
vers
ity o
f Auc
k
• International Obfuscated C Code Contest (ioccc.org)• Coding style guidelines help to achieve clear,
The
Uni
v Coding style guidelines help to achieve clear, consistent code (esp. when many people are involved) 20
Coding Principles/2012
g p
I t f
254
11/09/ Interface
vsImplementation
SO
FTE
NG
ea
land
klan
d | N
ew Z
eve
rsity
of A
uck
The
Uni
v
21Handling Exceptions Information Hiding(painting by Bev Doolittle)
Today’s summary/2012
y y
• Dynamic detection of defects (e.g. testing,
254
11/09/
y ( g g,debugging) is necessary, but not enough
• Static checking (e.g. with type systems) can detect
SO
FTE
NG
some defects before runtime • We can avoid defects by following best practices of
f d l d i l
eala
nd
software development and using tools• Software tools support the developer in performing
ti t sks d t t ti t sks
klan
d | N
ew Z
e creative tasks and can automate routine tasks
vers
ity o
f Auc
k
This week no tutorial, no lab.Friday: Part 4 Exhibition!
The
Uni
v
22
Friday Part 4 Exhibition!
Quiz/2012
Q
1. How can defects be avoided?
254
11/09/
Name and explain 3 examples.
SO
FTE
NG
2. What tools exist for supporting software development? Name 5 examples and explain what they do
eala
nd
Name 5 examples and explain what they do.
klan
d | N
ew Z
eve
rsity
of A
uck
The
Uni
v
23