Personal Software Process

Download Report

Transcript Personal Software Process

Topic 5
Planning III – Estimating
Software Size
1
Lecture Overview
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
Background
Popular Estimating Methods
Proxy-based Estimating
The PROBE Size Estimating Method
Object Categories
Estimating Considerations
Summary
Exercises
2
Topic 5 Planning III—Estimating Software Size
5.1 Background
3
Topic 5 Planning III—Estimating Software Size
5.1 Background 1

Why Estimate Size?

Size estimates allow you to make better plans.



The more details you have, the more accurate the
estimation will be.


Plan better for the resources, tasks, and schedule.
The quality of a plan depends on that of the size estimate.
For a large software job, divide it into separate elements.
Size estimates assist you in tracking progress.
You can


judge when the job scope changes.
better measure the work.
4
Topic 5 Planning III—Estimating Software Size
Background 2

Estimating models in other fields




have a large historical base.
are widely used.
generate detailed planning data.
require a size estimate as input.
5
Topic 5 Planning III—Estimating Software Size
Project Planning Framework



The framework is shown in Figure 5.1.
Size estimating: compare the design
elements with the historical size data to
make estimates.
Accurate size estimation will lead to
accurate resource estimation.
6
Topic 5 Planning III—Estimating Software Size
Customer
Need
Define the
Requirements
Items
Tasks
Produce the
Conceptual
Design
Estimate the
Product Size
Customer
(Topic 5)
Estimate the
Resources
(Topic 6)
Produce the
Schedule
(Topic 6)
Delivered
Product
Develop the
Product
Historical
Size
Database
Historical
Productivity
Database
Resources
Available
Size,
Resource,
Schedule
data
Management
Process
Analysis
Tracking
Reports
Fig. 5.1 Project Planning Framework
7
Topic 5 Planning III—Estimating Software Size
Estimating Experience

Studies show that





size estimation errors may be as high as 100% or even more.
Only 22% professionals make size estimates for cost
estimates.
For software development, usually people have a larger
estimation error percentage (up to 400%) in early phase, and
then the percentage declines (25% or less) in later phases.
Serious size estimation errors result in poor resource
estimates and unrealistic project schedules.
Fortunately, the size estimation skill can be learned and
improved.
8
Topic 5 Planning III—Estimating Software Size
Size Estimating Criteria

A widely used method should be






structured and trainable.
usable during all development and maintenance
phases.
usable for all types of software product elements.
suitable for statistical analysis.
adaptable to the types of your future work.
able to judge the accuracy of the estimates.
9
Topic 5 Planning III—Estimating Software Size
Size Estimating Principles 1

Estimating is an uncertain process.




No one knows how big the product will be
The earlier the estimate, the less is known
Estimates can be biased by business and
other pressures (sometimes called ‘‘gutless’’
estimations)
Estimating is an intuitive learning process.


Ability improves with experience
Some people are better at estimating
10
Topic 5 Planning III—Estimating Software Size
Size Estimating Principles2


Estimating is a skill.
 Improvement will be gradual
 You may never get very good
The objective, however, is to get consistent - at least “unbiased.”
 You will then understand the variability of
your estimates
 You seek an even balance between
under and over estimates
11
Topic 5 Planning III—Estimating Software Size
% Error
Size Estimating Errors - 12 Students
Program Number
12
Topic 5 Planning III—Estimating Software Size
Size Estimating Principles 3

The principal advantages of using a defined
estimating method are:



You have known practices that you can work to
improve.
It provides a framework for gathering estimating
data.
By using consistent methods and historical data,
your estimates will get more consistent.
13
Topic 5 Planning III—Estimating Software Size
5.2 Popular Size Estimating
Methods
14
Topic 5 Planning III—Estimating Software Size
5.2 Popular Size Estimating
Methods

Four popular methods





Wideband-Delphi
Fuzzy-Logic
Standard-Component
Function-Point
Their concepts form the foundation of the
PROBE (Proxy-based Estimating) method
used with the PSP.
15
Topic 5 Planning III—Estimating Software Size
Wideband-Delphi Method 1






Originated by Rand Co. and refined by Boehm.
Based on the Delphi process, which usually contains several
cycles.
Several experts (estimators) and a moderator are involved in
the process.
Each expert makes an independent estimate and submit it to
the moderator in each cycle.
The moderator coordinates the estimation process for these
experts whose estimates are anonymous to all others.
The process runs until experts’ estimates converge on a
consensus result.
16
Topic 5 Planning III—Estimating Software Size
Wideband-Delphi Method 2
The method’s process is as follows:

1.
2.
3.
4.
A group of experts is each given the program’s
specifications and estimation forms.
They meet to discuss project goals,
assumptions, and estimation issues.
They then each anonymously list project tasks
and estimation size.
The estimates are given to the moderator, who
tabulates the results and returns them to the
experts, as illustrated in Figure 5.2.
17
Topic 5 Planning III—Estimating Software Size
Project: XYZ
Estimator: John Doe
Date:4/1/94
Here is the range of estimates from the 1st round:
X
0
20
X*
X!
40
X
60
X
80
100
X - estimates
X* - your estimate
X! – median estimate
Please enter your estimate for the next round: ___SLOC.
Please enter explain rationale for your estimate.
Fig. 5.2 The Chart Used in Wideband-Delphi
18
Topic 5 Planning III—Estimating Software Size
Wideband-Delphi Method 3
5.
6.
7.
Only each expert’s personal estimate is
identified; all others are anonymous.
The experts meet to discuss the results. They
each review the tasks they have defined but not
their size estimates.
The cycle continues at step 3 until the estimates
converge to within an acceptable range.
19
Topic 5 Planning III—Estimating Software Size
Delphi Example 1


3 estimators are asked to estimate the product.
Their initial estimates are:




