Supplementary Slides for Software Engineering: A Practitioner's Approach, 5/e

Download Report

Transcript Supplementary Slides for Software Engineering: A Practitioner's Approach, 5/e

Supplementary Slides for
Software Engineering:
A Practitioner's Approach, 5/e
copyright © 1996, 2001
R.S. Pressman & Associates, Inc.
For University Use Only
May be reproduced ONLY for student use at the university level
when used in conjunction with Software Engineering: A Practitioner's Approach.
Any other reproduction or use is expressly prohibited.
This presentation, slides, or hardcopy may NOT be used for
short courses, industry seminars, or consulting purposes.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
1
Slide 18
Chapter 16
Component-Level Design
Chapter 16 at SEPA
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
2
Component-Level Design
the closest design activity to coding
the approach:
 review the design description for the
component
 use stepwise refinement to develop algorithm
 use structured programming to implement
procedural logic
 use ‘formal methods’ to prove logic
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
3
Stepwise Refinement
open
walk to door;
reach for knob;
open door;
walk through;
close door.
repeat until door opens
turn knob clockwise;
if knob doesn't turn, then
take key out;
find correct key;
insert in lock;
endif
pull/push door
move out of way;
end repeat
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
4
The Component-Level
Design Model
represents the algorithm at a level of detail
that can be reviewed for quality
options:
 graphical (e.g. flowchart, box diagram)
 pseudocode (e.g., PDL) ... choice of many
 programming language
 decision table
 conduct walkthrough to assess quality
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
5
Structured Programming
for Procedural Design
uses a limited set of logical constructs:
sequence
conditional — if-then-else, select-case
loops — do-while, repeat until
leads to more readable, testable code
important for achieving high quality,
but not enough
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
6
A Structured Procedural Design
add a condition Z,
if true, exit the program
a
x1
b
x2
x3
d
c
e
f
x4
g
x5
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
7
Box Diagram (Nassi-Schneiderman chart)
Repetition
condition
1st task
Do-while
part
next task
Repeatuntil
part
Next+1 task
condition
Sequence
F
condition
Else
part
condition
T
value
value
…
Case
part
…
Selection
Then
part
Case
part
If-then-else
++
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
8
Tabular design
Condition
Fixed rate account
Variable rate account
Consumption < 100 kwh
Consumption >= 100 kwh
1
2
Rules
3
T
F
T
F
T
F
F
T
F
T
T
F


4
5
F
T
F
T
F
F
Condition
Min. monthly charge
Schedule A billing
Schedule B billing
Other treatment
++



These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
9
Program Design Language (PDL)
if condition x
then process a;
else process b;
endif
if-then-else
PDL
easy to combine with source code
machine readable, no need for graphics input
graphics can be generated from PDL
enables declaration of data as well as procedure
easier to maintain
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
10
Why Design Language?
can be a derivative of the HOL of choice
e.g., Ada PDL
machine readable and processable
can be embedded with source code,
therefore easier to maintain
can be represented in great detail, if
designer and coder are different
easy to review
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
11
Comparison of Design Notation
 Modularity
 Overall simplicity
 Ease of editing
 Machine readability
 Maintainability
 Structure enforcement
 Automatic processing
 Data representation
 Logic verification
 “Code-to” ability
++
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
12
THE ENDS
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
13
Latihan
Gambarkan diagram N-S chart dari flowchart d ibawah ini:
A
T
T
X2
X1
F
F
B
F
C
X3
D
T
E
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
14
Latihan 2
Untuk pembayaran pemakaian listrik, digunakan skenario sebagai
berikut:
Jika pelanggan menggunakan sistem langganan Fixed-rate, tagihan
bulanan minimum dikenakan kepada mereka yang menggunakan
daya listrik kurang dari 100 kwh. Bila konsumsi listrik 100 kwh atau
lebih, komputer akan mengenakan penagihan berdasarkan Schedule
A billing.
Apabila konsumen menggunakan sistem langganan Variable-rate,
komputer akan menghitung tagihan bulanan berdasarkan Schedule A
billing bagi pelanggan yang mengkonsumsi listrik kurang dari 100
kwh. Bila pemakaian lebih dari itu, pelanggan jenis ini akan
dikenakan Schedule B billing.
Buatlah Tabel Keputusan (Decision Table) untuk masalah tersebut
diatas.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
15