Writing The Programs: Shari L. Pfleeger Joann M. Atlee
Writing The Programs: Shari L. Pfleeger Joann M. Atlee
Programs
Shari L. Pfleeger
Joann M. Atlee
4th Edition
Contents
• Simplified algorithm
for (int i=2, level=1; i <= 5; i++)
if (taxable_icome > bracket[i])
level = level + 1;
tax= base[level]+percent[level] * (taxable_income - bracket[level]);
Pfleeger and Atlee, Software Engineering: Theory and Chapter 7.13
Practice
7.2 Programming Guidelines
General Guidelines to Preserve Quality
• Employ pseudocode a
e f
• Revise and rewrite, rather than patch R
– Convoluted control flow
Re
– Decision process hard to understand
– Unconditional branches difficult to eliminate
• Reuse
– Producer reuse: create components designed to
be reused in future applications
– Consumer reuse: reuse components initially
developed for other projects
• Internal documentation
– header comment block
– meaningful variable names and statement labels
– other program comments
– format to enhance understanding
– document data (data dictionary)
• External documentation
– describe the problem
– describe the algorithm
– describe the data
• Design Description
Input: Opposition schedule
For each Television company name, create Opposition company.
For each Opposition schedule,
Locate the Episode where Episode schedule date =
Opposition transmission date AND
Episode start time = Opposition transmission time
Create instance of Opposition program
Create the relationships Planning and Competing
Output: List of Opposition programs
• Data dictionary description
Opposition schedule = * Data flow *
Television company name
+ {Opposition transmission date
+ Opposition transmission time +
Opposition program name
+ (Opposition predicted rating)}