A - 13,800 LOC
B - 15,700 LOC
C - 21,000 LOC
The coordinator then


Calculates average estimate as 16,833 LOC
Returns this with their original estimates to the
estimators
20
Topic 5 Planning III—Estimating Software Size
Delphi Example 2


The estimators then meet and discuss the estimates.
Their second estimates are




A - 18,500 LOC
B - 19,500 LOC
C - 20,000 LOC
The coordinator then


Calculates average estimate as 19,333 LOC
Asks the estimators if they agree with this as the
estimate
21
Topic 5 Planning III—Estimating Software Size
Wideband-Delphi Method 4

Advantages




can produce accurate results
uses organization’s skills
works for any size products.
Disadvantages



relies on a few experts
time consuming
subject to common biases
22
Topic 5 Planning III—Estimating Software Size
Fuzzy-Logic Method 1


Estimators compare the planned program with prior
programs and select the most appropriate size
category.
Preparing for this method





gather sufficient size data on previously developed
programs
subdivide these data into size categories and
subcategories
provide a meaningful number of program examples in
each size category and subcategory
extend the size ranges up or down as you get further
data
Table 5.1 shows the example.
Topic 5 Planning III—Estimating Software Size
23
Subrange
Gross
Range
Very small
LOC
Small
LOC
Medium
LOC
Large
LOC
Very Large
LOC
Very small
1,1,48
1,514
2,000
2,630
3,467
Small
4,570
6,025
8,000
10,471
13,804
Medium
18,197
23,988
32,000
41,687
54,954
Large
72,444
95,499
128,000
165,958
218,776
288,403
380,189
512,000
660,693
870,964
Very Large
Table 5.1 Example for Fuzzy-Logic Method
Fuzzy-Logic Method 2

Advantages




based on relevant historical data
easy to use
requires no special tools or training
provides reasonably good estimates in cases
where new work is like prior experience
25
Topic 5 Planning III—Estimating Software Size
A Fuzzy Logic Example 1

You have historical data on 5 programs as
follows:





a file utility of 1,844 LOC
a file management program of 5,834 LOC
a personnel record keeping program of 6,845
LOC
a report generating package of 18,386 LOC
an inventory management program of 25,943
LOC
26
Topic 5 Planning III—Estimating Software Size
A Fuzzy Logic Example 2

You establish 5 ranges, as follows






log(1844) = 3.266
log(25,943) = 4.414
the difference is 1.148
1/4th this difference is 0.287
the logs of the five ranges are thus spaced
0.287 apart
the limits or these ranges are at 0.1435
above and below the midpoint of each range
27
Topic 5 Planning III—Estimating Software Size
A Fuzzy Logic Example 3

The 5 size ranges are thus:





very small
- 1,325 to 2,566: file utility
small
- 2,566 to 4970: no members
medium
- 4,970 to 9,626: file management and
personnel record program
large
- 9,626 to 18,641: report generator
very large
- 18,641 to 36,104: inventory
management
28
Topic 5 Planning III—Estimating Software Size
A Fuzzy Logic Example 4

Your new program has the following
requirements:




analyze marketing performance by product
line
project the likely sales in each product
category
allocate these sales to marketing regions and
time periods
produce a monthly report of these projections
and the actual results
29
Topic 5 Planning III—Estimating Software Size
A Fuzzy Logic Example 5


In comparing the new program to the historical data
you make the following judgments:
 substantially more complex application than the file
management and personnel programs
 not as complex as the inventory management
program.
 appears to have significantly more function than the
report package.
You conclude that the new program is in the lower
end of “very large,” or from 18 to 25 KLOC.
30
Topic 5 Planning III—Estimating Software Size
Fuzzy Logic - Summary

To make a fuzzy logic estimate:
1 - Divide the historical product size data into
size ranges.
2 - Compare the planned product with these
prior products.
3 - Based on this comparison, select the size
that seems most appropriate for the new
product.
31
Topic 5 Planning III—Estimating Software Size
Fuzzy-Logic Method
Disadvantages

Fuzzy logic estimating





requires a lot of data
requires that the estimators be familiar with the
historically developed programs
provides only a crude sizing
not useful for new program types
not useful for programs that are much larger or
smaller than the historical data
32
Topic 5 Planning III—Estimating Software Size
Standard-Component Method 1

Use organization’s historical data to
determine the typical size of various types of
components


subsystems, modules, screens, reports, etc.
For a new project


Judge the number of each type of components will
likely be in the project.
Also determine the maximum and minimum
numbers of each type of components you could
image.
33
Topic 5 Planning III—Estimating Software Size
Standard-Component Method 2

Calculate the estimated number of each type with


The estimated size of each type is


(4*likely number + max. number + min. number) / 6
its estimated number * its typical size from historical
data
Sum up the estimated size of all types to get the
total size.
34
Topic 5 Planning III—Estimating Software Size
Standard Component
SLOC per
Component
M
L
2,535
3
6
10
932
11
18
22
17.5
16,310
10.3
8,453
SLOC
1
Object Instructions
0.28
Files
Modules
Subsystems
X=
(S+4*M+L)/6
S
SLOC
6.17 15,633
8,175
Screens
818
5
9
21
Report
967
2
6
11
Interactive Programs
1,769
Batch Programs
3,214
Total
6.17
5,963
46,359
Table 5.2 Example of Component Estimating
For modules, its estimated size = 932 * 17.5 = 16310.
Standard-Component Method 3

Advantages





based on relevant historical data
easy to use
requires no special tools or training
provides a rough estimate range
Disadvantages



must use large components early in a project
limited data on large components
hard to visualize component counts early in a
project
36
Topic 5 Planning III—Estimating Software Size
Function-Point Method 1

Count the numbers of the 5 types of basic functions that
the commercial application program will likely need by
reviewing its requirements.





Inputs: screens or forms through which to add new data or
update existing data in the application
Outputs: screens or reports that the application produces
Inquires: screens used to ask for interrogation, assistance or
information
Data files: logical collection of records that the application
updates
Interface: e.g., files shared with other applications, shared
databases, parameter lists, …
37
Topic 5 Planning III—Estimating Software Size
Function-Point Method 2


Each type has a given weight.
Calculate the function points of the
application



multiply the number of each type by its weight.
sum them up to get the total (unadjusted).
Use historical data on development cost and
time per function point to make the estimates.
38
Topic 5 Planning III—Estimating Software Size
Basic
Counts
Function Type
Weights
Inputs
×4
Outputs
×5
Inquiries
×4
Logical Files
Interfaces
Total
×10
×7
Unadjusted Total
Table 5.3 Function-Point Categories
39
Topic 5 Planning III—Estimating Software Size
Basic
Counts
Function Type
Weights
Total
8 Inputs
8
×4
32
12 Outputs
12
×5
60
4 Inquiries
4
×4
16
2 Logical Files
2 ×10
20
1 Interfaces
1
×7
7
Unadjusted
Total
Table 5.4 Function-Point Category Example
135
Function-Point Method 3

To improve the estimation, adjust the function
points by 14 influence factors.



The influence factor values are selected from 0
(very simple) to 5 (very complex) by the judgment
of the estimator.
Sum up these values.
Calculate the complexity multiplier


Calculate adjusted function points



0.65+0.01*(sum of influence factor values)
complexity multiplier * unadjusted function points
The adjustment is between ±35%
Table 5.5 shows an example.
41
Topic 5 Planning III—Estimating Software Size
Factor
Influence
Data Communications
2
Distributed Functions
0
Performance objectives
3
Heavily used configuration
3
Transaction rate
4
On line data entry
4
End-user efficiency
3
On line update
2
Complex processing
3
Reusability
2
Installation ease
3
Operational ease
4
Multiple sites
5
Facilitate change
3
Sum of influence factors =
41
0.65+0.01*(sum of Influence Factors)=Complexity Multiplier=
Function Points=Complexity Multiplier*Unadjusted Function Points=
1.06
143
Table 5.5 An Example of Function-Point Influence Factors
42
Topic 5 Planning III—Estimating Software Size
Function-Point Method 4

Advantages





a well-documented method
usable in the earliest requirements phase
independent of programming languages, product
designs, development styles
having a large body of historical data
with an active user group
43
Topic 5 Planning III—Estimating Software Size
Function-Point Method 5

Disadvantages




cannot directly count an existing product’s function
point content
without historical data, difficult to improve
estimating skill
not reflect language, design, and style differences
designed for estimating commercial data
processing applications
44
Topic 5 Planning III—Estimating Software Size
5.3 Proxy-based Estimating
(PROBE)
45
Topic 5 Planning III—Estimating Software Size
5.3 Proxy-Based Estimating
(PROBE)

In stead of direct estimating, a proxy is a
substitute to help estimators judge product
size.

Proxies, for example, can be objects, screens,
files, scripts, document chapters, function points,
and so on.
46
Topic 5 Planning III—Estimating Software Size
Criteria for a Good Proxy 1

The proxy size measurement (or estimate) should
closely relate to the effort required to develop the
product.

Use the correlation method (see Topic 15) to determine
which proxy is a better predictor of product size or
development effort.
47
Topic 5 Planning III—Estimating Software Size
Criteria for a Good Proxy 2

The proxy content of a product should be
automatically countable.


Large amount of proxy data extracted from historical
data is needed to define new estimates.
The proxy must be a physical entity that can be
precisely defined and algorithmically identified.
48
Topic 5 Planning III—Estimating Software Size
Criteria for a Good Proxy 3


The proxy should be easy to visualize at the
beginning of a project.
The proxy should be customizable to the special
need of using organizations.


Different product types may use different kind of
proxies to estimate.
The proxy should be sensitive to any implementation
variations that impact development costs or efforts.

for example, program languages, design styles,
application types
49
Topic 5 Planning III—Estimating Software Size
Objects as Proxies 1

Objects in OO programming languages are a good
candidate as proxies because they closely relate to
development effort or resources.
 Figures 5.3 and 5.4 show close correlation between
estimated object LOC (=Σobject size ) and actual
program LOC.


Linear regression formula: (See Topic 15 )
actual program LOC = β0 + estimate object LOC * β1
Figures 5.5 and 5.6 show high correlation and
significance between estimated object LOC and actual
development hours.

Linear regression formula:
actual development hours = β0 + estimate object LOC * β1
50
Topic 5 Planning III—Estimating Software Size
Objects as Proxies 2


The PROBE method uses objects as proxies.
The PROBE method requires that estimators
have historical data on the sizes of objects
they have developed and that these data be
divided into categories.
51
Topic 5 Planning III—Estimating Software Size
2000
Actual Program LOC
1800
1600
1400
1200
1000
800
600
400
200
0
0
100
200
300
400
500
600
700
800
900
1000
Estimated Object LOC
Fig. 5.3 Estimated Object LOC vs. Actual Program LOC (10 Pascal Programs)
52
Topic 5 Planning III—Estimating Software Size
800
Actual Program LOC
700
600
500
400
300
200
100
0
0
50
100
150
200
250
300
350
Estimated Object LOC
Fig. 5.4 Estimated Object LOC vs. Actual Program LOC (25 C++ Programs)
53
Topic 5 Planning III—Estimating Software Size
Actual Development Hours
200
180
160
140
120
100
80
60
40
20
0
0
100
200
300
400
500
600
700
800
900
1000
Estimated Object LOC
Fig. 5.5 Estimated Pascal Object LOC vs. Actual Development Hours
with Correlation 0.934, Significance < 0.005
54
Topic 5 Planning III—Estimating Software Size
Actual Development Hours
60
50
40
30
20
10
0
0
50
100
150
200
250
300
350
Estimated Object LOC
Fig. 5.6 Estimated C++ Object LOC vs. Actual Development Hours
with Correlation 0.980, Significance < 0.005
55
Topic 5 Planning III—Estimating Software Size
Estimating Object Size with
Fuzzy-Logic Method
Judge the size of each object on a per-object’s
method basis with fuzzy-logic method.

1.
2.
3.
4.
decide the category of the object
judge how many methods it likely will contain
decide the size range it falls into
estimated object size = (# of methods) * (LOC of the
size range)
Table 5.6 shows object category sizes in LOC perobject’s method


For example, a medium-sized Pascal text object with
4 methods has about 66 (=16.48*4) LOC.
56
Topic 5 Planning III—Estimating Software Size
C++ Object Size in LOC per Method
Object Pascal Object Size in LOC per Method
Category
Very
Small
Small
Medium
Large
Very
Large
Calculati
on
2.34
5.13
11.25
24.66
54.04
Data
2.60
4.79
8.84
16.31
I/O
9.01
12.06
16.15
Logic
7.55
10.98
Set-up
3.88
Text
2.75
Very
Small
Small
Medium
Large
Control
4.24
8.68
17.79
36.46
74.71
30.09
Display
4.72
6.35
8.55
11.50
15.46
21.62
28.93
File
3.30
6.23
11.74
22.14
41.74
15.98
23.25
33.83
Logic
6.41
12.42
24.06
46.60
90.27
5.04
6.56
8.53
11.09
Print
3.88
5.86
10.15
17.59
30.49
8.00
17.07
36.41
77.66
Text
4.63
8.73
16.48
31.09
58.62
Category
Very
Large
Table 5.6 Object Category Sizes in LOC per Method
57
Topic 5 Planning III—Estimating Software Size
5.4 The PROBE Size
Estimating Method
58
Topic 5 Planning III—Estimating Software Size
5.4 The PROBE Size
Estimating Method


The PROBE size estimating procedure is
shown in Figure 5.7.
In the procedure, a size estimating template,
shown in Table 5.7, will be used.

Use the template to instruct how to estimate
program size with the PROBE method and linear
regression.
59
Topic 5 Planning III—Estimating Software Size
Start
Step 1:
Conceptual
design
Number of
methods
Step 2:
Identify object
Object
Relative
type
size
Reuse
categories
Step 3:
Calculate projected and
modified LOC.
Step 4:
Estimate
program size.
Step 5:
Calculate
prediction interval.
Size Estimate
Topic 5 Planning III—Estimating Software Size
Fig. 5.7 The Procedure of PROBE
60
Method
Table 5.7 Size Estimating Template and example
1
Table 5.7 Size Estimating Template and example
2
Size Estimating Template 1

Base Program: the program you will
enhance and perform any changes to it.



Base Size (B): the LOC of the base program
LOC Deleted (D): the LOC to be deleted from the
base program
LOC Modified (M): the LOC to be modified in the
base program
63
Topic 5 Planning III—Estimating Software Size
Size Estimating Template 2

Projected LOC (P): includes total base additions
LOC (BA) and total new objects LOC (NO)
Base Additions: the new functions to be added to the
base program
 New Objects: the new objects to be added to the base
program
 New Reused Objects: a new object planned to develop
and general enough to put into the reuse library
(Note: mark an * with the new reused objects)
Reused Objects (R): the objects taken from the reuse
library


64
Topic 5 Planning III—Estimating Software Size
Size Estimating Template 3

Calculations



Using actual new and changed LOC and estimated
Object LOC (i.e., P+M) from historical data to obtain
regression parameters β0, β1
Estimated New and Changed LOC (N): use
regression parameters to calculate
N = β0 +β1 * (P + M)
Estimated Total LOC (T): the estimated size of the
final program
65
Topic 5 Planning III—Estimating Software Size
Size Estimating Template 4



Prediction Range: using t distribution (See
Section 15.5.2), a desired prediction interval
percent, and the data for linear regression to
calculate
Lower/Upper Prediction Interval: the interval
(N ± Range) within which the actual new and
changed LOC is likely to fall
Prediction Interval Percent: the percentage
that the actual new and changed LOC is
likely to fall within the interval
66
Topic 5 Planning III—Estimating Software Size
PROBE Step 1 – Conceptual
Design


The conceptual design establishes a
preliminary design approach and names the
expected product objects and their functions.
For an accurate estimate, estimators must
refine the conceptual design to the level of
objects.
67
Topic 5 Planning III—Estimating Software Size
PROBE Step 2 – Identify
Objects

Determine object type and size

if it is a new object, use fuzzy-logic method (see
Section 5.3)
# of methods (judging size using a per-method basis)
 object type
 relative size
 LOC per method
 estimated object size = (# of method) * (LOC per method)
(Note: mark an * with the new reused objects)


if the object is taken from the reuse library, determine


reuse object categories
object LOC
68
Topic 5 Planning III—Estimating Software Size
PROBE Step 3 – Calculate
Projected and Modified LOC

Projected LOC (P) =
Total Base Additions LOC (BA) +
Total New Objects LOC (NO)

Using actual new and changed LOC and
estimated object LOC (i.e., P+M) from historical
data to obtain regression parameters β0, β1

Estimated New and Changed LOC (N) =
β0 +β1 * (P+M)
69
Topic 5 Planning III—Estimating Software Size
PROBE Step 4 – Estimate
Program Size

Estimated program size =
Base Size (B) +
Estimated New and Changed LOC (N) +
Reused Total LOC (R) –
LOC Deleted (D) –
LOC Modified (M)

LOC Modified (M) is subtracted because it is counted
twice: one in Base Size (B) and the other in Estimated
New and Changed LOC (N).
70
Topic 5 Planning III—Estimating Software Size
PROBE Step 5 – Calculate
Prediction Interval 1


The purpose is to assess the quality of the estimate.
Use t distribution, a desired prediction interval
percent, and the data for linear regression
calculation to get



Prediction Range
Prediction Interval [LPI, UPI]
Within the prediction interval, the actual new and
changed LOC is likely to fall with the selected
percent.
71
Topic 5 Planning III—Estimating Software Size
PROBE Step 5 – Calculate
Prediction Interval 2

Prediction Interval: [LPI, UPI]

Lower Prediction Interval (LPI) =

Estimated New and Changed LOC (N) - Range
Upper Prediction Interval (UPI) =
Estimated New and Changed LOC (N) + Range
72
Topic 5 Planning III—Estimating Software Size
PROBE Step 5 – Calculate
Prediction Interval 3

Prediction Range: using the data for linear
regression calculation in Step 3
Variance

2
(
1
n2
n
)  ( yi   0   1 xi )
Range  t ( / 2 , n  2 )
2
i 1
1
1
n

( x k  x avg )
 (x
i
2
 x avg )
2
i  1 .. n
Where
xi is the estimated object LOC (i.e., P+M) in historical data
xavg is the average of xi
xk is the estimated object LOC (i.e., P+M) in the new program
yi is actual new and changed LOC in historical data
73
Topic 5 Planning III—Estimating Software Size
5.5 Object Categories
74
Topic 5 Planning III—Estimating Software Size
5.5 Object Categories


The PROBE method uses objects as proxies.
It needs object categories and their sizes to
judge the size of the new objects.
Table 5.6 shows the example that we want to
produce.
for C++ and Object Pascal
 object sizes per method are divided into 5 size
ranges: very small, small, medium, large, and
very large.

75
Topic 5 Planning III—Estimating Software Size
Object Size Distribution


Assume historical object data are normally
distributed.
Figure 5.8 shows the relation between the
normal distribution and the size ranges.
76
Topic 5 Planning III—Estimating Software Size
σ
Fig. 5.8 Normal Distribution with Size Ranges
77
Topic 5 Planning III—Estimating Software Size
Approaches

Two approaches


If the size data are close to normal distribution,
use normal distribution in the calculation .
Otherwise, use normal distribution of natural log in
the calculation.
78
Topic 5 Planning III—Estimating Software Size
Approach I: Procedure with
Original Data

Use historical data on objects


divide them into categories
calculate the size range midpoints for each
category.


use statistical techniques of normal distribution in the
calculation
The following is the procedure:
79
Topic 5 Planning III—Estimating Software Size
Step 1: Classification


Divide objects in historical data into
categories.
Basic object categories




logic, control
I/O, files, display
data, text, calculation
set-up, error handling
80
Topic 5 Planning III—Estimating Software Size
Step 2: Calculating LOC per
Method


For each category, calculate the LOC per
method of each object.
Table 5.9 shows the example for 13 objects
belonging to the object category, text.
81
Topic 5 Planning III—Estimating Software Size
Object Name
Number of Methods
Object LOC
LOC per Method
each_line
3
31
10.333
each_char
3
18
6.000
list_clump
4
87
21.750
character
3
87
29.000
single_character
3
25
8.333
single_read
3
18
6.000
list_clp
4
89
22.250
char
3
85
28.333
single_char
3
37
12.333
10
558
55.800
string_manager
4
82
20.500
string_builder
5
82
16.400
10
230
23.000
converter
string_decrementer
Table 5.8 Pascal Text Object LOC per Method
82
Topic 5 Planning III—Estimating Software Size
Step 3: Calculating Standard
Deviation

For each category, calculate the variance and
standard deviation of the values from Step 2.



Variance = σ2 = (1/n) ∑i=1..n(xi – xavg )2
Standard Deviation = √ of Variance =σ
where xi = (LOC per method) of each object of one
specific category; xavg denotes the average.
The following table shows the example.
83
Topic 5 Planning III—Estimating Software Size
Object Name
LOC per Method
each_line
(LOC-LOCavg)2
10.333
93.249
each_charr
6.000
196.072
list_clump
21.750
3.054
chracter
29.000
80.954
single_character
8.333
136.171
single_read
6.000
196.072
list_clp
22.250
5.051
char
28.333
69.402
single_char
12.333
58.817
converter
55.800
1281.456
string_manager
20.500
0.247
string_builder
16.400
12.978
string_decrementer
23.000
8.985
260.033
2142.753
Total
Average
Variance=Total/n
Standard Deviation =
20.003
=

Variance
2
164.827

12.839
Table 5.9 Pascal Text Object Standard Deviation
84
Topic 5 Planning III—Estimating Software Size
Step 4: Calculating Size Range
Midpoints

For each category, use the average xavg and
standard deviation σ to calculate the size
range midpoints





VL = xavg + 2σ
L = xavg + σ
M = xavg
S = xavg – σ
VS = xavg - 2σ
85
Topic 5 Planning III—Estimating Software Size
Negative Size Range
Midpoints


Table 5.10 shows the example of the size
range midpoints and the 13 object sizes per
method.
However, in this example, the VS midpoint
is a negative number, which is not what we
want and means that the object data are not
normally distributed.
86
Topic 5 Planning III—Estimating Software Size
Size Ranges
Range Midpoint
LOC
VS
Object
LOC/Method
-5.68
6.000
6.000
S
7.16
8.333
10.333
12.333
16.400
M
20.00
20.500
21.750
22.250
23.000
28.333
29.000
L
32.84
VL
45.68
55.800
Table 5.10 Pascal Text Object and Size Ranges
Topic 5 Planning III—Estimating Software Size
87
Approach II: Procedure with
Natural Log of Original Data


The trick to handle the negative size range
midpoint is to calculate the natural log of the
data.
The following is the procedure with the first 2
steps same as the previous procedure.
88
Topic 5 Planning III—Estimating Software Size
Step 3: Calculating the Natural
Log and Average


For each category, calculate the natural log
(ln) of the LOC per method of each object,
and the average, avgln, of these log values.
Table 5.11 is the example for object category,
text.
89
Topic 5 Planning III—Estimating Software Size
Object Name
each_line
LOC per Method
In (LOC per Method)
(In LOC-In LOCavg)2
10.333
2.335
0.2173
each_charr
6.000
1.792
1.0196
list_clump
21.750
3.080
0.0773
chracter
29.000
3.367
0.3201
single_character
8.333
2.120
0.4641
single_read
6.000
1.792
1.0196
list_clp
22.250
3.102
0.0905
char
28.333
3.344
0.2943
single_char
12.333
2.512
0.0836
converter
55.800
4.022
1.4890
string_manager
20.500
3.020
0.0479
string_builder
16.400
2.797
0.0000
string_decrementer
23.000
3.135
0.1115
Total
260.033
36.419
5.2348
Average
20.003
2.802
Variance
164.827
0.4027
Standard Deviation
12.839
0.6346
InVL=2.802+1.269
4.071
VL=e4.071=
58.62
InL=2.802+.635
3.437
L=e3.437=
31.09
InM=2.802
2.802
M=e2.802=
16.48
InS=2.802-.635
2.167
S=e2.167=
8.73
InVS=2.802-1.269
1.533
VS=e1.533=
4.63
Table 5.11 Pascal Text Object ln (LOC per Method)
Topic 5 Planning III—Estimating Software Size
90
Step 4: Calculating Standard
Deviation

For each category, calculate the variance
and standard deviation of these log values.


Variance = σ2 = (1/n) ∑i=1..n(xi – xavg )2
Standard Deviation = √ of Variance =σ
where xi = ln (LOC per method) of each object of a
category.
91
Topic 5 Planning III—Estimating Software Size
Step 5: Calculating the Log of
Size Range Midpoints

For each category, use average of log values
and standard deviation to calculate the log of
size range midpoints





ln(VL) = avgln + 2σ
ln(L) = avgln + σ
ln(M) = avgln
ln(S) = avgln – σ
ln(VS) = avgln - 2σ
92
Topic 5 Planning III—Estimating Software Size
Step 6: Calculating the
Antilog

For each category, calculate the antilog to get the
midpoints of the size ranges






VL = eln(VL)
V = eln(L)
M = eln(M)
S = eln(S)
VS = eln(VS)
Table 5.12 shows the example of the size range
midpoints and the 13 object sizes per method.
93
Topic 5 Planning III—Estimating Software Size
Size Ranges
Range Midpoint LOC
VS
Object LOC/Method
4.63
6.000
6.000
8.333
S
8.73
10.333
12.333
16.400
M
16.48
20.500
21.750
22.250
23.000
28.333
29.000
L
31.09
55.800
VL
58.62
Table 5.12 Pascal Text Objects and Size Ranges
Topic 5 Planning III—Estimating Software Size
94
5.6 Estimating Considerations
95
Topic 5 Planning III—Estimating Software Size
5.6 Estimating Considerations 1



The PSP estimating objective is to improve your
estimating ability by tracking and analyzing your
estimates.
If your estimating process is stable, the linear regression
method, based on the historical data gathered from
consistently biased estimates, can make an accurate bias
adjustment.
While you gain more experience and your process
evolves, you should adjust your statistical calculations to
include only the newer and more representative data and
drop the old ones.
96
Topic 5 Planning III—Estimating Software Size
Estimating Considerations 2

Whenever your linear regression parameters
appear unreasonable (e.g., β1 far from 1.0,
large β0 ), use the averaging method to
estimate.

This method uses a ratio to adjust size or time
based on historical averages.

estimated program LOC = estimated object LOC * ratio
where ratio = historical average =
∑(final program LOC) / ∑ (estimated object LOC)
97
Topic 5 Planning III—Estimating Software Size
Estimating Considerations 3


To use the linear regression method, you
must have at least three programs for which
you have made object LOC estimates.
If you have at least three programs but
enough historical estimate data,


obtain β0 and β1 from your actual size data
If you do not have enough historical data but
at least one program,

use the averaging method
98
Topic 5 Planning III—Estimating Software Size
Estimating Considerations 4


You can learn to reduce the estimating bias
by comparing, during postmortem, estimates
made at each phase with their actual size.
To estimate unprecedented products, the
best answer is to resist making firm
estimates until you have completed a
feasibility study and build some prototypes.
99
Topic 5 Planning III—Estimating Software Size
5.7 Summary
100
Topic 5 Planning III—Estimating Software Size
5.7 Summary 1



Accurate size estimate will help you to make
better development plans.
Size estimating skill improve with practice.
A defined and measured process provides a
repeatable basis for improvement.
101
Topic 5 Planning III—Estimating Software Size
Summary 2

With PROBE, estimates are based on one of
following four methods:
Method A: regression with estimated object LOC
 Method B: regression with estimated new and
changed LOC
 Method C: size or time adjustment based on
historical averages (the averaging method)
 Method D: engineering judgment

102
Topic 5 Planning III—Estimating Software Size
Summary 3

Method A: regression with estimated object
LOC

use the relationship between estimated object
LOC and



actual new and changed LOC
actual development time
The criteria for using this method are
3 or more data points that are correlated (r2 > 0.5)
 Reasonable regression parameters

103
Topic 5 Planning III—Estimating Software Size
Summary 4

Method B: regression with estimated new
and changed LOC

use the relationship between estimated new and
changed LOC and



actual new and changed LOC
actual development time
The criteria for using this method are
3 or more data points that are correlated (r2 > 0.5)
 Reasonable regression parameters

104
Topic 5 Planning III—Estimating Software Size
Summary 5

Method C: adjusting size or time based on
historical averages.
the averaging method
 easy to use
 used when linear regression parameters (β0, β1)
appear unreasonable (that is, methods A and B
can not be used)
 assuming that there is no fixed overhead


The criteria for using this method are

At least one data point is required.
Topic 5 Planning III—Estimating Software Size
105
Summary 6

Method D: engineering Judgment with
estimated object LOC
used in absence of historical data
 using judgment from estimated object LOC to
estimate




actual new and changed LOC
actual development time
used when methods A, B, and C can not be used
106
Topic 5 Planning III—Estimating Software Size
5.8 Exercises
107
Topic 5 Planning III—Estimating Software Size
Program 3A 1


Use PSP0.1 (see Appendix in Topic 4) to
write program 3A.
Program 3A Requirements:

Write a program to count




the total program LOC
the total LOC in each object
the number of methods in each object
If an object-oriented program is not used as the
input, count


the total program LOC
the total LOC in each procedure or function
108
Topic 5 Planning III—Estimating Software Size
Program 3A 2



Program 3A Testing:




Use the counting standard produced by report exercise
R1.
It is acceptable to enhance program 2A or to reuse
some of its methods, procedures, or functions in
developing this program.
Thoroughly test the program.
At a minimum, test program 1A, 2A, and 3A.
Prepare a test report that includes a table as the format
in Table 5.11.
Produce a report on the defect fix times for programs
1A, 2A, and 3A.
109
Topic 5 Planning III—Estimating Software Size
a) Format for object-oriented program designs
Program
number
Object Name
Number of
Methods
Object LOC
1A
ABC
3
86
DEF
2
8
GHI
4
92
Total Program LOC
212
2A
…
b) Format for non object-oriented program designs
Program
number
Procedure/
Function Name
Number of
Methods
Procedure/
Function LOC
1A
ABC
1
86
DEF
1
8
GHI
1
92
Total Program LOC
212
2A
…
Table 5.11 Test Result Format  Program 3A
Program 3A 3

Order to Submit Assignment:










Cover sheet: Exercise #, Name, SID
PSP0.1 Project Plan Summary
PIP form, including lessons learned
Time Recording Log
Defect Recording Log
Source program listing
Report R1 LOC counting standard (if modified)
Report R2 coding standard (if modified)
Report R3 defect analysis report
Test Results
111
Topic 5 Planning III—Estimating Software Size
Program 4A 1


Use PSP1 (see Appendix in this topic) to
write program 4A.
Program 4A Requirements:

Write a program to calculate the linear regression
size-estimating parameters:
n
 
x
i
y i  nx avg y avg
i 1
n

x i  n ( x avg )
2
2
i 1
   y avg    x avg
112
Topic 5 Planning III—Estimating Software Size
Program 4A 2


Use the historical data of a set of n programs: object
LOC, xi, and new and changed LOC, yi.
Enhance the linked list of program 1A to hold the n
data records, where each record has 2 real numbers.
113
Topic 5 Planning III—Estimating Software Size
Program 4A 3

Program 4A Testing:


Thoroughly test the program.
At a minimum, test it with the 3 cases shown in Table
5.12:




use the data for estimated object LOC and actual new and
changed LOC.
use the data for estimated new and changed LOC and actual
new and changed LOC.
use the data, estimated new and changed LOC and actual
new and changed LOC, you have gathered for the programs
2A, 3A and 4A you have developed.
Prepare a test report that includes a table as the format
in Table 5.13.
114
Topic 5 Planning III—Estimating Software Size
Program Number
Estimated Object LOC
Estimated New and
Changed LOC
Actual New and
Changed LOC
1
130
163
186
2
650
765
699
3
99
141
132
4
150
166
272
5
128
137
291
6
320
355
331
7
95
136
199
8
945
1206
1890
9
368
433
788
10
961
1130
1601
Sum
3828
4632
6389
Average
382.8
463.2
638.9
Table 5.12 Size Estimating Regression Data
Test
Expected Results
β0
Β1
Table D8:
Estimated Object
versus
Actual New And
Changed
LOC
-22.55
1.7279
Table D8:
Estimated New and
Changed LOC versus
Actual New and
Changed LOC
-23.92
1.4310
Program 2A, 3A, 4A:
Estimated New LOC
versus Actual New
and Changed LOC
NA
NA
Actual Results
Β0
Table 5.13 Test Result Format  Program 4A
Β1
Appendix PSP 1
117
Topic 5 Planning III—Estimating Software Size
Report R3 Requirements
118
Topic 5 Planning III—Estimating Software Size
Requirements for Report 3

The objectives of the defect analysis are to
help you understand the


Density and type of defects introduced and found
while developing programs.
Importance of carefully gathering, recording, and
reporting process data.
119
Topic 5 Planning III—Estimating Software Size
Report 3 Requirements 1


Analyze the defects found in development the
initial programs.
Produce a report that includes these table.



Defect density
Compile and test phase defect density
Average defect fix time by phase injected and
removed
120
Topic 5 Planning III—Estimating Software Size
Report 3 Requirements 2

To prepare the defect analysis report, you will
need the following project plan summary data
for programs 1A through 3A.



new and changed LOC
defect injected and removed for each phase
From the defect logs, you will need counts and
fix times for all defects.




Injected in design and found in compile or test
Injected in coding and found in compile or test
Injected in design or coding
founded in compile or test
Topic 5 Planning III—Estimating Software Size
121
Example Defect Analysis Report 3
Defect Densities
Program
Number
New and
Changed
LOC
Total Defects
Compile and Test Defects
Defects per
KLOC
Defects found
in compile
Compile
defects per
KLOC
Defects
found in
test
Test
defects
per
KLOC
1
111
17
153
9
81
2
18
2
88
6
68
6
68
0
0
3
103
10
97
4
39
5
49
4
77
8
104
3
39
5
49
5
81
8
99
0
0
0
0
6
124
8
65
3
24
0
0
7
175
24
137
5
29
2
11
8
117
9
77
1
9
0
0
9
153
16
105
0
0
1
7
10
224
15
67
2
9
1
4
Totals
1253
121
97
33
26
11
9
122
Topic 5 Planning III—Estimating Software Size
Example Defect Analysis Report 3
Defect Fix Times
Defects found
in compiling
Defects found
in testing
Total defects
found
Defects
injected in
designing
Total fix time
1
137
256
Total defects
1
4
48
Average fix
time
1
34
5
Defects
injected in
coding
Total fix time
93
9
122
Total defects
32
3
61
3
3
2
Total
defects
injected
Total fix time
94
159
444
Total defects
33
11
124
3
14
4
Average fix
time
Average fix
time
Topic 5 Planning III—Estimating Software Size
123
Phase
Number
Purpose
To guide you in developing module-level programs
Entry Criteria
Problem
1
Planning
Produce
2
Development
Design
description
PSP1 Project Plan Summary form
Size Estimating Template
Historical estimate and actual size data
Time and Defect Recording Logs
Defect Type Standard
Stop watch (optional)
or obtain a requirements statement
Use the PROBE method to estimate the total new and
changed LOC required.
Complete the Size Estimating Template.
Estimate the required development time
Enter the plan data in the Project Plan Summary form
Complete the Time Recording Log
the program
Implement the design
Compile the program and fix and log all defects found
Test the program and fix and log all defects found
Complete the Time Recording Log
PSP1 Process Script 1
Phase
Number
Purpose
To guide you in developing module-level programs
3
Postmortem
Complete the Project Plan Summary form with actual
time and defect data
Exit Criteria
A
thoroughly tested program
Completed Project Plan Summary with estimated and
actual data
Completed Size Estimating Template
Completed Test Report Template
Completed PIP forms
Completed Defect and Time Recording Logs
PSP1 Process Script 2
Phase
Number
1
2
Purpose
To guide the PSP planning process
Entry Criteria
Problem
Program
Requirements
Produce
Size Estimate
Produce
description
PSP1 Project Plan Summary form
Size Estimating Template
Historical estimate and actual size data
Time Recording Logs
or obtain a requirements statement for the
program.
Ensure the requirements statement is clear and
unambiguous.
Resolve any questions.
a program conceptual design.
Use the PROBE method to estimate the new and
changed LOC required to develop this program.
Estimate the base, added, deleted, modified, and
reused LOC.
Complete the Size Estimating Template and Project
Plan Summary.
PSP1 Planning Script 1
Phase
Number
Purpose
To guide the PSP planning process
3
Estimate
Resources
Based
Exit Criteria
A
on the time required per LOC on previous
programs, make your best estimate of the time
required to develop this program.
Using the To Date % from the most recently developed
program as a guide, describe the development time
over the planned project phases.
documented requirements statement
The program conceptual design
Completed Size Estimating Template
A completed Project Plan Summary with estimated
program size and development time data
Completed Time Recording Logs
PSP1 Planning Script 2
Phase
Number
Purpose
To guide the Development of small programs
Entry
Criteria
Requirements
1
Design
Review
2
Code
Implement
3
Compile
Compile
statement
Project Plan Summary with planned program size and
development time
Time and Defect Recording Logs
Defect Type Standard and Coding Standard
the requirements and produce a design to meet them
Record time in Time Recording Log
the design following Coding Standard
Record in the Defect Recording Log any requirements or design
defects found
Record time in Time Recording Log
the program until error free
Fix all defects found
Record defects in the Defect Recording Log
Record time in Time Recording Log
PSP1 Development Script 1
Phase
Number
Purpose
To guide the Development of small programs
4
Test
Test
Exit
Criteria
A
until all tests run without error.
Fix all defects found.
Record defects in the Defect Recording Log.
Record time in Time Recording Log.
Complete a Test Report Template on the tests conducted
and results obtained.
thoroughly tested program that conforms to the Coding
Standard
Completed Test Report Template
Completed Defect and Time Recording Logs
PSP1 Development Script 2
Phase
Number
Purpose
To guide the PSP postmortem process
Entry
Criteria
Problem
1
Defects
Injected
Determine
2
Defects
Removed
Determine
3
Size
Count
description and requirements statement
Project Plan Summary form with planned program size and
development time
Completed Test Report Template
Completed Time Recording Logs
Completed Defect Recording Log
A tested and running program that conforms to the Coding Standard
from the Defect Recording Log the number of defects
injected in each PSP1 phase
Enter this number under Defects Injected – Actual on the Project Plan
Summary
from the Defect Recording Log the number of defects
removed in each PSP1 phase
Enter this number under Defects Removed – Actual on the Project Plan
Summary
the LOC in the completed program.
Determine the base, reused, deleted, modified, added, total, total new
and changed, and new reused LOC.
Enter these data on the Project Plan Summary.
PSP1 Postmortem Script 1
Phase
Number
Purpose
To guide the PSP postmortem process
4
Time
Review
Exit
Criteria
A
the completed Time Recording Log
Enter the total time spent in each PSP1 phase under Actual on the
Project Plan Summary form
fully tested program that Conforms to the Coding Standard
Completed Test Report Template
Completed Project Plan Summary form
Completed PIP forms describing process problems, improvement
suggestions, and lessons learned.
Completed Defect and Time Recording Logs
PSP1 Postmortem Script 2
Size Estimating Template 1
Size Estimating Template 2
Test Report Template
PSP1 Project Plan Summary 1
PSP1 Project Plan Summary 2